 |
 |
 |
 |
Etk_Button
Detailed Description
The Etk_Button widget is a widget that emits a signal when it is pressed, released or clicked.
An Etk_Button usually contains only a label and an icon, but it can contain any type of widgets.
You can change the label of the button with etk_button_label_set(), and you can change its icon with etk_button_image_set(). You can also pack your own widget with etk_bin_child_set()
- Object Hierarchy:
-
- Signals:
- "pressed": Emitted when the button is pressed
Callback: Etk_Bool callback(Etk_Button *button, void *data)
button: the button which has been presseddata: the user data set when the callback has been connected to the signal
- "released": Emitted when the button is released
Callback: Etk_Bool callback(Etk_Button *button, void *data)
button: the button which has been releaseddata: the user data set when the callback has been connected to the signal
- "clicked": Emitted when the button is clicked (i.e. when the button is released, and if the mouse is still above it)
Callback: Etk_Bool callback(Etk_Button *button, void *data)
button: the button which has been clickeddata: the user data set when the callback has been connected to the signal
- Properties:
- "label": The text of the label of the button
Type: String (char *)Access: Read/WriteDefault Value: NULL
- "image": The image packed on the left of the label, inside the button
Type: Pointer (Etk_Image *)Access: Read/WriteDefault Value: NULL
- "style": The style of the button (icon, text, both vertically, both horizontally)
Type: Integer (Etk_Button_Style)Access: Read/WriteDefault Value: ETK_BUTTON_BOTH_HORIZ
- "stock_size": The stock-size of the image of the button
Type: Integer (Etk_Stock_Size)Access: Read/WriteDefault Value: ETK_STOCK_SMALL
- "xalign": The horizontal alignment of the child of the button, from 0.0 (left aligned) to 1.0 (right aligned)
Type: FloatAccess: Read/WriteDefault Value: 0.5
- "yalign": The vertical alignment of the child of the button, from 0.0 (top aligned) to 1.0 (bottom aligned)
Type: FloatAccess: Read/WriteDefault Value: 0.5
|
Data Structures |
struct | Etk_Button |
| [Widget] A widget that can be pressed, released or clicked More...
|
Defines |
#define | ETK_BUTTON_TYPE (etk_button_type_get()) |
#define | ETK_BUTTON(obj) (ETK_OBJECT_CAST((obj), ETK_BUTTON_TYPE, Etk_Button)) |
#define | ETK_IS_BUTTON(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_BUTTON_TYPE)) |
Enumerations |
enum | Etk_Button_Style {
ETK_BUTTON_ICON,
ETK_BUTTON_TEXT,
ETK_BUTTON_BOTH_HORIZ,
ETK_BUTTON_BOTH_VERT
} |
| The button's style (icon, text, both vertically, both horizontally). More...
|
Functions |
Etk_Widget * | etk_button_new (void) |
| Creates a new button.
|
Etk_Widget * | etk_button_new_with_label (const char *label) |
| Creates a new button with a label.
|
Etk_Widget * | etk_button_new_from_stock (Etk_Stock_Id stock_id) |
| Creates a new button with a label and an icon defined by a stock-id.
|
void | etk_button_press (Etk_Button *button) |
| Presses the button if it wasn't already pressed.
|
void | etk_button_release (Etk_Button *button) |
| Releases the button if it was pressed.
|
void | etk_button_click (Etk_Button *button) |
| Clicks on the button.
|
void | etk_button_label_set (Etk_Button *button, const char *label) |
| Sets the text of the button's label.
|
const char * | etk_button_label_get (Etk_Button *button) |
| Gets the text of the button's label.
|
void | etk_button_image_set (Etk_Button *button, Etk_Image *image) |
| Sets the image of the button.
|
Etk_Image * | etk_button_image_get (Etk_Button *button) |
| Gets the image of the button.
|
void | etk_button_set_from_stock (Etk_Button *button, Etk_Stock_Id stock_id) |
| Sets the label and the image of the button from a stock-id.
|
void | etk_button_style_set (Etk_Button *button, Etk_Button_Style style) |
| Sets the style of the button (icon, text, both vertically, both horizontally).
|
Etk_Button_Style | etk_button_style_get (Etk_Button *button) |
| Gets the style of the button.
|
void | etk_button_stock_size_set (Etk_Button *button, Etk_Stock_Size size) |
| Sets the stock-size of the button's image.
|
Etk_Stock_Size | etk_button_stock_size_get (Etk_Button *button) |
| Gets the stock-size of the button's image.
|
void | etk_button_alignment_set (Etk_Button *button, float xalign, float yalign) |
| Sets the alignment of the child of the button.
|
void | etk_button_alignment_get (Etk_Button *button, float *xalign, float *yalign) |
| Gets the alignment of the button's child.
|
Define Documentation
#define ETK_BUTTON_TYPE (etk_button_type_get()) |
#define ETK_BUTTON |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_BUTTON_TYPE, Etk_Button)) |
Casts the object to an Etk_Button
Referenced by etk_button_new_from_stock(), etk_button_set_from_stock(), etk_dialog_button_add(), etk_dialog_button_add_from_stock(), etk_notebook_page_tab_label_get(), etk_notebook_page_tab_label_set(), etk_tool_button_new_from_stock(), etk_tool_toggle_button_new_from_stock(), etk_toolbar_stock_size_set(), etk_toolbar_style_set(), etk_tree_col_title_get(), and etk_tree_col_title_set().
#define ETK_IS_BUTTON |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_BUTTON_TYPE)) |
Enumeration Type Documentation
The button's style (icon, text, both vertically, both horizontally).
- Enumerator:
-
ETK_BUTTON_ICON |
Only the icon is visible |
ETK_BUTTON_TEXT |
Only the label is visible |
ETK_BUTTON_BOTH_HORIZ |
Both the icon and the label are visible, the icon is at the left of the label |
ETK_BUTTON_BOTH_VERT |
Both the icon and the label are visible, the icon is above the label |
Function Documentation
Etk_Widget * etk_button_new_with_label |
( |
const char * |
label |
) |
|
void etk_button_label_set |
( |
Etk_Button * |
button, |
|
|
const char * |
label | |
|
) |
| | |
Sets the text of the button's label.
- Parameters:
-
| button | a button |
| label | the text to set to the button's label |
References ETK_LABEL, etk_label_set(), ETK_OBJECT, etk_object_notify(), ETK_WIDGET, etk_widget_hide(), etk_widget_parent_get(), etk_widget_show(), and label.
Referenced by etk_button_set_from_stock(), etk_notebook_page_tab_label_set(), and etk_tree_col_title_set().
const char * etk_button_label_get |
( |
Etk_Button * |
button |
) |
|
Gets the image of the button.
- Parameters:
-
- Returns:
- Returns the image of the button, or NULL if the button has no image
References image.
Sets the label and the image of the button from a stock-id.
- Parameters:
-
| button | a button |
| stock_id | the stock-id to use |
- Note:
- For some stock-id, the label is empty
References ETK_BUTTON, etk_button_image_set(), etk_button_label_set(), ETK_IMAGE, etk_image_new_from_stock(), etk_stock_label_get(), etk_widget_internal_set(), and stock_size.
Referenced by etk_button_new_from_stock(), etk_tool_button_new_from_stock(), and etk_tool_toggle_button_new_from_stock().
Sets the style of the button (icon, text, both vertically, both horizontally).
- Parameters:
-
| button | a button |
| style | the style to give to the button |
References box, ETK_CONTAINER, etk_container_remove_all(), ETK_OBJECT, etk_object_destroy(), etk_object_notify(), ignore_image_remove, and style.
Referenced by etk_toolbar_style_set().
Gets the style of the button.
- Parameters:
-
- Returns:
- Returns the button's style
References style.
Gets the stock-size of the button's image.
- Parameters:
-
- Returns:
- Returns the stock-size of the button's image
References stock_size.
void etk_button_alignment_set |
( |
Etk_Button * |
button, |
|
|
float |
xalign, |
|
|
float |
yalign | |
|
) |
| | |
Sets the alignment of the child of the button.
- Parameters:
-
| button | a button |
| xalign | the horizontal alignment (0.0 = left, 0.5 = center, 1.0 = right, ...) |
| yalign | the vertical alignment (0.0 = top, 0.5 = center, 1.0 = bottom, ...) |
- Note:
- It only has effect if the child is a label or an alignment
References ETK_ALIGNMENT, etk_alignment_get(), etk_alignment_set(), ETK_BIN, etk_bin_child_get(), ETK_IS_ALIGNMENT, ETK_IS_LABEL, ETK_LABEL, etk_label_alignment_set(), ETK_OBJECT, etk_object_notify(), xalign, and yalign.
void etk_button_alignment_get |
( |
Etk_Button * |
button, |
|
|
float * |
xalign, |
|
|
float * |
yalign | |
|
) |
| | |
Gets the alignment of the button's child.
- Parameters:
-
| button | a button |
| xalign | the location where to store the horizontal alignment |
| yalign | the location where to store the vertical alignment |
References xalign, and yalign.
|
 |
 |
 |
 |
|