Ewl_Button: The Basic Button
Detailed Description
The button class is a basic button with a label. This class inherits from the Ewl_Box to allow for placing any other widget inside the button.
- Remarks:
- Inherits from Ewl_Stock.
Tutorial
The Ewl_Button includes an icon and label by default but is actually a full container that can hold any type of non-toplevel widget. Because of this flexibility many other widget types inherit from the button.
Ewl_Widget *button; button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "Button label"); ewl_widget_show(button);
Data Structures | |
struct | Ewl_Button |
A simple Ewl_Widget to provide for a clickable button in the UI. More... | |
Defines | |
#define | EWL_BUTTON(button) ((Ewl_Button *) button) |
#define | EWL_BUTTON_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_BUTTON_TYPE)) |
#define | EWL_BUTTON_TYPE "button" |
Typedefs | |
typedef struct Ewl_Button | Ewl_Button |
Functions | |
unsigned int | ewl_button_alignment_get (Ewl_Button *b) |
Gets the alignment of the contents of the button. | |
void | ewl_button_alignment_set (Ewl_Button *b, unsigned int align) |
Set the alignment of the contents of the button. | |
void | ewl_button_cb_key_down (Ewl_Widget *w, void *ev, void *data) |
unsigned int | ewl_button_fill_policy_get (Ewl_Button *b) |
Retrieves the curernt file policy set on the button. | |
void | ewl_button_fill_policy_set (Ewl_Button *b, unsigned int fill) |
Set the fill policy of the contents of the button. | |
const char * | ewl_button_image_get (Ewl_Button *b) |
Get the image file used by the button. | |
void | ewl_button_image_set (Ewl_Button *b, const char *file, const char *key) |
Set the image file file and the image key key to use. | |
void | ewl_button_image_size_get (Ewl_Button *b, int *width, int *height) |
Get the size of the image inside the button. | |
void | ewl_button_image_size_set (Ewl_Button *b, int width, int height) |
Set the size of the image inside the button. | |
int | ewl_button_init (Ewl_Button *b) |
Initialize a button to starting values. | |
const char * | ewl_button_label_get (Ewl_Button *b) |
Retrieve the label of the specified button. | |
void | ewl_button_label_set (Ewl_Button *b, const char *l) |
Change the label of the specified button. | |
Ewl_Widget * | ewl_button_new (void) |
Allocate and initialize a new button. | |
Ewl_View * | ewl_button_view_get (void) |
Creates and returns a view to be used by Ewl_Button widgets. |
Define Documentation
#define EWL_BUTTON | ( | button | ) | ((Ewl_Button *) button) |
Typecast a pointer to an Ewl_Button pointer.
Referenced by ewl_checkbutton_init(), ewl_checkbutton_label_position_set(), ewl_colorpicker_init(), ewl_combo_submenu_new(), ewl_filedialog_init(), ewl_menu_from_info(), ewl_menu_item_init(), ewl_menubar_from_info(), ewl_table_init(), and ewl_table_reset().
#define EWL_BUTTON_IS | ( | w | ) | (ewl_widget_type_is(EWL_WIDGET(w), EWL_BUTTON_TYPE)) |
Returns TRUE if the widget is an Ewl_Button, FALSE otherwise
#define EWL_BUTTON_TYPE "button" |
- Widget Theme Keys:
- /button/file
- Widget Theme Keys:
- /button/group
Referenced by ewl_button_alignment_get(), ewl_button_alignment_set(), ewl_button_cb_key_down(), ewl_button_fill_policy_get(), ewl_button_fill_policy_set(), ewl_button_image_get(), ewl_button_image_set(), ewl_button_image_size_get(), ewl_button_image_size_set(), ewl_button_init(), ewl_button_label_get(), and ewl_button_label_set().
Typedef Documentation
typedef struct Ewl_Button Ewl_Button |
The button provides a simple wrapper for creating a clickable Ewl_Widget with an Ewl_Text displayed inside.
Function Documentation
unsigned int ewl_button_alignment_get | ( | Ewl_Button * | b | ) |
Gets the alignment of the contents of the button.
- Parameters:
-
b,: The button to get the content alignment
- Returns:
- Returns no value.
References body, DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_BUTTON_TYPE, EWL_OBJECT, and ewl_object_alignment_get().
void ewl_button_alignment_set | ( | Ewl_Button * | b, | |
unsigned int | align | |||
) |
Set the alignment of the contents of the button.
- Parameters:
-
b,: The button to set the content alignment align,: The new alignment for button contents
- Returns:
- Returns no value.
References body, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BUTTON_TYPE, EWL_OBJECT, and ewl_object_alignment_set().
Referenced by ewl_menu_item_init().
void ewl_button_cb_key_down | ( | Ewl_Widget * | w, | |
void * | ev, | |||
void * | data | |||
) |
References Ewl_Event_Mouse_Up::base, Ewl_Event_Mouse_Up::button, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BUTTON_TYPE, ewl_callback_call_with_event_data(), EWL_CALLBACK_CLICKED, Ewl_Event_Key::keyname, Ewl_Event_Mouse::modifiers, Ewl_Event_Mouse::x, and Ewl_Event_Mouse::y.
Referenced by ewl_button_init().
unsigned int ewl_button_fill_policy_get | ( | Ewl_Button * | b | ) |
Retrieves the curernt file policy set on the button.
- Parameters:
-
b,: The button to get the content fill policy from
- Returns:
- Returns the current fill policy set on the button
References body, DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_BUTTON_TYPE, EWL_OBJECT, and ewl_object_fill_policy_get().
void ewl_button_fill_policy_set | ( | Ewl_Button * | b, | |
unsigned int | fill | |||
) |
Set the fill policy of the contents of the button.
- Parameters:
-
b,: The button to set the content fill policy fill,: The new fill policy for button contents
- Returns:
- Returns no value.
References body, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BUTTON_TYPE, EWL_OBJECT, and ewl_object_fill_policy_set().
Referenced by ewl_menu_item_init().
const char* ewl_button_image_get | ( | Ewl_Button * | b | ) |
Get the image file used by the button.
- Parameters:
-
b,: The button to the the image file from
- Returns:
- Returns the image file used in the button or NULL on failure
References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_BUTTON_TYPE, EWL_IMAGE, ewl_image_file_path_get(), and image_object.
void ewl_button_image_set | ( | Ewl_Button * | b, | |
const char * | file, | |||
const char * | key | |||
) |
Set the image file file
and the image key key
to use.
- Parameters:
-
b,: The button to set the image on file,: The file to use for the image key,: The edje key to use for the image (or NULL if not using edje)
- Returns:
- Returns no value.
References body, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_BUTTON_TYPE, EWL_CONTAINER, ewl_container_child_prepend(), ewl_container_redirect_get(), ewl_container_redirect_set(), EWL_FLAG_ALIGN_CENTER, EWL_FLAG_FILL_NONE, EWL_IMAGE, ewl_image_file_set(), ewl_image_new(), EWL_OBJECT, ewl_object_alignment_set(), ewl_object_fill_policy_set(), ewl_widget_destroy(), ewl_widget_internal_set(), ewl_widget_show(), and image_object.
Referenced by ewl_button_image_size_set(), ewl_combo_submenu_new(), and ewl_menu_from_info().
void ewl_button_image_size_get | ( | Ewl_Button * | b, | |
int * | width, | |||
int * | height | |||
) |
Get the size of the image inside the button.
- Parameters:
-
b,: The button to get the image size on width,: Where to put the width of the widget height,: Where to put the height of the widget
- Returns:
- Returns no value.
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BUTTON_TYPE, EWL_IMAGE, ewl_image_size_get(), and image_object.
void ewl_button_image_size_set | ( | Ewl_Button * | b, | |
int | width, | |||
int | height | |||
) |
Set the size of the image inside the button.
- Parameters:
-
b,: The button to set the image size on width,: The width of the image height,: The height of the image
- Returns:
- Returns no value.
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, ewl_button_image_set(), EWL_BUTTON_TYPE, EWL_IMAGE, ewl_image_size_set(), and image_object.
Referenced by ewl_menu_item_init().
int ewl_button_init | ( | Ewl_Button * | b | ) |
Initialize a button to starting values.
- Parameters:
-
b,: the button to initialize
- Returns:
- Returns no value. Initializes a button to default values and callbacks.
References body, DCHECK_PARAM_PTR_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_BOX, ewl_box_orientation_set(), ewl_button_cb_key_down(), EWL_BUTTON_TYPE, ewl_callback_append(), EWL_CALLBACK_FOCUS_IN, EWL_CALLBACK_FOCUS_OUT, EWL_CALLBACK_KEY_DOWN, EWL_CONTAINER, ewl_container_callback_notify(), ewl_container_cb_widget_focus_in(), ewl_container_cb_widget_focus_out(), ewl_container_child_append(), ewl_container_redirect_set(), EWL_FLAG_ALIGN_CENTER, EWL_FLAG_FILL_VFILL, ewl_hbox_new(), EWL_OBJECT, ewl_object_alignment_set(), ewl_object_fill_policy_set(), EWL_ORIENTATION_VERTICAL, EWL_STOCK, ewl_stock_functions_set(), ewl_stock_init(), EWL_STOCK_NONE, ewl_stock_type_set(), EWL_WIDGET, ewl_widget_appearance_set(), ewl_widget_focusable_set(), ewl_widget_inherit(), ewl_widget_internal_set(), and ewl_widget_show().
Referenced by ewl_button_new(), ewl_checkbutton_init(), and ewl_menu_item_init().
const char* ewl_button_label_get | ( | Ewl_Button * | b | ) |
Retrieve the label of the specified button.
- Parameters:
-
b,: the buttons whose label will be returned
- Returns:
- A newly allocated copy of the label on the button.
References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_BUTTON_TYPE, EWL_LABEL, ewl_label_text_get(), and label_object.
void ewl_button_label_set | ( | Ewl_Button * | b, | |
const char * | l | |||
) |
Change the label of the specified button.
- Parameters:
-
b,: the buttons whose label will be changed l,: the new label for the button
- Returns:
- Returns no value.
References body, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BUTTON_TYPE, EWL_CONTAINER, ewl_container_child_append(), ewl_container_redirect_get(), ewl_container_redirect_set(), EWL_FLAG_FILL_VFILL, EWL_LABEL, ewl_label_new(), ewl_label_text_set(), EWL_OBJECT, ewl_object_fill_policy_set(), ewl_widget_destroy(), ewl_widget_internal_set(), ewl_widget_show(), and label_object.
Referenced by ewl_colorpicker_init(), ewl_combo_submenu_new(), ewl_filedialog_init(), ewl_menu_from_info(), ewl_menu_item_init(), ewl_menubar_from_info(), ewl_table_init(), and ewl_table_reset().
Ewl_Widget* ewl_button_new | ( | void | ) |
Allocate and initialize a new button.
- Returns:
- Returns NULL on failure, a pointer to a new button on success
References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, ewl_button_init(), EWL_WIDGET, ewl_widget_destroy(), and NEW.
Referenced by ewl_colordialog_init(), ewl_combo_init(), ewl_filepicker_init(), ewl_scrollbar_init(), ewl_seeker_init(), ewl_spinner_init(), ewl_table_init(), and ewl_table_reset().
Ewl_View* ewl_button_view_get | ( | void | ) |
Creates and returns a view to be used by Ewl_Button widgets.
- Returns:
- Returns a view that can be used to display Ewl_Button widgets
References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, ewl_view_header_fetch_set(), ewl_view_new(), and ewl_view_widget_fetch_set().