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>
|
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...
|
|
static void | setActive (GtkWidget *wid, bool state) |
|
static bool | getActive (GtkWidget *wid) |
|
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 :
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 :
for (int i=0;i<buttons.getCount();i++)
box << buttons.next();
- Examples:
- AlignmentTest.C, ButtonsFontTest.C, ButtonsTest.C, ButtonsTest2.C, CairoArrowTest.C, CairoBoxTest.C, CairoCircleTest.C, colourWheelTest.C, ComboBoxTextTest.C, DragNDropNowindowTest.C, DragNDropSimpleTest.C, DragNDropTest.C, DrawingAreaTest.C, InlineTest.C, LabelsTest.C, LabelsTest2.C, LabelsTest3.C, MessageDialogTest.C, NeuralNetworkFnTest.C, PangoTest.C, PangoTest2.C, PixmapTest.C, ProgressBarTest.C, ScaleTest.C, SelectionAreaTest.C, SeparatorTest.C, TableTest.C, TextViewTest.C, and WidgetTest.C.
Definition at line 184 of file Buttons.H.
◆ Buttons()
Buttons::Buttons |
( |
void |
| ) |
|
|
inline |
◆ exposePixmap()
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 387 of file Buttons.H.
◆ findActiveButtonIndex()
int Buttons::findActiveButtonIndex |
( |
| ) |
|
|
inline |
Finds the active button. Only works for toggle buttons (toggle, checkbox, etc.).
- Returns
- the index of the button which is active, or 0 if none active.
Definition at line 531 of file Buttons.H.
◆ findIndex()
int Buttons::findIndex |
( |
GtkWidget * |
widget | ) |
|
|
inline |
Find the GTK widget index (from 1) in the list of buttons
- Parameters
-
widget | The widget to look for |
- Returns
- 0 if it isn't on the list, the index (from 1) otherwise
Definition at line 461 of file Buttons.H.
◆ findWidget()
GtkWidget* Buttons::findWidget |
( |
int |
index | ) |
|
|
inline |
Get the widget at index (starting from 1)
- Parameters
-
index | the widget at this index to grab (starting from 1) |
- Returns
- The widget at index, or NULL on error
Definition at line 483 of file Buttons.H.
◆ getActive() [1/2]
bool Buttons::getActive |
( |
void |
| ) |
|
|
inline |
Method to get the currently selected button's active state. Only works for toggle buttons (toggle, checkbox, etc.).
- Returns
- the current state of the button, or false if no buttons exist
Definition at line 512 of file Buttons.H.
◆ getActive() [2/2]
static bool Buttons::getActive |
( |
GtkWidget * |
wid | ) |
|
|
inlinestatic |
Method to get an arbitrary button's active state. Only works for toggle buttons (toggle, checkbox, etc.).
- Parameters
-
wid | The toggle button to query for its active state. |
- Returns
- the current state of the button, or false if no buttons exist
Definition at line 523 of file Buttons.H.
◆ getAlignment()
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
-
xAlign | the x-alignment 0.0 is a left alignment, 1.0 is for right alignment |
yAlign | the y-alignment 0.0 is a left alignment, 1.0 is for right alignment |
Definition at line 211 of file Buttons.H.
◆ getLabel()
const gchar* Buttons::getLabel |
( |
| ) |
|
|
inline |
Get the label associated with the button.
- Returns
- The label, if none, then NULL.
Definition at line 453 of file Buttons.H.
◆ operator<<() [1/7]
generate a label button
- Parameters
-
nf | The label, callback function and data to show. |
- Returns
- This Buttons class for further overloading
Definition at line 264 of file Buttons.H.
◆ operator<<() [2/7]
generate a button with a static pixmap
- Parameters
-
nf | The pixmap, callback function and data to show. |
- Returns
- This Buttons class for further overloading
Definition at line 280 of file Buttons.H.
◆ operator<<() [3/7]
generate a toggle button with label
- Parameters
-
nf | The label, callback function and data to show. |
- Returns
- This Buttons class for further overloading
Definition at line 294 of file Buttons.H.
◆ operator<<() [4/7]
generate a button with a pixmap which is partially transparent
- Parameters
-
pfdt | The pixmap, callback function and data to show. |
- Returns
- This Buttons class for further overloading
Definition at line 318 of file Buttons.H.
◆ operator<<() [5/7]
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
-
af | The 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 335 of file Buttons.H.
◆ operator<<() [6/7]
generate a radio button with label If other radio buttons are present, then they are all added to the same group
- Parameters
-
nf | The label, callback function and data to show. |
- Returns
- This Buttons class for further overloading
Definition at line 352 of file Buttons.H.
◆ operator<<() [7/7]
generate a check button with label
- Parameters
-
nf | The label, callback function and data to show. |
- Returns
- This Buttons class for further overloading
Definition at line 367 of file Buttons.H.
◆ setActive() [1/2]
static void Buttons::setActive |
( |
GtkWidget * |
wid, |
|
|
bool |
state |
|
) |
| |
|
inlinestatic |
Method to set the currently selected button to active. Only works for toggle buttons (toggle, checkbox, etc.).
- Parameters
-
wid | The toggle button to query for its active state. |
state | The state of the button |
Definition at line 495 of file Buttons.H.
◆ setActive() [2/2]
void Buttons::setActive |
( |
bool |
state | ) |
|
|
inline |
Method to set the currently selected button to active. Only works for toggle buttons (toggle, checkbox, etc.).
- Parameters
-
state | The state of the button |
Definition at line 503 of file Buttons.H.
◆ setAlignment()
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
-
xAlign | the x-alignment 0.0 is a left alignment, 1.0 is for right alignment |
yAlign | the y-alignment 0.0 is a left alignment, 1.0 is for right alignment |
Definition at line 200 of file Buttons.H.
◆ setLabel()
void Buttons::setLabel |
( |
const char * |
l | ) |
|
|
inline |
Set the current() button's label.
- Parameters
-
l | the label the set on the button. |
Definition at line 446 of file Buttons.H.
◆ setLabelsFont()
void Buttons::setLabelsFont |
( |
PangoFontDescription * |
pangoFontDescription | ) |
|
|
inline |
Set the current botton's label's font For example :
button.setLabelsFont(font.getPangoFontDescription());
- Examples:
- ButtonsFontTest.C.
Definition at line 435 of file Buttons.H.
◆ signalConnectAfter() [1/2]
Destructor.
connect a callback to execute after the currently connected callbacks
- Parameters
-
nf | labelFuncData matching the callback to connect |
Definition at line 226 of file Buttons.H.
◆ signalConnectAfter() [2/2]
void Buttons::signalConnectAfter |
( |
const AnyFuncData & |
af | ) |
|
|
inline |
connect a callback to execute after the currently connected callbacks
- Parameters
-
af | anyFuncData matching the callback to connect |
Definition at line 234 of file Buttons.H.
◆ signalRemove()
disconnect the old callback and reconnect a new callback
- Parameters
-
nfOld | AnyFuncData matching the old callback to be removed |
Definition at line 254 of file Buttons.H.
◆ signalReplace()
disconnect the old callback and reconnect a new callback
- Parameters
-
nfOld | labelFuncData matching the old callback to be removed |
nfNew | labelFuncData matching the new to be connected callback |
Definition at line 243 of file Buttons.H.
The documentation for this class was generated from the following file: