CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csButton Class Reference
[Button]

The Button class implements different types of push buttons. More...

#include <csws/csbutton.h>

Inheritance diagram for csButton:

csComponent csCheckBox csRadioButton List of all members.

Public Member Functions

 csButton (csComponent *iParent, int iCommandCode, int iButtonStyle=CSBS_DEFAULTVALUE, csButtonFrameStyle iFrameStyle=csbfsOblique)
 Create button object.
virtual ~csButton ()
 Destroy button object.
virtual void SetText (const char *iText)
 Set button text.
void SetDrawTextOnHighlightOnly (bool iTOHO)
 Set text draw to highlight only.
bool GetDrawTextOnHighlightOnly ()
 Return value of DrawTextOnHighlightOnly.
void SetBitmap (csPixmap *iNormal, csPixmap *iPressed, bool iDelete=true)
 Set button bitmaps in normal and pressed states.
void SetFrameBitmaps (csPixmap *iNormal, csPixmap *iPressed, csPixmap *iHighlighted, bool iDelete=true)
 Sets the button's frame bitmaps in normal, pressed, and highlighted (mouseover) states.
void SetButtonTexture (csPixmap *iNormal, csPixmap *iPressed, bool iDelete=true)
 Sets the button's texture in normal and pressed states.
void GetBitmap (csPixmap **iNormal, csPixmap **iPressed)
 Query button bitmaps.
void GetFrameBitmaps (csPixmap **iNormal, csPixmap **iPressed, csPixmap **iHighlighted)
 Query button bitmaps.
void FreeBitmaps ()
 Delete image bitmaps if iDelete was true on SetBitmap.
void FreeFrameBitmaps ()
 Delete frame image bitmaps if iDelete was true on SetBitmap.
virtual bool HandleEvent (iEvent &Event)
 Handle external events.
virtual bool PostHandleEvent (iEvent &Event)
 Pre-handle keyboard events.
virtual void SetState (int mask, bool enable)
 Override SetState method to redraw button if it is default.
virtual void SuggestSize (int &w, int &h)
 Return the recommended minimal size of button.
void SetCommandCode (int iCommandCode)
 Query this button's command code.
int GetCommandCode ()
 Query this button's command code.
virtual void SetPressed (bool state)
 Set button pressed state.
int GetButtonStyle ()
 Get button style flags.
csButtonFrameStyle GetFrameStyle ()
 Get button frame style.
size_t GetUnderlinePos ()
 Get the character number to be underlined (hotkey).
uint8 GetAlpha ()
 Get the alpha-ness of the button.
void SetAlpha (uint8 iAlpha)
 Set the alpha-ness of the button (only useful with csbfsTextured and csbfsBitmap).
void SetTextureOrigin (int iOrgX, int iOrgy)
 Set the origin of the texture.
void GetTextureOrigin (int *iOrgx, int *iOrgy)
 Get the texture origins.
virtual char * GetSkinName ()
 Get the name of the skip slice for this component.

Public Attributes

bool Pressed
 Current button state.
bool Highlighted
 Highlight state.

Protected Member Functions

virtual void Press ()
 Emulate a button press (generate command).
bool HandleKeyPress (iEvent &Event)
 Handle a key down event (called for HandleEvent and PreHandleEvent).
void DeselectNeighbours ()
 Deselect all button's neightbours in his group.

Protected Attributes

csPixmapImageNormal
 Button images in normal and pressed state.
csPixmapImagePressed
 Button images in normal and pressed state.
csPixmapFrameNormal
 Images for button's frame in normal, pressed, and mouseover state also used for textures if mode is csbfsTextured.
csPixmapFramePressed
 Images for button's frame in normal, pressed, and mouseover state also used for textures if mode is csbfsTextured.
csPixmapFrameHighlighted
 Images for button's frame in normal, pressed, and mouseover state also used for textures if mode is csbfsTextured.
bool delImages
 Should images be automatically deleted?
bool delFrameImages
 Should frame images be automatically deleted?
int CommandCode
 Command code emmited when button is pressed.
size_t underline_pos
 Character number that should be underlined (-1 == none).
int ButtonStyle
 Button style.
csButtonFrameStyle FrameStyle
 Button frame style.
int TexOrgX
 Origin of the texture.
int TexOrgY
 Origin of the texture.
uint8 ButtonAlpha
 Alpha-ness of the texture or frame bitmaps.
bool DrawTextOnHighlightOnly
 True if button text is only displayed when it has the focus.

Detailed Description

The Button class implements different types of push buttons.

Buttons can contain a text string and/or a bitmap.

Definition at line 139 of file csbutton.h.


Constructor & Destructor Documentation

csButton::csButton csComponent iParent,
int  iCommandCode,
int  iButtonStyle = CSBS_DEFAULTVALUE,
csButtonFrameStyle  iFrameStyle = csbfsOblique
 

Create button object.

virtual csButton::~csButton  )  [virtual]
 

Destroy button object.


Member Function Documentation

void csButton::DeselectNeighbours  )  [protected]
 

Deselect all button's neightbours in his group.

void csButton::FreeBitmaps  ) 
 

Delete image bitmaps if iDelete was true on SetBitmap.

void csButton::FreeFrameBitmaps  ) 
 

Delete frame image bitmaps if iDelete was true on SetBitmap.

uint8 csButton::GetAlpha  )  [inline]
 

Get the alpha-ness of the button.

Definition at line 263 of file csbutton.h.

void csButton::GetBitmap csPixmap **  iNormal,
csPixmap **  iPressed
 

Query button bitmaps.

int csButton::GetButtonStyle  )  [inline]
 

Get button style flags.

Definition at line 251 of file csbutton.h.

int csButton::GetCommandCode  )  [inline]
 

Query this button's command code.

Definition at line 244 of file csbutton.h.

bool csButton::GetDrawTextOnHighlightOnly  )  [inline]
 

Return value of DrawTextOnHighlightOnly.

Definition at line 190 of file csbutton.h.

void csButton::GetFrameBitmaps csPixmap **  iNormal,
csPixmap **  iPressed,
csPixmap **  iHighlighted
 

Query button bitmaps.

csButtonFrameStyle csButton::GetFrameStyle  )  [inline]
 

Get button frame style.

Definition at line 255 of file csbutton.h.

References csButtonFrameStyle.

virtual char* csButton::GetSkinName  )  [inline, virtual]
 

Get the name of the skip slice for this component.

Reimplemented from csComponent.

Definition at line 276 of file csbutton.h.

void csButton::GetTextureOrigin int *  iOrgx,
int *  iOrgy
 

Get the texture origins.

size_t csButton::GetUnderlinePos  )  [inline]
 

Get the character number to be underlined (hotkey).

Definition at line 259 of file csbutton.h.

virtual bool csButton::HandleEvent iEvent Event  )  [virtual]
 

Handle external events.

Reimplemented from csComponent.

Reimplemented in csCheckBox, and csRadioButton.

bool csButton::HandleKeyPress iEvent Event  )  [protected]
 

Handle a key down event (called for HandleEvent and PreHandleEvent).

virtual bool csButton::PostHandleEvent iEvent Event  )  [virtual]
 

Pre-handle keyboard events.

Reimplemented from csComponent.

virtual void csButton::Press  )  [protected, virtual]
 

Emulate a button press (generate command).

Reimplemented in csCheckBox, and csRadioButton.

void csButton::SetAlpha uint8  iAlpha  ) 
 

Set the alpha-ness of the button (only useful with csbfsTextured and csbfsBitmap).

void csButton::SetBitmap csPixmap iNormal,
csPixmap iPressed,
bool  iDelete = true
 

Set button bitmaps in normal and pressed states.

If iDelete is true, bitmaps will be automatically deleted when they are no longer needed (i.e. button disposal or another SetBitmap)

void csButton::SetButtonTexture csPixmap iNormal,
csPixmap iPressed,
bool  iDelete = true
 

Sets the button's texture in normal and pressed states.

If iDelete is true, bitmaps will be automatically deleted when they are no longer needed (i.e. button disposal or another SetButtonBitmaps)

void csButton::SetCommandCode int  iCommandCode  )  [inline]
 

Query this button's command code.

Definition at line 240 of file csbutton.h.

void csButton::SetDrawTextOnHighlightOnly bool  iTOHO  )  [inline]
 

Set text draw to highlight only.

Definition at line 186 of file csbutton.h.

void csButton::SetFrameBitmaps csPixmap iNormal,
csPixmap iPressed,
csPixmap iHighlighted,
bool  iDelete = true
 

Sets the button's frame bitmaps in normal, pressed, and highlighted (mouseover) states.

If iDelete is true, bitmaps will be automatically deleted when they are no longer needed (i.e. button disposal or another SetButtonBitmaps)

virtual void csButton::SetPressed bool  state  )  [virtual]
 

Set button pressed state.

virtual void csButton::SetState int  mask,
bool  enable
[virtual]
 

Override SetState method to redraw button if it is default.

Reimplemented from csComponent.

virtual void csButton::SetText const char *  iText  )  [inline, virtual]
 

Set button text.

Reimplemented from csComponent.

Definition at line 182 of file csbutton.h.

References csComponent::Invalidate(), and csComponent::PrepareLabel().

void csButton::SetTextureOrigin int  iOrgX,
int  iOrgy
 

Set the origin of the texture.

virtual void csButton::SuggestSize int &  w,
int &  h
[virtual]
 

Return the recommended minimal size of button.

Reimplemented from csComponent.


Member Data Documentation

uint8 csButton::ButtonAlpha [protected]
 

Alpha-ness of the texture or frame bitmaps.

Definition at line 166 of file csbutton.h.

int csButton::ButtonStyle [protected]
 

Button style.

Definition at line 160 of file csbutton.h.

int csButton::CommandCode [protected]
 

Command code emmited when button is pressed.

Definition at line 156 of file csbutton.h.

bool csButton::delFrameImages [protected]
 

Should frame images be automatically deleted?

Definition at line 154 of file csbutton.h.

bool csButton::delImages [protected]
 

Should images be automatically deleted?

Definition at line 152 of file csbutton.h.

bool csButton::DrawTextOnHighlightOnly [protected]
 

True if button text is only displayed when it has the focus.

Definition at line 168 of file csbutton.h.

csPixmap * csButton::FrameHighlighted [protected]
 

Images for button's frame in normal, pressed, and mouseover state also used for textures if mode is csbfsTextured.

Definition at line 149 of file csbutton.h.

csPixmap* csButton::FrameNormal [protected]
 

Images for button's frame in normal, pressed, and mouseover state also used for textures if mode is csbfsTextured.

Definition at line 149 of file csbutton.h.

csPixmap * csButton::FramePressed [protected]
 

Images for button's frame in normal, pressed, and mouseover state also used for textures if mode is csbfsTextured.

Definition at line 149 of file csbutton.h.

csButtonFrameStyle csButton::FrameStyle [protected]
 

Button frame style.

Definition at line 162 of file csbutton.h.

bool csButton::Highlighted
 

Highlight state.

Definition at line 174 of file csbutton.h.

csPixmap* csButton::ImageNormal [protected]
 

Button images in normal and pressed state.

Definition at line 143 of file csbutton.h.

csPixmap * csButton::ImagePressed [protected]
 

Button images in normal and pressed state.

Definition at line 143 of file csbutton.h.

bool csButton::Pressed
 

Current button state.

Definition at line 172 of file csbutton.h.

int csButton::TexOrgX [protected]
 

Origin of the texture.

Definition at line 164 of file csbutton.h.

int csButton::TexOrgY [protected]
 

Origin of the texture.

Definition at line 164 of file csbutton.h.

size_t csButton::underline_pos [protected]
 

Character number that should be underlined (-1 == none).

Definition at line 158 of file csbutton.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1