CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csButton Class Reference
[Button]

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

#include <csbutton.h>

Inheritance diagram for csButton:

csComponent csCheckBox csRadioButton List of all members.

Public Methods

 csButton (csComponent *iParent, int iCommandCode, int iButtonStyle=CSBS_DEFAULTVALUE, csButtonFrameStyle iFrameStyle=csbfsOblique)
 Create button object. More...

virtual ~csButton ()
 Destroy button object. More...

virtual void SetText (const char *iText)
 Set button text. More...

void SetDrawTextOnHighlightOnly (bool iTOHO)
 Set text draw to highlight only. More...

bool GetDrawTextOnHighlightOnly ()
 Return value of DrawTextOnHighlightOnly. More...

void SetBitmap (csPixmap *iNormal, csPixmap *iPressed, bool iDelete=true)
 Set button bitmaps in normal and pressed states. More...

void SetFrameBitmaps (csPixmap *iNormal, csPixmap *iPressed, csPixmap *iHighlighted, bool iDelete=true)
 Sets the button's frame bitmaps in normal, pressed, and highlighted (mouseover) states. More...

void SetButtonTexture (csPixmap *iNormal, csPixmap *iPressed, bool iDelete=true)
 Sets the button's texture in normal and pressed states. More...

void GetBitmap (csPixmap **iNormal, csPixmap **iPressed)
 Query button bitmaps. More...

void GetFrameBitmaps (csPixmap **iNormal, csPixmap **iPressed, csPixmap **iHighlighted)
 Query button bitmaps. More...

void FreeBitmaps ()
 Delete image bitmaps if iDelete was true on SetBitmap. More...

void FreeFrameBitmaps ()
 Delete frame image bitmaps if iDelete was true on SetBitmap. More...

virtual bool HandleEvent (iEvent &Event)
 Handle external events. More...

virtual bool PostHandleEvent (iEvent &Event)
 Pre-handle keyboard events. More...

virtual void SetState (int mask, bool enable)
 Override SetState method to redraw button if it is default. More...

virtual void SuggestSize (int &w, int &h)
 Return the recommended minimal size of button. More...

void SetCommandCode (int iCommandCode)
 Query this button's command code. More...

int GetCommandCode ()
 Query this button's command code. More...

virtual void SetPressed (bool state)
 Set button pressed state. More...

int GetButtonStyle ()
 Get button style flags. More...

csButtonFrameStyle GetFrameStyle ()
 Get button frame style. More...

int GetUnderlinePos ()
 Get the character number to be underlined (hotkey). More...

uint8 GetAlpha ()
 Get the alpha-ness of the button. More...

void SetAlpha (uint8 iAlpha)
 Set the alpha-ness of the button (only useful with csbfsTextured and csbfsBitmap). More...

void SetTextureOrigin (int iOrgX, int iOrgy)
 Set the origin of the texture. More...

void GetTextureOrigin (int *iOrgx, int *iOrgy)
 Get the texture origins. More...

virtual char * GetSkinName ()
 Get the name of the skip slice for this component. More...


Public Attributes

bool Pressed
 Current button state. More...

bool Highlighted
 Highlight state. More...


Protected Methods

virtual void Press ()
 Emulate a button press (generate command). More...

bool HandleKeyPress (iEvent &Event)
 Handle a key down event (called for HandleEvent and PreHandleEvent). More...

void DeselectNeighbours ()
 Deselect all button's neightbours in his group. More...


Protected Attributes

csPixmapImageNormal
 Button images in normal and pressed state. More...

csPixmapImagePressed
 Button images in normal and pressed state. More...

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

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

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

bool delImages
 Should images be automatically deleted? More...

bool delFrameImages
 Should frame images be automatically deleted? More...

int CommandCode
 Command code emmited when button is pressed. More...

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

int ButtonStyle
 Button style. More...

csButtonFrameStyle FrameStyle
 Button frame style. More...

int TexOrgX
 Origin of the texture. More...

int TexOrgY
 Origin of the texture. More...

uint8 ButtonAlpha
 Alpha-ness of the texture or frame bitmaps. More...

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


Detailed Description

The Button class implements different types of push buttons.

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

Definition at line 137 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 261 of file csbutton.h.

References ButtonAlpha, and uint8.

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

Query button bitmaps.

int csButton::GetButtonStyle   [inline]
 

Get button style flags.

Definition at line 249 of file csbutton.h.

References ButtonStyle.

int csButton::GetCommandCode   [inline]
 

Query this button's command code.

Definition at line 242 of file csbutton.h.

References CommandCode.

bool csButton::GetDrawTextOnHighlightOnly   [inline]
 

Return value of DrawTextOnHighlightOnly.

Definition at line 188 of file csbutton.h.

References DrawTextOnHighlightOnly.

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

Query button bitmaps.

csButtonFrameStyle csButton::GetFrameStyle   [inline]
 

Get button frame style.

Definition at line 253 of file csbutton.h.

References csButtonFrameStyle, and FrameStyle.

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

Get the name of the skip slice for this component.

Reimplemented from csComponent.

Definition at line 274 of file csbutton.h.

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

Get the texture origins.

int csButton::GetUnderlinePos   [inline]
 

Get the character number to be underlined (hotkey).

Definition at line 257 of file csbutton.h.

References underline_pos.

virtual bool csButton::HandleEvent iEvent   Event [virtual]
 

Handle external events.

Reimplemented from csComponent.

Reimplemented in csCheckBox.

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.

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 238 of file csbutton.h.

References CommandCode.

void csButton::SetDrawTextOnHighlightOnly bool    iTOHO [inline]
 

Set text draw to highlight only.

Definition at line 184 of file csbutton.h.

References DrawTextOnHighlightOnly.

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 180 of file csbutton.h.

References csComponent::Invalidate, csComponent::PrepareLabel, csComponent::text, and underline_pos.

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 164 of file csbutton.h.

Referenced by GetAlpha.

int csButton::ButtonStyle [protected]
 

Button style.

Definition at line 158 of file csbutton.h.

Referenced by GetButtonStyle.

int csButton::CommandCode [protected]
 

Command code emmited when button is pressed.

Definition at line 154 of file csbutton.h.

Referenced by GetCommandCode, and SetCommandCode.

bool csButton::delFrameImages [protected]
 

Should frame images be automatically deleted?

Definition at line 152 of file csbutton.h.

bool csButton::delImages [protected]
 

Should images be automatically deleted?

Definition at line 150 of file csbutton.h.

bool csButton::DrawTextOnHighlightOnly [protected]
 

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

Definition at line 166 of file csbutton.h.

Referenced by GetDrawTextOnHighlightOnly, and SetDrawTextOnHighlightOnly.

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 147 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 147 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 147 of file csbutton.h.

csButtonFrameStyle csButton::FrameStyle [protected]
 

Button frame style.

Definition at line 160 of file csbutton.h.

Referenced by GetFrameStyle.

bool csButton::Highlighted
 

Highlight state.

Definition at line 172 of file csbutton.h.

csPixmap* csButton::ImageNormal [protected]
 

Button images in normal and pressed state.

Definition at line 141 of file csbutton.h.

csPixmap * csButton::ImagePressed [protected]
 

Button images in normal and pressed state.

Definition at line 141 of file csbutton.h.

bool csButton::Pressed
 

Current button state.

Definition at line 170 of file csbutton.h.

int csButton::TexOrgX [protected]
 

Origin of the texture.

Definition at line 162 of file csbutton.h.

int csButton::TexOrgY [protected]
 

Origin of the texture.

Definition at line 162 of file csbutton.h.

int csButton::underline_pos [protected]
 

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

Definition at line 156 of file csbutton.h.

Referenced by GetUnderlinePos, and SetText.


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