Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csButton Class Reference

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.

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<. 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.

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.

int 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 Methods

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.

int 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.


Member Function Documentation

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

Set button bitmaps in normal and pressed states<.

p> 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<.

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

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<.

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


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000