ContainerGump Class Reference

#include <ContainerGump.h>

Inheritance diagram for ContainerGump:

ItemRelativeGump Gump Object PaperdollGump List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 ContainerGump ()
 ContainerGump (Shape *shape, uint32 framenum, uint16 owner, uint32 _Flags=FLAG_DRAGGABLE, sint32 layer=LAYER_NORMAL)
virtual ~ContainerGump (void)
void setItemArea (Pentagram::Rect *itemarea_)
virtual void Close (bool no_del=false)
virtual void InitGump (Gump *newparent, bool take_focus=true)
virtual void PaintThis (RenderSurface *, sint32 lerp_factor, bool scaled)
virtual uint16 TraceObjId (int mx, int my)
virtual bool GetLocationOfItem (uint16 itemid, int &gx, int &gy, sint32 lerp_factor=256)
virtual bool StartDraggingItem (Item *item, int mx, int my)
virtual bool DraggingItem (Item *item, int mx, int my)
virtual void DraggingItemLeftGump (Item *item)
virtual void StopDraggingItem (Item *item, bool moved)
virtual void DropItem (Item *item, int mx, int my)
virtual Gump * OnMouseDown (int button, int mx, int my)
virtual void OnMouseClick (int button, int mx, int my)
virtual void OnMouseDouble (int button, int mx, int my)
bool loadData (IDataSource *ids, uint32 version)

Protected Member Functions

virtual void saveData (ODataSource *ods)
virtual void GetItemLocation (sint32 lerp_factor)
virtual Container * getTargetContainer (Item *item, int mx, int my)
void getItemCoords (Item *item, sint32 &itemx, sint32 &itemy)

Protected Attributes

Pentagram::Rect itemarea
bool display_dragging
uint32 dragging_shape
uint32 dragging_frame
uint32 dragging_flags
sint32 dragging_x
sint32 dragging_y

Detailed Description

Definition at line 27 of file ContainerGump.h.


Constructor & Destructor Documentation

ContainerGump::ContainerGump (  ) 

Definition at line 45 of file ContainerGump.cpp.

ContainerGump::ContainerGump ( Shape *  shape,
uint32  framenum,
uint16  owner,
uint32  _Flags = FLAG_DRAGGABLE,
sint32  layer = LAYER_NORMAL 
)

Definition at line 51 of file ContainerGump.cpp.

References Gump::framenum, and Gump::shape.

ContainerGump::~ContainerGump ( void   )  [virtual]

Definition at line 60 of file ContainerGump.cpp.


Member Function Documentation

void ContainerGump::Close ( bool  no_del = false  )  [virtual]

Close the gump

Parameters:
no_del If true, do not delete after closing

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 253 of file ContainerGump.cpp.

References Item::clearGump(), Gump::Close(), Container::contents, getContainer(), getGump(), getItem(), and Gump::owner.

Referenced by GetItemLocation(), and PaintThis().

bool ContainerGump::DraggingItem ( Item *  item,
int  mx,
int  my 
) [virtual]

Called when an item is being dragged over the gump. Note: this may be called on a different gump than StartDraggingItem.

Returns:
false if the item can't be dragged to this location.

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 389 of file ContainerGump.cpp.

References Container::CanAddItem(), Item::canReach(), display_dragging, dragging_flags, dragging_frame, dragging_shape, dragging_x, dragging_y, GUIApp::get_instance(), getContainer(), GUIApp::getDraggingOffset(), Item::getFlags(), Item::getFrame(), getMainActor(), Item::getShape(), getTargetContainer(), Pentagram::Rect::h, itemarea, GUIApp::MOUSE_TARGET, Gump::owner, GUIApp::setMouseCursor(), Pentagram::Rect::w, Pentagram::Rect::x, and Pentagram::Rect::y.

void ContainerGump::DraggingItemLeftGump ( Item *  item  )  [virtual]

Called when an item that was being dragged over the gump left the gump.

Reimplemented from Gump.

Definition at line 431 of file ContainerGump.cpp.

References display_dragging.

void ContainerGump::DropItem ( Item *  item,
int  mx,
int  my 
) [virtual]

Called when an item has been dropped on a gump. This is called after StopDraggingItem has been called, but possibly on a different gump. It's guaranteed that a gump will only receive a DropItem at a location if a DraggingItem there returned true.

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 442 of file ContainerGump.cpp.

References Kernel::addProcess(), Item::canMergeWith(), ItemFactory::createItem(), Gump::CreateNotifier(), Item::destroy(), display_dragging, dragging_x, dragging_y, Item::EXT_HIGHLIGHT, Item::EXT_SPRITE, Item::EXT_TRANSPARENT, Item::FLG_DISPOSABLE, Item::FLG_FAST_ONLY, Item::FLG_FLIPPED, Item::FLG_INVISIBLE, Item::FLG_LOW_FRICTION, Item::FLG_OWNED, GUIApp::get_instance(), Kernel::get_instance(), getContainer(), GUIApp::getDraggingOffset(), Item::getExtFlags(), Item::getFlags(), Item::getFrame(), getItem(), Item::getMapNum(), Gump::GetNotifyProcess(), Item::getNpcNum(), Object::getObjId(), Item::getParent(), Item::getQuality(), Item::getShape(), Item::getShapeInfo(), getTargetContainer(), ItemRelativeGump::GumpToParent(), ShapeInfo::hasQuantity(), SliderGump::InitGump(), itemarea, Container::moveItemToEnd(), Item::moveToContainer(), Gump::notifier, Gump::owner, perr, Item::randomGumpLocation(), Item::setGumpLocation(), TraceObjId(), Process::waitFor(), Pentagram::Rect::x, and Pentagram::Rect::y.

ContainerGump::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from ItemRelativeGump.

Reimplemented in PaperdollGump.

void ContainerGump::getItemCoords ( Item *  item,
sint32 &  itemx,
sint32 &  itemy 
) [protected]

Definition at line 85 of file ContainerGump.cpp.

References Item::getGumpLocation(), Pentagram::Rect::h, itemarea, Item::setGumpLocation(), Pentagram::Rect::w, Pentagram::Rect::x, and Pentagram::Rect::y.

Referenced by GetLocationOfItem(), PaintThis(), StartDraggingItem(), and TraceObjId().

void ContainerGump::GetItemLocation ( sint32  lerp_factor  )  [protected, virtual]

Reimplemented from ItemRelativeGump.

Definition at line 213 of file ContainerGump.cpp.

References Close(), Gump::dims, Gump::FindGump(), getItem(), Gump::GetLocationOfItem(), Object::getObjId(), Item::getParentAsContainer(), Gump::GetRootGump(), Item::getShapeInfo(), Gump::GumpToScreenSpace(), Pentagram::Rect::h, ItemRelativeGump::ix, ItemRelativeGump::iy, Gump::owner, Gump::parent, Gump::ScreenSpaceToGump(), Pentagram::Rect::w, and ShapeInfo::z.

bool ContainerGump::GetLocationOfItem ( uint16  itemid,
int &  gx,
int &  gy,
sint32  lerp_factor = 256 
) [virtual]

Get the location of an item in the gump (coords relative to this).

Returns:
false on failure

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 192 of file ContainerGump.cpp.

References getItem(), getItemCoords(), Object::getObjId(), Item::getParentAsContainer(), Gump::owner, and Gump::parent.

Container * ContainerGump::getTargetContainer ( Item *  item,
int  mx,
int  my 
) [protected, virtual]

Definition at line 279 of file ContainerGump.cpp.

References Item::FLG_IN_NPC_LIST, getContainer(), Item::getFlags(), Object::getObjId(), Item::getShapeInfo(), ItemRelativeGump::GumpToParent(), ShapeInfo::is_land(), Gump::owner, and TraceObjId().

Referenced by DraggingItem(), and DropItem().

void ContainerGump::InitGump ( Gump *  newparent,
bool  take_focus = true 
) [virtual]

Init the gump and add it to parent; call after construction When newparent is 0, this will call GUIApp::addGump().

Parameters:
newparent The Gump's new parent or 0.
takefocus If true, set parent's focus_child to this

Reimplemented from ItemRelativeGump.

Reimplemented in PaperdollGump.

Definition at line 65 of file ContainerGump.cpp.

References Gump::dims, Gump::framenum, getContainer(), Shape::getFrame(), Pentagram::Rect::h, ShapeFrame::height, ItemRelativeGump::InitGump(), Gump::owner, Gump::shape, Pentagram::Rect::w, and ShapeFrame::width.

Referenced by PaperdollGump::InitGump(), and Item::openGump().

bool ContainerGump::loadData ( IDataSource *  ids,
uint32  version 
)

Reimplemented from ItemRelativeGump.

Reimplemented in PaperdollGump.

Definition at line 555 of file ContainerGump.cpp.

References itemarea, ItemRelativeGump::loadData(), and Pentagram::Rect::Set().

Referenced by PaperdollGump::loadData().

void ContainerGump::OnMouseClick ( int  button,
int  mx,
int  my 
) [virtual]

Reimplemented from Gump.

Definition at line 317 of file ContainerGump.cpp.

References BUTTON_LEFT, Item::callUsecodeEvent_look(), Item::dumpInfo(), GUIApp::get_instance(), getItem(), pout, and TraceObjId().

void ContainerGump::OnMouseDouble ( int  button,
int  mx,
int  my 
) [virtual]

Reimplemented from Gump.

Definition at line 338 of file ContainerGump.cpp.

References BUTTON_LEFT, Item::canReach(), Item::dumpInfo(), GUIApp::flashCrossCursor(), GUIApp::get_instance(), getItem(), getMainActor(), Object::getObjId(), Gump::owner, pout, TraceObjId(), and Item::use().

Gump * ContainerGump::OnMouseDown ( int  button,
int  mx,
int  my 
) [virtual]

Reimplemented from Gump.

Definition at line 305 of file ContainerGump.cpp.

References BUTTON_LEFT, and Gump::OnMouseDown().

void ContainerGump::PaintThis ( RenderSurface *  ,
sint32  lerp_factor,
bool  scaled 
) [virtual]

Overloadable method to Paint just this Gump (RenderSurface is relative to this).

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 104 of file ContainerGump.cpp.

References Close(), Container::contents, display_dragging, dragging_flags, dragging_frame, dragging_shape, dragging_x, dragging_y, Item::FLG_FLIPPED, GameData::get_instance(), GUIApp::get_instance(), Kernel::get_instance(), getContainer(), Shape::getFrame(), Kernel::getFrameNum(), getItemCoords(), GameData::getMainShapes(), GUIApp::isPaintEditorItems(), itemarea, Gump::owner, RenderSurface::Paint(), RenderSurface::PaintInvisible(), Gump::PaintThis(), Pentagram::Rect::x, and Pentagram::Rect::y.

void ContainerGump::saveData ( ODataSource *  ods  )  [protected, virtual]

save the actual Object data

Reimplemented from ItemRelativeGump.

Reimplemented in PaperdollGump.

Definition at line 545 of file ContainerGump.cpp.

References Pentagram::Rect::h, itemarea, ItemRelativeGump::saveData(), Pentagram::Rect::w, ODataSource::write4(), Pentagram::Rect::x, and Pentagram::Rect::y.

Referenced by PaperdollGump::saveData().

void ContainerGump::setItemArea ( Pentagram::Rect *  itemarea_  )  [inline]

Definition at line 37 of file ContainerGump.h.

References itemarea.

Referenced by Item::openGump().

bool ContainerGump::StartDraggingItem ( Item *  item,
int  mx,
int  my 
) [virtual]

This will be called when an item in this gump starts to be dragged.

Returns:
false if the item isn't allowed to be dragged.

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 369 of file ContainerGump.cpp.

References Item::canReach(), GUIApp::get_instance(), getContainer(), getItemCoords(), getMainActor(), Gump::owner, and GUIApp::setDraggingOffset().

Referenced by PaperdollGump::StartDraggingItem().

void ContainerGump::StopDraggingItem ( Item *  item,
bool  moved 
) [virtual]

Called when a drag operation finished. This is called on the same gump that received StartDraggingItem

Parameters:
moved If true, the item was actually dragged somewhere else. If false, the drag was cancelled.

Reimplemented from Gump.

Definition at line 437 of file ContainerGump.cpp.

uint16 ContainerGump::TraceObjId ( int  mx,
int  my 
) [virtual]

Trace a click, and return ObjId.

Reimplemented from Gump.

Reimplemented in PaperdollGump.

Definition at line 153 of file ContainerGump.cpp.

References Container::contents, frame, GUIApp::get_instance(), getContainer(), Shape::getFrame(), getItemCoords(), Object::getObjId(), ShapeFrame::hasPoint(), GUIApp::isPaintEditorItems(), Object::objid, Gump::owner, ItemRelativeGump::ParentToGump(), and Gump::TraceObjId().

Referenced by DropItem(), getTargetContainer(), OnMouseClick(), and OnMouseDouble().


Member Data Documentation

bool ContainerGump::display_dragging [protected]

Definition at line 79 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), DraggingItemLeftGump(), PaperdollGump::DropItem(), DropItem(), PaperdollGump::PaintThis(), and PaintThis().

uint32 ContainerGump::dragging_flags [protected]

Definition at line 82 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), PaperdollGump::PaintThis(), and PaintThis().

uint32 ContainerGump::dragging_frame [protected]

Definition at line 81 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), PaperdollGump::PaintThis(), and PaintThis().

uint32 ContainerGump::dragging_shape [protected]

Definition at line 80 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), PaperdollGump::PaintThis(), and PaintThis().

sint32 ContainerGump::dragging_x [protected]

Definition at line 83 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), DropItem(), PaperdollGump::PaintThis(), and PaintThis().

sint32 ContainerGump::dragging_y [protected]

Definition at line 83 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), DropItem(), PaperdollGump::PaintThis(), and PaintThis().

Pentagram::Rect ContainerGump::itemarea [protected]

Definition at line 77 of file ContainerGump.h.

Referenced by PaperdollGump::DraggingItem(), DraggingItem(), PaperdollGump::DropItem(), DropItem(), getItemCoords(), PaperdollGump::GetLocationOfItem(), loadData(), PaperdollGump::PaintThis(), PaintThis(), saveData(), setItemArea(), and PaperdollGump::TraceObjId().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:28:55 2007 for pentagram by  doxygen 1.4.7