This application demonstrates most of the available widgets in the Widget toolkit. More...
|
Data Structures | |
| struct | widget_context |
| Widget application context. More... | |
Enumerations | |
| enum | command_id { RADIO_DEC_ID = 123, RADIO_HEX_ID, BUTTON_EXIT_ID, DUMMY_ID, SLIDER_ID, CHECK_BOX_ID, RADIO_BUTTON_1_ID, RADIO_BUTTON_2_ID, BUTTON_QUIT_ID } |
Command event IDs. More... | |
Functions | |
| static void | app_widget_update_colors (struct widget_context *widget) |
| Update colors. | |
| static bool | widget_frame_command_handler (struct wtk_basic_frame *frame, win_command_t command_data) |
| Frame handler for the application. | |
| void | app_widget_launch (struct workqueue_task *task) |
| Setup widget demo. | |
Variables | |
| static const char | demo_string [] = "Demonstrating widgets" |
| Description for label. | |
| static const char | checkbox_string [] = "Invert colors" |
| Description for check box. | |
| static const char | rb1_string [] = "Color scheme 1" |
| Description for radio buttons. | |
| static const char | rb2_string [] = "Color scheme 2" |
| Description for radio buttons. | |
| static struct widget_context * | widget_ctx |
| Statically allocated context pointer. | |
Color scheme | |
|
| |
| #define | COLOR_SCHEME_0_FG GFX_COLOR(255,255,0) |
| Color scheme 0 foreground color. | |
| #define | COLOR_SCHEME_0_BG GFX_COLOR(0,50,0) |
| Color scheme 0 background color. | |
| #define | COLOR_SCHEME_1_FG GFX_COLOR(0,255,0) |
| Color scheme 1 foreground color. | |
| #define | COLOR_SCHEME_1_BG GFX_COLOR(0,100,100) |
| Color scheme 1 background color. | |
| #define | APP_BACKGROUND_COLOR GFX_COLOR(0,0,0) |
| Background color for application. | |
| #define | SUBFRAME_BACKGROUND_COLOR GFX_COLOR(90,90,90) |
| Background color for subframe. | |
Widget positions and sizes | |
|
| |
| #define | LABEL_POS_X 10 |
| Label X coordinate. | |
| #define | LABEL_POS_Y 10 |
| Label Y coordinate. | |
| #define | SUBFRAME_HORIZONTAL_SPACING 45 |
| Spacing on each side of the subframe. | |
| #define | SUBFRAME_TOP_SPACING 10 |
| Spacing from label to subframe. | |
| #define | SUBFRAME_BOTTOM_SPACING 30 |
| Spacing from subframe to bottom of screen. | |
| #define | WIDGET_POS_X 10 |
| Leftmost X coordinate in subframe for the widgets. | |
| #define | SLIDER_POS_Y 10 |
| Slider X coordinate, inside subframe. | |
| #define | SLIDER_SIZE_X 80 |
| Width of slider. | |
| #define | SLIDER_SIZE_Y 40 |
| Height of slider. | |
| #define | SLIDER_PB_SPACING_X 10 |
| Spacing between the slider and progress bars. | |
| #define | PB_SIZE_X SLIDER_SIZE_X |
| Width of progress bar. | |
| #define | PB_SIZE_Y SLIDER_SIZE_Y |
| Height of progress bar. | |
| #define | CHECK_BOX_SPACING_Y 20 |
| Spacing above check box to slider and progress bars. | |
| #define | RADIO_BUTTON_SPACING_Y 5 |
| Spacing above each radio button. | |
This application demonstrates most of the available widgets in the Widget toolkit.
The application consists of a slider and progress bar, a check box and two radio buttons. The user can change the progress bar by moving the slider, and change the colors of the progress bar by use of the check box and radio buttons.
| #define APP_BACKGROUND_COLOR GFX_COLOR(0,0,0) |
Background color for application.
Definition at line 96 of file app_widget.c.
| #define CHECK_BOX_SPACING_Y 20 |
Spacing above check box to slider and progress bars.
Definition at line 138 of file app_widget.c.
| #define COLOR_SCHEME_0_BG GFX_COLOR(0,50,0) |
Color scheme 0 background color.
Definition at line 90 of file app_widget.c.
Referenced by app_widget_update_colors().
| #define COLOR_SCHEME_0_FG GFX_COLOR(255,255,0) |
Color scheme 0 foreground color.
Definition at line 88 of file app_widget.c.
Referenced by app_widget_update_colors().
| #define COLOR_SCHEME_1_BG GFX_COLOR(0,100,100) |
Color scheme 1 background color.
Definition at line 94 of file app_widget.c.
Referenced by app_widget_update_colors().
| #define COLOR_SCHEME_1_FG GFX_COLOR(0,255,0) |
Color scheme 1 foreground color.
Definition at line 92 of file app_widget.c.
Referenced by app_widget_update_colors().
| #define LABEL_POS_X 10 |
Label X coordinate.
Definition at line 109 of file app_widget.c.
| #define LABEL_POS_Y 10 |
Label Y coordinate.
Definition at line 111 of file app_widget.c.
| #define PB_SIZE_X SLIDER_SIZE_X |
Width of progress bar.
Definition at line 133 of file app_widget.c.
| #define PB_SIZE_Y SLIDER_SIZE_Y |
Height of progress bar.
Definition at line 135 of file app_widget.c.
| #define RADIO_BUTTON_SPACING_Y 5 |
Spacing above each radio button.
Definition at line 141 of file app_widget.c.
| #define SLIDER_PB_SPACING_X 10 |
Spacing between the slider and progress bars.
Definition at line 131 of file app_widget.c.
| #define SLIDER_POS_Y 10 |
Slider X coordinate, inside subframe.
Definition at line 124 of file app_widget.c.
| #define SLIDER_SIZE_X 80 |
Width of slider.
Definition at line 126 of file app_widget.c.
| #define SLIDER_SIZE_Y 40 |
Height of slider.
Definition at line 128 of file app_widget.c.
| #define SUBFRAME_BACKGROUND_COLOR GFX_COLOR(90,90,90) |
Background color for subframe.
Definition at line 98 of file app_widget.c.
| #define SUBFRAME_BOTTOM_SPACING 30 |
Spacing from subframe to bottom of screen.
Definition at line 118 of file app_widget.c.
| #define SUBFRAME_HORIZONTAL_SPACING 45 |
Spacing on each side of the subframe.
Definition at line 114 of file app_widget.c.
| #define SUBFRAME_TOP_SPACING 10 |
Spacing from label to subframe.
Definition at line 116 of file app_widget.c.
| #define WIDGET_POS_X 10 |
Leftmost X coordinate in subframe for the widgets.
Definition at line 121 of file app_widget.c.
| enum command_id |
Command event IDs.
Definition at line 66 of file app_widget.c.
| void app_widget_launch | ( | struct workqueue_task * | task | ) |
Setup widget demo.
Allocates memory for the application context, and creates all widgets that make up its interface. If memory allocation or widget creation fails, the application exits immediately.
| task | Workqueue task used to start the application. |
| static void app_widget_update_colors | ( | struct widget_context * | widget | ) | [static] |
Update colors.
Updates the colors for the progress bar and issues redrawing of the widgets.
| widget | Context for widget application |
Definition at line 185 of file app_widget.c.
References widget_context::color_invert, widget_context::color_scheme, COLOR_SCHEME_0_BG, COLOR_SCHEME_0_FG, COLOR_SCHEME_1_BG, COLOR_SCHEME_1_FG, widget_context::pb, win_redraw(), wtk_progress_bar_as_child(), and wtk_progress_bar_set_colors().
Referenced by widget_frame_command_handler().
| static bool widget_frame_command_handler | ( | struct wtk_basic_frame * | frame, | |
| win_command_t | command_data | |||
| ) | [static] |
Frame handler for the application.
Handles all command events from the widgets in the application frame.
| frame | Pointer to the application frame | |
| command_data | Command event ID |
Definition at line 227 of file app_widget.c.
References app_desktop_restart(), app_widget_update_colors(), BUTTON_QUIT_ID, CHECK_BOX_ID, widget_context::color_invert, widget_context::color_scheme, membag_free(), memcpy(), widget_context::old_sysfont, widget_context::pb, RADIO_BUTTON_1_ID, RADIO_BUTTON_2_ID, widget_context::slider, SLIDER_ID, sysfont, wtk_basic_frame_get_custom_data(), wtk_progress_bar_set_value(), and wtk_slider_get_value().
const char checkbox_string[] = "Invert colors" [static] |
Description for check box.
Definition at line 148 of file app_widget.c.
const char demo_string[] = "Demonstrating widgets" [static] |
Description for label.
Definition at line 146 of file app_widget.c.
const char rb1_string[] = "Color scheme 1" [static] |
Description for radio buttons.
Definition at line 150 of file app_widget.c.
const char rb2_string[] = "Color scheme 2" [static] |
Description for radio buttons.
Definition at line 152 of file app_widget.c.
struct widget_context* widget_ctx [static] |
Statically allocated context pointer.
Definition at line 176 of file app_widget.c.
1.6.3