Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Icon button widget

Functions

struct win_windowwtk_icon_button_as_child (struct wtk_icon_button *icon_button)
 This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. More...
 
struct wtk_icon_buttonwtk_icon_button_create (struct win_window *parent, struct win_area const *area, struct gfx_bitmap *icon, bool selected, struct wtk_icon_group *group, win_command_t command_data)
 This function creates a new icon button widget. More...
 
win_command_t wtk_icon_button_get_command (struct wtk_icon_button *icon_button)
 This function returns the window command of the specified icon button, as set when the widget was created. More...
 
bool wtk_icon_button_is_selected (struct wtk_icon_button const *icon_button)
 This function returns true if the icon button is the one currently selected within its icon button group. More...
 
void wtk_icon_button_select (struct wtk_icon_button *icon_button)
 This function sets this icon button to be the single icon button selected within its group. More...
 
void wtk_icon_button_size_hint (struct win_point *size, const struct gfx_bitmap *icon_image)
 Get minimum widget size. More...
 
struct wtk_icon_groupwtk_icon_group_create (void)
 This function creates a new icon button group, allocating required memory and properly initializing the object. More...
 
struct wtk_icon_buttonwtk_icon_group_get_selected (struct wtk_icon_group *group)
 This function retrieves a pointer to the currently selected icon in an icon group. More...
 

struct win_window* wtk_icon_button_as_child ( struct wtk_icon_button icon_button)

This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting.

Parameters
icon_buttonIcon button widget to manage.
Returns
Window to be used for managing the icon button.

References Assert, and wtk_icon_button::container.

struct wtk_icon_button* wtk_icon_button_create ( struct win_window parent,
struct win_area const *  area,
struct gfx_bitmap icon,
bool  selected,
struct wtk_icon_group group,
win_command_t  command 
)

This function creates a new icon button widget.

It allocates required memory and initializes necessary windows to create the widget. If there is not enough memory, the function returns NULL. To destroy the widget and all its contents, and free its memory, call win_destroy() on the icon button's child reference, given by wtk_icon_button_as_child(), like this: "win_destroy(wtk_icon_button_as_child(myButtonPtr));". Usually it will be destroyed automatically when it's parent is destroyed.

Parameters
parentParent window, possibly wtk_frame_as_parent(myFramePtr).
areaArea of the internal contents.
iconBitmap to draw as the icon.
selectedInitial state of icon button, true if checked/selected.
groupIcon button group to be a member of.
commandCommand to send to parent window. Must be non-zero to be enabled.
Returns
Pointer to icon button, or NULL if failed.

References win_attributes::area, Assert, win_attributes::background, win_attributes::behavior, wtk_icon_button::command, wtk_icon_button::container, win_attributes::custom, win_attributes::event_handler, wtk_icon_button::group, membag_alloc(), membag_free(), NULL, num_references, selected, wtk_icon_button::state, win_create(), wtk_icon_button_handler(), wtk_icon_button_select(), and WTK_ICONBUTTON_NORMAL.

win_command_t wtk_icon_button_get_command ( struct wtk_icon_button icon_button)

This function returns the window command of the specified icon button, as set when the widget was created.

Parameters
icon_buttonIcon button widget to manage.
Returns
Associated window command of the icon button widget.

References Assert, and wtk_icon_button::command.

bool wtk_icon_button_is_selected ( struct wtk_icon_button const *  icon_button)

This function returns true if the icon button is the one currently selected within its icon button group.

Returns
True if icon button selected.

References Assert, wtk_icon_button::group, and selected.

void wtk_icon_button_select ( struct wtk_icon_button icon_button)

This function sets this icon button to be the single icon button selected within its group.

If another icon button was selected, it will be deselected. Both widgets will be redrawn if visible.

Parameters
icon_buttonIcon button widget to select.

References Assert, wtk_icon_button::container, wtk_icon_button::group, selected, and win_redraw().

Referenced by wtk_icon_button_create(), and wtk_icon_button_handler().

void wtk_icon_button_size_hint ( struct win_point size,
const struct gfx_bitmap icon_image 
)

Get minimum widget size.

This function returns the minimum size that is required for showing the full widget icon image.

Return values
sizeSuggested size for the widget
Parameters
icon_imagePointer to icon image to use for widget.

References Assert, gfx_bitmap::height, gfx_bitmap::width, win_point::x, and win_point::y.

struct wtk_icon_group* wtk_icon_group_create ( void  )

This function creates a new icon button group, allocating required memory and properly initializing the object.

If there is not enough memory, the function returns NULL. The icon button group will keep a reference count for its members, and will be automatically destroyed when the last member is destroyed.

Returns
Pointer to icon button group, or NULL if failed.

References membag_alloc(), NULL, num_references, and selected.

struct wtk_icon_button* wtk_icon_group_get_selected ( struct wtk_icon_group group)

This function retrieves a pointer to the currently selected icon in an icon group.

Returns
Pointer to the selected icon button in an icon button group, or NULL if no item is selected.

References Assert, and selected.