GTK+ IOStream  Beta
<< GTK+ >> add C++ IOStream operators to GTK+. Now with extra abilities ... like network serialisation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
Buttons Class Reference

Class to setup buttons whic are either text, image or toggle types. Buttons are defined in terms of their callbacks functions and data as well as their type (image, text or toggle) You stream in any new buttons you want to create, for example : More...

#include <Buttons.H>

Inheritance diagram for Buttons:
Inheritance graph
[legend]
Collaboration diagram for Buttons:
Collaboration graph
[legend]

Public Member Functions

 Buttons (void)
 Constructor. More...
 
void setAlignment (float xAlign, float yAlign)
 
void getAlignment (float *xAlign, float *yAlign)
 
void signalConnectAfter (labelFuncData nf)
 Destructor. More...
 
void signalReplace (labelFuncData nfOld, labelFuncData nfNew)
 disconnect the old callback and reconnect a new callback More...
 
void signalRemove (labelFuncData nfOld)
 disconnect the old callback and reconnect a new callback More...
 
Buttonsoperator<< (labelFuncData nf)
 generate a label button More...
 
Buttonsoperator<< (const pixmapFuncData nf)
 generate a button with a static pixmap More...
 
Buttonsoperator<< (toggleFuncData nf)
 generate a toggle button with label More...
 
Buttonsoperator<< (const pixmapFuncDataTransparent pfdt)
 generate a button with a pixmap which is partially transparent More...
 
Buttonsoperator<< (arrowFuncData af)
 generate an arrow button If the arrow widget is supplied in the arrowFuncData class, then it will be used instead of generating a new one. See arroFuncData for the various class member variables which are used in this method. More...
 
Buttonsoperator<< (radioFuncData nf)
 generate a radio button with label If other radio buttons are present, then they are all added to the same group More...
 
void setLabelsFont (PangoFontDescription *pangoFontDescription)
 
int findIndex (GtkWidget *widget)
 
GtkWidget * findWidget (int index)
 

Static Public Member Functions

static gboolean exposePixmap (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 overlay the pixmap image onto the button whenever required This method allows transparent XPMs to be displayed on buttons. Whenever the background is changed, the transparent pixmap is re-drawn More...
 

Additional Inherited Members

Detailed Description

Class to setup buttons whic are either text, image or toggle types. Buttons are defined in terms of their callbacks functions and data as well as their type (image, text or toggle) You stream in any new buttons you want to create, for example :

Buttons buttons << BUTTONLABELSTRUCT {"display text", callbackFunc, (void *)dataVariable};

This will create a button with the display text, when pressed, the callbackFunc will be called with the dataVariable as a variable. You can add buttons to your window like so :

// create 2 buttons
Buttons buttons << BUTTONLABELSTRUCT {"button1", callbackFunc1, (void *)dataVariable1} << BUTTONLABELSTRUCT {"button2", callbackFunc2, (void *)dataVariable2};
HBox box; // A horizontal box to show the buttons in
for (int i=0;i<buttons.getCount();i++) // add the buttons to the box
box << buttons.next();
box.show(); // make sure the box is not hidden

Definition at line 148 of file Buttons.H.

Constructor & Destructor Documentation

Buttons::Buttons ( void  )
inline

Constructor.

Definition at line 153 of file Buttons.H.

Member Function Documentation

static gboolean Buttons::exposePixmap ( GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  data 
)
inlinestatic

overlay the pixmap image onto the button whenever required This method allows transparent XPMs to be displayed on buttons. Whenever the background is changed, the transparent pixmap is re-drawn

widget The button to re-draw event the event (we are looking for an expose event) data The XPM pointer (char**) to use for display

Returns
false to keep propagating the event

Definition at line 320 of file Buttons.H.

Here is the caller graph for this function:

int Buttons::findIndex ( GtkWidget *  widget)
inline
Find the GTK widget index (from 1) in the list of buttons
Parameters
widgetThe widget to look for
Returns
0 if it isn't on the list, the index (from 1) otherwise

Definition at line 364 of file Buttons.H.

Here is the call graph for this function:

GtkWidget* Buttons::findWidget ( int  index)
inline
Get the widget at index (starting from 1)
Parameters
indexthe widget at this index to grab (starting from 1)
Returns
The widget at index, or NULL on error

Definition at line 385 of file Buttons.H.

Here is the call graph for this function:

void Buttons::getAlignment ( float xAlign,
float yAlign 
)
inline
Get the alignment within the button.

Operates on the GtkWidget* which is LinkList::current - i.e. currently pointed to Fills the pointers to the floats with the alignment settings.

Parameters
xAlignthe x-alignment 0.0 is a left alignment, 1.0 is for right alignment
yAlignthe y-alignment 0.0 is a left alignment, 1.0 is for right alignment

Definition at line 173 of file Buttons.H.

Here is the call graph for this function:

Buttons& Buttons::operator<< ( labelFuncData  nf)
inline

generate a label button

Parameters
labelFuncDataThe label, callback function and data to show.
Returns
This Buttons class for further overloading

Definition at line 219 of file Buttons.H.

Here is the call graph for this function:

Buttons& Buttons::operator<< ( const pixmapFuncData  nf)
inline

generate a button with a static pixmap

Parameters
pixmapFuncDataThe pixmap, callback function and data to show.
Returns
This Buttons class for further overloading

Definition at line 235 of file Buttons.H.

Here is the call graph for this function:

Buttons& Buttons::operator<< ( toggleFuncData  nf)
inline

generate a toggle button with label

Parameters
toggleFuncDataThe label, callback function and data to show.
Returns
This Buttons class for further overloading

Definition at line 255 of file Buttons.H.

Here is the call graph for this function:

Buttons& Buttons::operator<< ( const pixmapFuncDataTransparent  pfdt)
inline

generate a button with a pixmap which is partially transparent

Parameters
pixmapFuncDataTransparentThe pixmap, callback function and data to show.
Returns
This Buttons class for further overloading

Definition at line 267 of file Buttons.H.

Here is the call graph for this function:

Buttons& Buttons::operator<< ( arrowFuncData  af)
inline

generate an arrow button If the arrow widget is supplied in the arrowFuncData class, then it will be used instead of generating a new one. See arroFuncData for the various class member variables which are used in this method.

Parameters
arrowFuncDataThe callback function, data, arrow type, shadow type and possibly a pre-existing arrow to use/show. If the pre-existing arrow is to be used, then the arrowFuncData.whichArrow and arrowFuncData.whichShdow variables are ignored.
Returns
This Buttons class for further overloading

Definition at line 284 of file Buttons.H.

Here is the call graph for this function:

Buttons& Buttons::operator<< ( radioFuncData  nf)
inline

generate a radio button with label If other radio buttons are present, then they are all added to the same group

Parameters
radioFuncDataThe label, callback function and data to show.
Returns
This Buttons class for further overloading

Definition at line 301 of file Buttons.H.

Here is the call graph for this function:

void Buttons::setAlignment ( float  xAlign,
float  yAlign 
)
inline
Set the alignment within the button.

Operates on the GtkWidget* which is LinkList::current - i.e. currently pointed to

Parameters
xAlignthe x-alignment 0.0 is a left alignment, 1.0 is for right alignment
yAlignthe y-alignment 0.0 is a left alignment, 1.0 is for right alignment

Definition at line 162 of file Buttons.H.

Here is the call graph for this function:

void Buttons::setLabelsFont ( PangoFontDescription *  pangoFontDescription)
inline
Set the current botton's label's font

For example :

#include "Pango.H"
Font font("bold"); // could be something else, like "Sans 12"
Buttons button<<BUTTONLABELSTRUCT("I want this to be bold", (void (*)(void *, void *))buttonPressed, (void *)this);
button.setLabelsFont(font.getPangoFontDescription());

Definition at line 352 of file Buttons.H.

Here is the call graph for this function:

Here is the caller graph for this function:

void Buttons::signalConnectAfter ( labelFuncData  nf)
inline

Destructor.

connect a callback to execute after the currently connected callbacks

Parameters
nflabelFuncData matching the callback to connect

Definition at line 188 of file Buttons.H.

Here is the call graph for this function:

void Buttons::signalRemove ( labelFuncData  nfOld)
inline

disconnect the old callback and reconnect a new callback

Parameters
nfOldlabelFuncData matching the old callback to be removed
nfNewlabelFuncData matching the new to be connected callback

Definition at line 209 of file Buttons.H.

Here is the call graph for this function:

void Buttons::signalReplace ( labelFuncData  nfOld,
labelFuncData  nfNew 
)
inline

disconnect the old callback and reconnect a new callback

Parameters
nfOldlabelFuncData matching the old callback to be removed
nfNewlabelFuncData matching the new to be connected callback

Definition at line 197 of file Buttons.H.

Here is the call graph for this function:


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