ButtonWidget Class Reference

#include <ButtonWidget.h>

Inheritance diagram for ButtonWidget:

Gump Object List of all members.

Public Types

 BUTTON_CLICK = 0
 BUTTON_UP = 1
 BUTTON_DOUBLE = 2
enum  Message { BUTTON_CLICK = 0, BUTTON_UP = 1, BUTTON_DOUBLE = 2 }

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 ButtonWidget ()
 ButtonWidget (int X, int Y, std::string txt, bool gamefont, int font, uint32 mouseOverBlendCol=0, int width=0, int height=0, sint32 layer=LAYER_NORMAL)
 ButtonWidget (int X, int Y, FrameID frame_up, FrameID frame_down, bool mouseOver=false, sint32 layer=LAYER_NORMAL)
virtual ~ButtonWidget (void)
virtual void InitGump (Gump *newparent, bool take_focus=true)
virtual uint16 TraceObjId (int mx, int my)
virtual bool PointOnGump (int mx, int my)
virtual GumpOnMouseDown (int button, int mx, int my)
virtual void OnMouseUp (int button, int mx, int my)
virtual void OnMouseClick (int button, int mx, int my)
virtual void OnMouseDouble (int button, int mx, int my)
virtual void OnMouseOver ()
virtual void OnMouseLeft ()
int getVlead ()
bool loadData (IDataSource *ids, uint32 version)

Protected Member Functions

virtual void saveData (ODataSource *ods)

Protected Attributes

Shapeshape_up
uint32 framenum_up
Shapeshape_down
uint32 framenum_down
uint16 textwidget
uint32 mouseOverBlendCol
bool mouseOver
int origw
int origh

Detailed Description

Definition at line 25 of file ButtonWidget.h.


Member Enumeration Documentation

enum ButtonWidget::Message

Enumerator:
BUTTON_CLICK 
BUTTON_UP 
BUTTON_DOUBLE 

Definition at line 57 of file ButtonWidget.h.


Constructor & Destructor Documentation

ButtonWidget::ButtonWidget (  ) 

Definition at line 35 of file ButtonWidget.cpp.

ButtonWidget::ButtonWidget ( int  X,
int  Y,
std::string  txt,
bool  gamefont,
int  font,
uint32  mouseOverBlendCol = 0,
int  width = 0,
int  height = 0,
sint32  layer = LAYER_NORMAL 
)

Definition at line 40 of file ButtonWidget.cpp.

References Object::getObjId(), mouseOver, mouseOverBlendCol, and textwidget.

ButtonWidget::ButtonWidget ( int  X,
int  Y,
FrameID  frame_up,
FrameID  frame_down,
bool  mouseOver = false,
sint32  layer = LAYER_NORMAL 
)

Definition at line 52 of file ButtonWidget.cpp.

References FrameID::framenum, framenum_down, framenum_up, GameData::get_instance(), GameData::getShape(), shape_down, and shape_up.

ButtonWidget::~ButtonWidget ( void   )  [virtual]

Definition at line 63 of file ButtonWidget.cpp.


Member Function Documentation

ButtonWidget::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from Gump.

int ButtonWidget::getVlead (  ) 

return the textwidget's vlead, or 0 for an image button

Definition at line 91 of file ButtonWidget.cpp.

References getGump(), and textwidget.

Referenced by AskGump::InitGump().

void ButtonWidget::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 Gump.

Definition at line 67 of file ButtonWidget.cpp.

References Gump::dims, Gump::framenum, framenum_up, Gump::GetDims(), Shape::getFrame(), getGump(), Pentagram::Rect::h, ShapeFrame::height, Gump::InitGump(), Gump::Move(), Gump::shape, shape_down, shape_up, textwidget, Pentagram::Rect::w, ShapeFrame::width, and Pentagram::Rect::y.

Referenced by AskGump::InitGump().

bool ButtonWidget::loadData ( IDataSource ids,
uint32  version 
)

Reimplemented from Gump.

Definition at line 240 of file ButtonWidget.cpp.

References Gump::dims, framenum_down, framenum_up, GameData::get_instance(), Gump::GetDims(), getGump(), ShapeArchive::getShape(), GameData::getShapeFlex(), Gump::loadData(), mouseOver, mouseOverBlendCol, Gump::Move(), shape_down, shape_up, shapenum, textwidget, and Pentagram::Rect::y.

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

Reimplemented from Gump.

Definition at line 153 of file ButtonWidget.cpp.

References BUTTON_CLICK, Gump::ChildNotify(), Gump::parent, and PointOnGump().

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

Reimplemented from Gump.

Definition at line 160 of file ButtonWidget.cpp.

References BUTTON_DOUBLE, Gump::ChildNotify(), and Gump::parent.

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

Reimplemented from Gump.

Definition at line 117 of file ButtonWidget.cpp.

References BUTTON_LEFT, Gump::framenum, framenum_down, mouseOver, Gump::OnMouseDown(), Gump::shape, and shape_down.

void ButtonWidget::OnMouseLeft (  )  [virtual]

Reimplemented from Gump.

Definition at line 180 of file ButtonWidget.cpp.

References Gump::framenum, framenum_up, getGump(), mouseOver, Gump::shape, shape_up, and textwidget.

void ButtonWidget::OnMouseOver (  )  [virtual]

Reimplemented from Gump.

Definition at line 165 of file ButtonWidget.cpp.

References Gump::framenum, framenum_down, getGump(), mouseOver, mouseOverBlendCol, Gump::shape, shape_down, and textwidget.

void ButtonWidget::OnMouseUp ( int  button,
int  mx,
int  my 
) [virtual]

Reimplemented from Gump.

Definition at line 142 of file ButtonWidget.cpp.

References BUTTON_LEFT, BUTTON_UP, Gump::ChildNotify(), Gump::framenum, framenum_up, mouseOver, Gump::parent, Gump::shape, and shape_up.

bool ButtonWidget::PointOnGump ( int  mx,
int  my 
) [virtual]

Detect if a point is on the gump.

Reimplemented from Gump.

Definition at line 103 of file ButtonWidget.cpp.

References Gump::dims, Pentagram::Rect::InRect(), and Gump::ParentToGump().

Referenced by OnMouseClick(), and TraceObjId().

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

save the actual Object data

Reimplemented from Gump.

Definition at line 195 of file ButtonWidget.cpp.

References Gump::dims, framenum_down, framenum_up, Shape::getShapeId(), Pentagram::Rect::h, mouseOver, mouseOverBlendCol, origh, origw, Gump::saveData(), shape_down, shape_up, shapenum, textwidget, Pentagram::Rect::w, ODataSource::write1(), ODataSource::write2(), and ODataSource::write4().

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

Trace a click, and return ObjId.

Reimplemented from Gump.

Definition at line 133 of file ButtonWidget.cpp.

References Object::getObjId(), and PointOnGump().


Member Data Documentation

uint32 ButtonWidget::framenum_down [protected]

Definition at line 68 of file ButtonWidget.h.

Referenced by ButtonWidget(), loadData(), OnMouseDown(), OnMouseOver(), and saveData().

uint32 ButtonWidget::framenum_up [protected]

Definition at line 66 of file ButtonWidget.h.

Referenced by ButtonWidget(), InitGump(), loadData(), OnMouseLeft(), OnMouseUp(), and saveData().

bool ButtonWidget::mouseOver [protected]

Definition at line 71 of file ButtonWidget.h.

Referenced by ButtonWidget(), loadData(), OnMouseDown(), OnMouseLeft(), OnMouseOver(), OnMouseUp(), and saveData().

uint32 ButtonWidget::mouseOverBlendCol [protected]

Definition at line 70 of file ButtonWidget.h.

Referenced by ButtonWidget(), loadData(), OnMouseOver(), and saveData().

int ButtonWidget::origh [protected]

Definition at line 72 of file ButtonWidget.h.

Referenced by saveData().

int ButtonWidget::origw [protected]

Definition at line 72 of file ButtonWidget.h.

Referenced by saveData().

Shape* ButtonWidget::shape_down [protected]

Definition at line 67 of file ButtonWidget.h.

Referenced by ButtonWidget(), InitGump(), loadData(), OnMouseDown(), OnMouseOver(), and saveData().

Shape* ButtonWidget::shape_up [protected]

Definition at line 65 of file ButtonWidget.h.

Referenced by ButtonWidget(), InitGump(), loadData(), OnMouseLeft(), OnMouseUp(), and saveData().

uint16 ButtonWidget::textwidget [protected]

Definition at line 69 of file ButtonWidget.h.

Referenced by ButtonWidget(), getVlead(), InitGump(), loadData(), OnMouseLeft(), OnMouseOver(), and saveData().


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