|
Data Structures | |
| struct | wtk_label |
Functions | |
| struct wtk_label * | wtk_label_create (struct win_window *parent, struct win_area const *area, char const *caption, bool align_right) |
| struct win_window * | wtk_label_as_child (struct wtk_label *label) |
| bool | wtk_label_change (struct wtk_label *label, const char *caption) |
| Set new caption for label, return false if out of mem. | |
| void | wtk_label_size_hint (struct win_point *size, const char *caption) |
| Get minimum widget size. | |
|
| |
| static bool | wtk_label_handler (struct win_window *win, enum win_event_type type, void const *data) |
|
| |
| #define | WTK_STATICTEXT_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
| Static text caption text color. | |
| #define WTK_STATICTEXT_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
Static text caption text color.
Definition at line 351 of file wtk.h.
Referenced by wtk_label_handler().
| struct win_window* wtk_label_as_child | ( | struct wtk_label * | label | ) | [read] |
This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting.
| label | Label widget to manage. |
Definition at line 74 of file wtk_label.c.
References assert, and wtk_label::container.
Referenced by app_memgame_launch().
| bool wtk_label_change | ( | struct wtk_label * | label, | |
| const char * | caption | |||
| ) |
Set new caption for label, return false if out of mem.
Definition at line 81 of file wtk_label.c.
References assert, wtk_label::caption, wtk_label::container, membag_alloc(), membag_free(), strlen(), win_redraw(), and wtk_copy_string().
Referenced by calc_update_display(), and memgame_print_tries().
| struct wtk_label* wtk_label_create | ( | struct win_window * | parent, | |
| struct win_area const * | area, | |||
| char const * | caption, | |||
| bool | align_right | |||
| ) | [read] |
This function creates a new label widget. It allocates required memory and intializes 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 label's child reference, given by wtk_label_as_child(), like this: "win_destroy(wtk_label_as_child(myStaticTextPtr));". Usually it will be destroyed automatically when it's parent is destroyed.
| parent | Parent window, possibly wtk_frame_as_parent(myFramePtr). | |
| area | Area of the internal contents. | |
| caption | Pointer to caption string. Will be copied into widget. | |
| align_right | True if caption is to be aligned to the right, false otherwise |
Definition at line 235 of file wtk_label.c.
References wtk_label::align_right, win_attributes::area, assert, win_attributes::background, win_attributes::behavior, wtk_label::caption, wtk_label::container, win_attributes::custom, win_attributes::event_handler, membag_alloc(), membag_free(), strlen(), WIN_BEHAVIOR_REDRAW_PARENT, win_create(), wtk_copy_string(), and wtk_label_handler().
Referenced by app_memgame_launch().
| static bool wtk_label_handler | ( | struct win_window * | win, | |
| enum win_event_type | type, | |||
| void const * | data | |||
| ) | [static] |
This function is the window event handler for label widgets. It handles all events sent to the windows composing the widget.
| win | Window receiving the event. | |
| type | The event type. | |
| data | Custom data, depending on event type. |
Definition at line 131 of file wtk_label.c.
References wtk_label::align_right, assert, wtk_label::caption, wtk_label::container, GFX_COLOR_TRANSPARENT, gfx_draw_string(), gfx_get_string_bounding_box(), membag_free(), win_clip_region::origin, win_area::size, sysfont, WIN_EVENT_DESTROY, WIN_EVENT_DRAW, win_get_area(), win_get_custom_data(), and WTK_STATICTEXT_CAPTION_COLOR.
Referenced by wtk_label_create().
| void wtk_label_size_hint | ( | struct win_point * | size, | |
| const char * | caption | |||
| ) |
Get minimum widget size.
This function returns the minimum size that is required for showing the full widget and the caption.
| size | Suggested size for the widget |
| caption | Pointer to caption string to use for widget. |
Definition at line 209 of file wtk_label.c.
References assert, gfx_get_string_bounding_box(), and sysfont.
1.6.3