Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

pawsButton Class Reference

A simple button widget. More...

#include <pawsbutton.h>

List of all members.

Public Member Functions

virtual void Draw ()
 Draws the widget and all of it's children.
virtual void Flash (bool state, FLASH_STATE type=FLASH_REGULAR)
virtual bool GetState ()
const char * GetText ()
virtual bool IsDown ()
virtual bool IsEnabled () const
virtual bool OnKeyDown (utf32_char keyCode, utf32_char key, int modifiers)
 Process keydown messages.
virtual bool OnMouseDown (int button, int modifiers, int x, int y)
 Manage mouse down event to test for and apply window changes.
virtual bool OnMouseEnter ()
 Called whenever the mouse enters this widget.
virtual bool OnMouseExit ()
 Called whenever the mouse leaves this widget.
virtual bool OnMouseUp (int button, int modifiers, int x, int y)
 Manage mouse up event.
 pawsButton (const pawsButton &pb)
 pawsButton ()
bool SelfPopulate (iDocumentNode *node)
 This function allows a widget to fill in its own contents from an xml node supplied and calls the same function for all children.
void SetDownImage (const csString &image)
virtual void SetEnabled (bool enabled)
void SetGreyDownImage (const csString &greyDownImage)
void SetGreyUpImage (const csString &greyUpImage)
virtual void SetNotify (pawsWidget *widget)
void SetOnSpecialImage (const csString &image)
void SetSound (const char *sound)
virtual void SetState (bool isDown, bool publish=true)
void SetText (const char *text)
virtual void SetToggle (bool t)
 Set the toggle attribute. To change toggle state use SetState.
virtual bool Setup (iDocumentNode *node)
 Setup this widget.
void SetUpImage (const csString &image)
virtual ~pawsButton ()

Protected Member Functions

virtual bool CheckKeyHandled (int keyCode)
 Allow pawsButton to simulate button pushes based on keypresses.

Protected Attributes

csString buttonLabel
 Text shown in button.
bool changeOnMouseOver
 Whether or not to change image on mouse enter/exit.
bool down
 Track to see if the button is down.
int downTextOffsetX
int downTextOffsetY
bool enabled
int flash
 The state if the button is flashing, 0 is no flashing.
FLASH_STATE flashtype
 Type of flash (regular/special)
csRef< iPawsImagegreyDownImage
csRef< iPawsImagegreyUpImage
char keybinding
 Keyboard equivalent of clicking on this button.
pawsWidgetnotify
 Widget to which event notifications are sent. If NULL, notifications go to parent.
int originalFontColour
 Used when restoring from highlight state.
csRef< iPawsImagepressedImage
 Image to draw when button is pressed or when the mouse enters.
csRef< iPawsImagereleasedImage
 Image to draw when button is released or when the mouse exits.
csString sound_click
 Button can trigger sound effects with this.
csRef< iPawsImagespecialFlashImage
 Image to draw when button is released.
int style
 Style -- right now only ShadowText supported.
bool toggle
 Check to see if this is a toggle button.
int upTextOffsetX
int upTextOffsetY

Detailed Description

A simple button widget.

Definition at line 43 of file pawsbutton.h.


Constructor & Destructor Documentation

pawsButton::pawsButton ( )
pawsButton::pawsButton ( const pawsButton pb)
virtual pawsButton::~pawsButton ( ) [virtual]

Member Function Documentation

virtual bool pawsButton::CheckKeyHandled ( int  ) [protected, virtual]

Allow pawsButton to simulate button pushes based on keypresses.

Return true if key is handled.

Reimplemented from pawsWidget.

Reimplemented in pawsDnDButton.

virtual void pawsButton::Draw ( ) [virtual]

Draws the widget and all of it's children.

Remarks:
Uses clipping rect of it's parent to define drawing area. If the drawing area defined is empty it returns.

Reimplemented from pawsWidget.

Reimplemented in pawsDnDButton.

virtual void pawsButton::Flash ( bool  state,
FLASH_STATE  type = FLASH_REGULAR 
) [inline, virtual]

Definition at line 96 of file pawsbutton.h.

virtual bool pawsButton::GetState ( ) [inline, virtual]

Reimplemented in pawsRadioButton.

Definition at line 76 of file pawsbutton.h.

const char* pawsButton::GetText ( ) [inline]

Definition at line 90 of file pawsbutton.h.

virtual bool pawsButton::IsDown ( ) [inline, virtual]

Definition at line 71 of file pawsbutton.h.

virtual bool pawsButton::IsEnabled ( ) const [virtual]
virtual bool pawsButton::OnKeyDown ( utf32_char  keyCode,
utf32_char  keyChar,
int  modifiers 
) [virtual]

Process keydown messages.

Parameters:
keyCodeThe code for the pressed key.
keyCharThe key pressed.
modifiersUsed to modify tab behavior.
Returns:
bool TRUE for success FALSE if no action.
Remarks:
If you override this, be sure to also override GetFocusOverridesControls() as returning true

Reimplemented from pawsWidget.

virtual bool pawsButton::OnMouseDown ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse down event to test for and apply window changes.

Parameters:
buttonType of button: 1 resizable or movable, 2 context menu or config window.
modifiersUsed with PAWS_CONSTRUCTION.
xUsed to test for resize.
yUsed to test for resize.
Returns:
bool TRUE if movable or resizable.
Remarks:
calls OnMouseDown on it's parent.

Reimplemented from pawsWidget.

Reimplemented in pawsDnDButton.

virtual bool pawsButton::OnMouseEnter ( ) [virtual]

Called whenever the mouse enters this widget.

Returns:
bool Parent's result or TRUE if no parent.
Remarks:
Acts recursively on it's parents.

Reimplemented from pawsWidget.

virtual bool pawsButton::OnMouseExit ( ) [virtual]

Called whenever the mouse leaves this widget.

Returns:
bool Parent's result or TRUE if no parent.

Reimplemented from pawsWidget.

virtual bool pawsButton::OnMouseUp ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse up event.

Returns:
bool Parent's result or FALSE if no parent.
Remarks:
Acts recursively on it's parents.

Reimplemented from pawsWidget.

Reimplemented in pawsDnDButton.

bool pawsButton::SelfPopulate ( iDocumentNode *  node) [virtual]

This function allows a widget to fill in its own contents from an xml node supplied and calls the same function for all children.

Parameters:
nodeThe xml data for the widget.
Returns:
bool TRUE if no children, FALSE if there are problems with a node.
Remarks:
User should overload this function to populate different types of widgets. Call this base class function to populate children. This is NOT the same as Setup(), which is defining height, width, styles, etc. This is data.

Reimplemented from pawsWidget.

Reimplemented in pawsDnDButton.

void pawsButton::SetDownImage ( const csString &  image)
virtual void pawsButton::SetEnabled ( bool  enabled) [virtual]
void pawsButton::SetGreyDownImage ( const csString &  greyDownImage)
void pawsButton::SetGreyUpImage ( const csString &  greyUpImage)
virtual void pawsButton::SetNotify ( pawsWidget widget) [virtual]
void pawsButton::SetOnSpecialImage ( const csString &  image)
void pawsButton::SetSound ( const char *  sound)
virtual void pawsButton::SetState ( bool  isDown,
bool  publish = true 
) [virtual]
void pawsButton::SetText ( const char *  text)
virtual void pawsButton::SetToggle ( bool  t) [inline, virtual]

Set the toggle attribute. To change toggle state use SetState.

Definition at line 81 of file pawsbutton.h.

virtual bool pawsButton::Setup ( iDocumentNode *  ) [virtual]

Setup this widget.

Reimplemented from pawsWidget.

Reimplemented in pawsDnDButton, and pawsRadioButton.

void pawsButton::SetUpImage ( const csString &  image)

Member Data Documentation

csString pawsButton::buttonLabel [protected]

Text shown in button.

Definition at line 135 of file pawsbutton.h.

Whether or not to change image on mouse enter/exit.

Definition at line 165 of file pawsbutton.h.

bool pawsButton::down [protected]

Track to see if the button is down.

Definition at line 117 of file pawsbutton.h.

Definition at line 158 of file pawsbutton.h.

Definition at line 159 of file pawsbutton.h.

bool pawsButton::enabled [protected]

Definition at line 146 of file pawsbutton.h.

int pawsButton::flash [protected]

The state if the button is flashing, 0 is no flashing.

Definition at line 149 of file pawsbutton.h.

Type of flash (regular/special)

Definition at line 152 of file pawsbutton.h.

Definition at line 126 of file pawsbutton.h.

csRef<iPawsImage> pawsButton::greyUpImage [protected]

Definition at line 125 of file pawsbutton.h.

char pawsButton::keybinding [protected]

Keyboard equivalent of clicking on this button.

Definition at line 138 of file pawsbutton.h.

Widget to which event notifications are sent. If NULL, notifications go to parent.

Definition at line 141 of file pawsbutton.h.

Used when restoring from highlight state.

Definition at line 162 of file pawsbutton.h.

Image to draw when button is pressed or when the mouse enters.

Definition at line 120 of file pawsbutton.h.

Image to draw when button is released or when the mouse exits.

Definition at line 123 of file pawsbutton.h.

csString pawsButton::sound_click [protected]

Button can trigger sound effects with this.

Definition at line 155 of file pawsbutton.h.

Image to draw when button is released.

Definition at line 129 of file pawsbutton.h.

int pawsButton::style [protected]

Style -- right now only ShadowText supported.

Definition at line 144 of file pawsbutton.h.

bool pawsButton::toggle [protected]

Check to see if this is a toggle button.

Definition at line 132 of file pawsbutton.h.

Definition at line 156 of file pawsbutton.h.

Definition at line 157 of file pawsbutton.h.


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