Data Structures | |
struct | widget_context |
Widget application context. More... | |
Enumerations | |
enum | command_id { DUMMY_ID, SLIDER_ID, CHECK_BOX_ID, RADIO_BUTTON_1_ID, RADIO_BUTTON_2_ID, BUTTON_ID } |
Command event IDs. More... | |
Functions | |
bool | app_widget_launch (void) |
Setup widget demo. More... | |
static void | app_widget_update_colors (struct widget_context *widget) |
Update colors. More... | |
static bool | widget_frame_command_handler (struct wtk_basic_frame *frame, win_command_t command_data) |
Frame handler for the application. More... | |
Variables | |
static const char | btn_string [] = "Reset Slider" |
Description for the button. More... | |
static const char | checkbox_string [] = "Invert colors" |
Description for the check box. More... | |
static const char | rb1_string [] = "Color scheme 1" |
Description for the first radio button. More... | |
static const char | rb2_string [] = "Color scheme 2" |
Description for the second radio button. More... | |
static struct widget_context * | widget_ctx |
Statically allocated context pointer. More... | |
Color scheme | |
#define | COLOR_SCHEME_0_FG GFX_COLOR(30, 30, 200) |
Color scheme 0 foreground color. More... | |
#define | COLOR_SCHEME_0_BG GFX_COLOR(255, 255, 255) |
Color scheme 0 background color. More... | |
#define | COLOR_SCHEME_1_FG GFX_COLOR(0, 255, 0) |
Color scheme 1 foreground color. More... | |
#define | COLOR_SCHEME_1_BG GFX_COLOR(0, 100, 100) |
Color scheme 1 background color. More... | |
#define | APP_BACKGROUND_COLOR GFX_COLOR(220, 220, 220) |
Background color of the application frame. More... | |
Widget positions and sizes | |
#define | WIDGET_POS_X 14 |
Leftmost X coordinate in frame for the widgets. More... | |
#define | WIDGET_POS_Y 5 |
Topmost Y coordinate in frame for the widgets. More... | |
#define | SLIDER_POS_Y 10 |
Slider X coordinate, inside frame. More... | |
#define | SLIDER_SIZE_X 120 |
Width of slider. More... | |
#define | SLIDER_SIZE_Y 40 |
Height of slider. More... | |
#define | SLIDER_PB_SPACING_X 10 |
Spacing between the slider and progress bars. More... | |
#define | PB_SIZE_X SLIDER_SIZE_X |
Width of progress bar. More... | |
#define | PB_SIZE_Y SLIDER_SIZE_Y |
Height of progress bar. More... | |
#define | CHECK_BOX_SPACING_Y 20 |
Spacing above check box to slider and progress bars. More... | |
#define | RADIO_BUTTON_SPACING_Y 10 |
Spacing above each radio button. More... | |
#define | BUTTON_SPACING_Y 20 |
Spacing above the button. More... | |
#define | BUTTON_SIZE_Y 30 |
Height of the button. More... | |
#define APP_BACKGROUND_COLOR GFX_COLOR(220, 220, 220) |
Background color of the application frame.
Referenced by app_widget_launch().
#define BUTTON_SIZE_Y 30 |
Height of the button.
Referenced by app_widget_launch().
#define BUTTON_SPACING_Y 20 |
Spacing above the button.
Referenced by app_widget_launch().
#define CHECK_BOX_SPACING_Y 20 |
Spacing above check box to slider and progress bars.
Referenced by app_widget_launch().
#define COLOR_SCHEME_0_BG GFX_COLOR(255, 255, 255) |
Color scheme 0 background color.
Referenced by app_widget_update_colors().
#define COLOR_SCHEME_0_FG GFX_COLOR(30, 30, 200) |
Color scheme 0 foreground color.
Referenced by app_widget_update_colors().
#define COLOR_SCHEME_1_BG GFX_COLOR(0, 100, 100) |
Color scheme 1 background color.
Referenced by app_widget_update_colors().
#define COLOR_SCHEME_1_FG GFX_COLOR(0, 255, 0) |
Color scheme 1 foreground color.
Referenced by app_widget_update_colors().
#define PB_SIZE_X SLIDER_SIZE_X |
Width of progress bar.
Referenced by app_widget_launch().
#define PB_SIZE_Y SLIDER_SIZE_Y |
Height of progress bar.
Referenced by app_widget_launch().
#define RADIO_BUTTON_SPACING_Y 10 |
Spacing above each radio button.
Referenced by app_widget_launch().
#define SLIDER_PB_SPACING_X 10 |
Spacing between the slider and progress bars.
Referenced by app_widget_launch().
#define SLIDER_POS_Y 10 |
Slider X coordinate, inside frame.
Referenced by app_widget_launch().
#define SLIDER_SIZE_X 120 |
Width of slider.
Referenced by app_widget_launch().
#define SLIDER_SIZE_Y 40 |
Height of slider.
Referenced by app_widget_launch().
#define WIDGET_POS_X 14 |
Leftmost X coordinate in frame for the widgets.
Referenced by app_widget_launch().
#define WIDGET_POS_Y 5 |
Topmost Y coordinate in frame for the widgets.
Referenced by app_widget_launch().
enum command_id |
Command event IDs.
bool app_widget_launch | ( | void | ) |
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.
References APP_BACKGROUND_COLOR, app_widget_update_colors(), win_attributes::area, btn_string, BUTTON_ID, BUTTON_SIZE_Y, BUTTON_SPACING_Y, CHECK_BOX_ID, CHECK_BOX_SPACING_Y, checkbox_string, gfx_bitmap::color, widget_context::color_invert, widget_context::color_scheme, gfx_bitmap::data, widget_context::frame, widget_context::frame_bg, GFX_BITMAP_SOLID, GFX_COLOR_BLACK, membag_alloc(), membag_free(), NULL, win_window::parent, widget_context::pb, PB_SIZE_X, PB_SIZE_Y, win_area::pos, RADIO_BUTTON_1_ID, RADIO_BUTTON_2_ID, RADIO_BUTTON_SPACING_Y, rb1_string, rb2_string, win_area::size, widget_context::slider, SLIDER_ID, SLIDER_PB_SPACING_X, SLIDER_POS_Y, SLIDER_SIZE_X, SLIDER_SIZE_Y, gfx_bitmap::type, widget_frame_command_handler(), WIDGET_POS_X, WIDGET_POS_Y, win_destroy(), win_get_attributes(), win_get_root(), win_inflate_area(), win_show(), wtk_basic_frame_as_child(), wtk_basic_frame_create(), wtk_button_as_child(), wtk_button_create(), wtk_button_size_hint(), wtk_check_box_as_child(), wtk_check_box_create(), wtk_check_box_size_hint(), wtk_progress_bar_as_child(), wtk_progress_bar_create(), WTK_PROGRESS_BAR_HORIZONTAL, wtk_radio_button_as_child(), wtk_radio_button_create(), wtk_radio_button_size_hint(), wtk_radio_group_create(), wtk_slider_as_child(), WTK_SLIDER_CMD_MOVE, WTK_SLIDER_CMD_RELEASE, wtk_slider_create(), WTK_SLIDER_HORIZONTAL, win_point::x, and win_point::y.
Referenced by main().
|
static |
Update colors.
Updates the colors for the progress bar and issues redrawing of the widgets.
widget | Context for widget application |
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, temp, win_redraw(), wtk_progress_bar_as_child(), and wtk_progress_bar_set_colors().
Referenced by app_widget_launch(), and widget_frame_command_handler().
|
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 |
References app_widget_update_colors(), BUTTON_ID, CHECK_BOX_ID, widget_context::color_invert, widget_context::color_scheme, widget_context::pb, RADIO_BUTTON_1_ID, RADIO_BUTTON_2_ID, widget_context::slider, SLIDER_ID, wtk_basic_frame_get_custom_data(), wtk_progress_bar_set_value(), wtk_slider_get_value(), and wtk_slider_set_value().
Referenced by app_widget_launch().
|
static |
Description for the button.
Referenced by app_widget_launch().
|
static |
Description for the check box.
Referenced by app_widget_launch().
|
static |
Description for the first radio button.
Referenced by app_widget_launch().
|
static |
Description for the second radio button.
Referenced by app_widget_launch().
|
static |
Statically allocated context pointer.