sptk2 logo
SPTK Home Page

sptk::CBaseButton Class Reference
[GUI Classes]

Base button widget. More...

#include <CButton.h>

Inheritance diagram for sptk::CBaseButton:

sptk::CLayoutClient sptk::CButton sptk::CSmallButton

List of all members.

Public Member Functions

void defaultButton (bool defaultBtn)
 Makes this button a default button.
bool defaultButton () const
 Returns true if the button is a default button.
virtual std::string className () const
 Returns widget class name (internal SPTK RTTI).
virtual void buttonImage (CButtonKind bkind, CIconSize iconSize)=0
 Sets the stock image to the button. Purely virtual.
virtual void buttonImage (Fl_Image *image)=0
 Sets the image to the button. Purely virtual.
virtual Fl_Image * buttonImage ()=0
 Returns the button's image. Purely virtual.
const char * label () const
 Returns button label.
void label (const char *lbl)
 Sets button label.

Protected Member Functions

void image (CButtonKind buttonKind, CIconSize iconSize, const char *label="")
 Sets the button image to the selected kind buttonKind.
void draw ()
 Draws the button.
void drawFocus (bool usingTheme)
 Draws the focus for the button.
int handle (int event)
 Special handle() method.
virtual bool preferredSize (int &w, int &h)
 Preferred size for the button computes the optimal size for the button.
 CBaseButton (CButtonKind kind, CLayoutAlign layoutAlign=SP_ALIGN_RIGHT, bool is_small=false, const char *label=0, CThemeButtonType tbt=THM_BUTTON_NORMAL)
 Constructor in SPTK style.
 CBaseButton (const char *label=0, CLayoutAlign layoutAlign=SP_ALIGN_RIGHT, CThemeButtonType tbt=THM_BUTTON_NORMAL)
 Constructor in SPTK style. The image should be assigned separately.

Protected Attributes

CButtonKind m_kind
 Button kind (for a stock image) or SP_UNDEFINED_BUTTON for user_defined image.
Fl_Image * m_image
 Internal image pointer.
CIconSize m_iconSize
 Icon size.

Friends

class CThemes


Detailed Description

Base button widget.

Base class for CButton and CSmallButton, uses Fl_Image * or a stock image of CButtonKind.


Constructor & Destructor Documentation

sptk::CBaseButton::CBaseButton ( CButtonKind  kind,
CLayoutAlign  layoutAlign = SP_ALIGN_RIGHT,
bool  is_small = false,
const char *  label = 0,
CThemeButtonType  tbt = THM_BUTTON_NORMAL 
) [protected]

Constructor in SPTK style.

Parameters:
kind CButtonKind, stock image id
layoutAlign CLayoutAlign, widget align in layout
is_small bool, true for the small button (small pixmap, no label)
label const char * label
tbt CThemeButtonType, the type of button

sptk::CBaseButton::CBaseButton ( const char *  label = 0,
CLayoutAlign  layoutAlign = SP_ALIGN_RIGHT,
CThemeButtonType  tbt = THM_BUTTON_NORMAL 
) [protected]

Constructor in SPTK style. The image should be assigned separately.

Parameters:
label const char *, label
layoutAlign CLayoutAlign, widget align in layout
tbt CThemeButtonType, the type of button


Member Function Documentation

virtual Fl_Image* sptk::CBaseButton::buttonImage (  )  [pure virtual]

Returns the button's image. Purely virtual.

Returns:
image pointer

Implemented in sptk::CButton, and sptk::CSmallButton.

virtual void sptk::CBaseButton::buttonImage ( Fl_Image *  image  )  [pure virtual]

Sets the image to the button. Purely virtual.

Parameters:
image Fl_Image * image pointer

Implemented in sptk::CButton, and sptk::CSmallButton.

virtual void sptk::CBaseButton::buttonImage ( CButtonKind  bkind,
CIconSize  iconSize 
) [pure virtual]

Sets the stock image to the button. Purely virtual.

Parameters:
bkind CButtonKind stock image id.
iconSize CIconSize, the size of the icon

Implemented in sptk::CButton, and sptk::CSmallButton.

bool sptk::CBaseButton::defaultButton (  )  const [inline]

Returns true if the button is a default button.

Returns:
button type - default or not

void sptk::CBaseButton::defaultButton ( bool  defaultBtn  ) 

Makes this button a default button.

Is used to define a button as default for the current window of CDialog class. The default button is activated when an Enter button is pressed inside CDialog on the widget and the widget doesn't process Enter button.

Parameters:
defaultBtn bool makes button default or not

void sptk::CBaseButton::drawFocus ( bool  usingTheme  )  [protected]

Draws the focus for the button.

Parameters:
usingTheme bool, to use theme's value for the focus corner radius. Otherwise, radius is 0.

void sptk::CBaseButton::image ( CButtonKind  buttonKind,
CIconSize  iconSize,
const char *  label = "" 
) [protected]

Sets the button image to the selected kind buttonKind.

Parameters:
buttonKind CButtonKind, the button kind
iconSize CIconSize, the size of the icon
label const char*, optional label

void sptk::CBaseButton::label ( const char *  lbl  ) 

Sets button label.

Parameters:
lbl const char *, new button label

Reimplemented from sptk::CLayoutClient.

const char* sptk::CBaseButton::label (  )  const [inline]

Returns button label.

Returns:
button label

Reimplemented from sptk::CLayoutClient.

virtual bool sptk::CBaseButton::preferredSize ( int &  w,
int &  h 
) [protected, virtual]

Preferred size for the button computes the optimal size for the button.

Parameters:
w int&, button width
h int&, button height
Returns:
true if the size is stable (doesn't depend on input sizes)

Reimplemented from sptk::CLayoutClient.


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

Mon Mar 5 11:56:08 2012: SPTK 3.5.7