ScummVM API documentation
Ultima::Ultima8::ContainerGump Class Reference

#include <container_gump.h>

Inheritance diagram for Ultima::Ultima8::ContainerGump:
Ultima::Ultima8::ItemRelativeGump Ultima::Ultima8::Gump Ultima::Ultima8::Object Ultima::Ultima8::PaperdollGump

Public Member Functions

 ContainerGump (const Shape *shape, uint32 frameNum, uint16 owner, uint32 flags=FLAG_DRAGGABLE, int32 layer=LAYER_NORMAL)
 
void setItemArea (Rect *itemArea)
 
void Close (bool no_del=false) override
 
void InitGump (Gump *newparent, bool take_focus=true) override
 
void run () override
 Run the gump.
 
void PaintThis (RenderSurface *, int32 lerp_factor, bool scaled) override
 Overloadable method to Paint just this Gump (RenderSurface is relative to this)
 
uint16 TraceObjId (int32 mx, int32 my) override
 Trace a click, and return ObjId.
 
bool GetLocationOfItem (uint16 itemid, int32 &gx, int32 &gy, int32 lerp_factor=256) override
 
bool StartDraggingItem (Item *item, int mx, int my) override
 
bool DraggingItem (Item *item, int mx, int my) override
 
void DraggingItemLeftGump (Item *item) override
 Called when an item that was being dragged over the gump left the gump.
 
void StopDraggingItem (Item *item, bool moved) override
 
void DropItem (Item *item, int mx, int my) override
 
GumponMouseDown (int button, int32 mx, int32 my) override
 
void onMouseClick (int button, int32 mx, int32 my) override
 
void onMouseDouble (int button, int32 mx, int32 my) override
 
bool loadData (Common::ReadStream *rs, uint32 version)
 
void saveData (Common::WriteStream *ws) override
 
- Public Member Functions inherited from Ultima::Ultima8::ItemRelativeGump
 ItemRelativeGump (int32 x, int32 y, int32 width, int32 height, uint16 owner, uint32 flags=0, int32 layer=LAYER_NORMAL)
 
void InitGump (Gump *newparent, bool take_focus=true) override
 
void Paint (RenderSurface *, int32 lerp_factor, bool scaled) override
 
void ParentToGump (int32 &px, int32 &py, PointRoundDir r=ROUND_TOPLEFT) override
 Convert a parent relative point to a gump point.
 
void GumpToParent (int32 &gx, int32 &gy, PointRoundDir r=ROUND_TOPLEFT) override
 Convert a gump point to parent relative point.
 
void Move (int32 x, int32 y) override
 Move this gump.
 
bool loadData (Common::ReadStream *rs, uint32 version)
 
- Public Member Functions inherited from Ultima::Ultima8::Gump
 Gump (int x, int y, int width, int height, uint16 owner=0, uint32 flags=0, int32 layer=LAYER_NORMAL)
 
virtual void CreateNotifier ()
 
void SetNotifyProcess (GumpNotifyProcess *proc)
 
GumpNotifyProcessGetNotifyProcess ()
 
uint32 GetResult ()
 
void SetResult (uint32 res)
 
void SetShape (const Shape *shape, uint32 frameNum)
 Set the Gump's shape/frame.
 
void SetShape (FrameID frame, bool adjustsize=false)
 
void UpdateDimsFromShape ()
 Update the width/height to match the gump's current shape frame.
 
void Set_frameNum (uint32 frameNum)
 Set the Gump's frame.
 
virtual GumpFindGump (FindGumpPredicate predicate, bool recursive=true)
 
template<class T >
GumpFindGump (bool recursive=true)
 
virtual GumpFindGump (int mx, int my)
 
virtual bool GetMouseCursor (int32 mx, int32 my, Shape &shape, int32 &frame)
 
virtual void RenderSurfaceChanged ()
 
virtual void CloseItemDependents ()
 
virtual void PaintCompositing (RenderSurface *surf, int32 lerp_factor, int32 scalex, int32 scaley)
 
bool IsClosing () const
 Check to see if a Gump is Closing.
 
virtual void MoveRelative (int x, int y)
 Move this gump relative to its current position.
 
void getLocation (int32 &x, int32 &y) const
 
virtual void setRelativePosition (Position pos, int xoffset=0, int yoffset=0)
 Moves this gump to a relative location on the parent gump.
 
virtual void GetDims (Rect &d) const
 Get the _dims.
 
virtual void SetDims (const Rect &d)
 Set the _dims.
 
virtual bool PointOnGump (int mx, int my)
 Detect if a point is on the gump.
 
virtual void ScreenSpaceToGump (int32 &sx, int32 &sy, PointRoundDir r=ROUND_TOPLEFT)
 Convert a screen space point to a gump point.
 
virtual void GumpToScreenSpace (int32 &gx, int32 &gy, PointRoundDir r=ROUND_TOPLEFT)
 Convert a gump point to a screen space point.
 
virtual void GumpRectToScreenSpace (Rect &gr, RectRoundDir r=ROUND_OUTSIDE)
 Transform a rectangle to screenspace from gumpspace.
 
virtual void ScreenSpaceToGumpRect (Rect &sr, RectRoundDir r=ROUND_OUTSIDE)
 Transform a rectangle to gumpspace from screenspace.
 
virtual void onMouseUp (int button, int32 mx, int32 my)
 
virtual GumponMouseMotion (int32 mx, int32 my)
 
virtual void onMouseOver ()
 
virtual void onMouseLeft ()
 
virtual bool OnKeyDown (int key, int mod)
 
virtual bool OnKeyUp (int key)
 
virtual bool OnTextInput (int unicode)
 
virtual void OnFocus (bool)
 
virtual void MakeFocus ()
 
bool IsFocus ()
 
GumpGetFocusChild ()
 
void FindNewFocusChild ()
 
virtual void AddChild (Gump *, bool take_focus=true)
 Add a gump to the child list.
 
virtual void RemoveChild (Gump *)
 Remove a gump from the child list.
 
virtual void MoveChildToFront (Gump *)
 Move child to front (within its layer)
 
GumpGetParent ()
 Get the parent.
 
GumpGetRootGump ()
 Get the root gump (or self)
 
virtual void ChildNotify (Gump *child, uint32 message)
 
void SetIndex (int32 i)
 
int32 GetIndex () const
 
virtual bool onDragStart (int32 mx, int32 my)
 
virtual void onDragStop (int32 mx, int32 my)
 
virtual void onDrag (int32 mx, int32 my)
 
bool hasFlags (uint flags) const
 Does this gump have any of the given flags mask set.
 
bool IsHidden () const
 
bool IsDraggable () const
 
virtual void HideGump ()
 
virtual void UnhideGump ()
 
void SetVisibility (bool visible)
 
bool mustSave (bool toplevel) const
 
bool loadData (Common::ReadStream *rs, uint32 version)
 
- Public Member Functions inherited from Ultima::Ultima8::Object
ObjId getObjId () const
 get this Object's objID
 
virtual ObjId assignObjId ()
 
virtual void clearObjId ()
 Clear objID of self and contents (if any)
 
virtual Common::String dumpInfo () const
 dump some info about this object to a string
 
ProcId callUsecode (uint16 classid, uint16 offset, const uint8 *args=0, int argsize=0)
 
bool loadData (Common::ReadStream *rs, uint32 version)
 

Protected Member Functions

void GetItemLocation (int32 lerp_factor) override
 
virtual ContainergetTargetContainer (Item *item, int mx, int my)
 
void getItemCoords (Item *item, int32 &itemx, int32 &itemy)
 
- Protected Member Functions inherited from Ultima::Ultima8::ItemRelativeGump
void saveData (Common::WriteStream *ws) override
 
void MoveOnScreen ()
 Move Gump so that it totally overlaps parent.
 
- Protected Member Functions inherited from Ultima::Ultima8::Gump
virtual void PaintChildren (RenderSurface *surf, int32 lerp_factor, bool scaled)
 Paint the Gumps Children (RenderSurface is relative to this)
 
virtual void PaintComposited (RenderSurface *surf, int32 lerp_factor, int32 scalex, int32 scaley)
 Overloadable method to Paint just this gumps unscaled components that require compositing (RenderSurface is relative to parent).
 

Protected Attributes

Rect _itemArea
 
bool _displayDragging
 
uint32 _draggingShape
 
uint32 _draggingFrame
 
uint32 _draggingFlags
 
int32 _draggingX
 
int32 _draggingY
 
- Protected Attributes inherited from Ultima::Ultima8::ItemRelativeGump
int32 _ix
 
int32 _iy
 
- Protected Attributes inherited from Ultima::Ultima8::Gump
uint16 _owner
 
Gump_parent
 
int32 _x
 
int32 _y
 
Rect _dims
 
uint32 _flags
 
int32 _layer
 
int32 _index
 
const Shape_shape
 
uint32 _frameNum
 
Std::list< Gump * > _children
 
Gump_focusChild
 
uint16 _notifier
 
uint32 _processResult
 
- Protected Attributes inherited from Ultima::Ultima8::Object
ObjId _objId
 

Additional Inherited Members

- Public Types inherited from Ultima::Ultima8::Gump
enum  Position {
  CENTER = 1, TOP_LEFT = 2, TOP_RIGHT = 3, BOTTOM_LEFT = 4,
  BOTTOM_RIGHT = 5, TOP_CENTER = 6, BOTTOM_CENTER = 7, LEFT_CENTER = 8,
  RIGHT_CENTER = 9
}
 
enum  PointRoundDir { ROUND_TOPLEFT = 0, ROUND_BOTTOMRIGHT = 1 }
 
enum  RectRoundDir { ROUND_INSIDE, ROUND_OUTSIDE }
 
enum  GumpFlags {
  FLAG_DRAGGABLE = 0x0001, FLAG_HIDDEN = 0x0002, FLAG_CLOSING = 0x0004, FLAG_CLOSE_AND_DEL = 0x0008,
  FLAG_ITEM_DEPENDENT = 0x0010, FLAG_DONT_SAVE = 0x0020, FLAG_CORE_GUMP = 0x0040, FLAG_KEEP_VISIBLE = 0x0080,
  FLAG_PREVENT_SAVE = 0x0100
}
 
enum  GumpLayers {
  LAYER_DESKTOP = -16, LAYER_GAMEMAP = -8, LAYER_NORMAL = 0, LAYER_ABOVE_NORMAL = 8,
  LAYER_MODAL = 12, LAYER_CONSOLE = 16
}
 
enum  Message { GUMP_CLOSING = 0x100 }
 
- Static Public Member Functions inherited from Ultima::Ultima8::Gump
template<int T>
static bool FindByIndex (const Gump *g)
 A predicate to find a ui element by its index.
 
- Static Protected Member Functions inherited from Ultima::Ultima8::Gump
static int32 ScaleCoord (int32 c, int32 factor)
 
static int32 UnscaleCoord (int32 c, int32 factor)
 

Detailed Description

Base gump class for all containers (backpack, barrel, etc)

Member Function Documentation

◆ Close()

void Ultima::Ultima8::ContainerGump::Close ( bool  no_del = false)
overridevirtual

Close the gump

Parameters
no_delIf true, do not delete after closing

Reimplemented from Ultima::Ultima8::Gump.

Reimplemented in Ultima::Ultima8::PaperdollGump.

◆ InitGump()

void Ultima::Ultima8::ContainerGump::InitGump ( Gump newparent,
bool  take_focus = true 
)
overridevirtual

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

Parameters
newparentThe Gump's new parent or 0.
takefocusIf true, set parent's _focusChild to this

Reimplemented from Ultima::Ultima8::Gump.

Reimplemented in Ultima::Ultima8::PaperdollGump.

◆ GetLocationOfItem()

bool Ultima::Ultima8::ContainerGump::GetLocationOfItem ( uint16  itemid,
int32 &  gx,
int32 &  gy,
int32  lerp_factor = 256 
)
overridevirtual

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

Returns
false on failure

Reimplemented from Ultima::Ultima8::Gump.

Reimplemented in Ultima::Ultima8::PaperdollGump.

◆ StartDraggingItem()

bool Ultima::Ultima8::ContainerGump::StartDraggingItem ( Item item,
int  mx,
int  my 
)
overridevirtual

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 Ultima::Ultima8::Gump.

Reimplemented in Ultima::Ultima8::PaperdollGump.

◆ DraggingItem()

bool Ultima::Ultima8::ContainerGump::DraggingItem ( Item item,
int  mx,
int  my 
)
overridevirtual

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 Ultima::Ultima8::Gump.

Reimplemented in Ultima::Ultima8::PaperdollGump.

◆ StopDraggingItem()

void Ultima::Ultima8::ContainerGump::StopDraggingItem ( Item item,
bool  moved 
)
overridevirtual

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

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

Reimplemented from Ultima::Ultima8::Gump.

◆ DropItem()

void Ultima::Ultima8::ContainerGump::DropItem ( Item item,
int  mx,
int  my 
)
overridevirtual

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 Ultima::Ultima8::Gump.

Reimplemented in Ultima::Ultima8::PaperdollGump.


The documentation for this class was generated from the following file: