Widget training application
[Training Applications]

This application is made as a training to introduce users to some of the available widgets in the Widget toolkit. More...

Collaboration diagram for Widget training application:

Enumerations

enum  app_widget_ids { SLIDER_ID = 1, BUTTON_ID }
 

Event command ID for the application widgets.

More...

Functions

static bool widget_frame_command_handler (struct wtk_basic_frame *frame, win_command_t command_data)
 Frame command events handler.
static void sub_frame_draw_handler (struct win_window *win, struct win_clip_region const *clip)
 Frame draw event handler.
void app_widget_launch (struct workqueue_task *task)
 Setup widget demo.

Static text strings



static const char * demo_string = "Demonstrating widgets"
 Description for label.

Static variables



static struct wtk_basic_frameframe
 Pointer to frame for application.
static struct wtk_sliderslider
 Pointer to slider.
static struct wtk_progress_barprogress_bar
 Pointer to progress bar.
static struct gfx_bitmap frame_background
 Frame background bitmap.
static uint8_t counter
 Counter for button.
static struct wtk_basic_framesub_frame
 Pointer to the sub-frame.
static struct gfx_bitmap sub_frame_background
 Sub-frame background bitmap.

Color scheme



#define APP_BACKGROUND_COLOR   GFX_COLOR(50, 50, 50)
 Background color for application.

Widget sizes and positions



#define LABEL_POS_X   10
 Label position on top of display.
#define LABEL_POS_Y   10
 Label position on top of display.
#define SLIDER_POS_X   10
 Slider position.
#define SLIDER_POS_Y   60
 Slider position.
#define SLIDER_SIZE_X   80
 Slider size on display.
#define SLIDER_SIZE_Y   40
 Slider size on display.
#define SLIDER_PB_SPACING_X   10
 Spacing from slider to progress bar.
#define PB_SIZE_X   SLIDER_SIZE_X
 Slider progress bar on display.
#define PB_SIZE_Y   SLIDER_SIZE_Y
 Slider progress bar on display.

Widget configurations



#define SLIDER_MAX_VALUE   100
 Max value for slider.

Detailed Description

This application is made as a training to introduce users to some of the available widgets in the Widget toolkit.

Initially this application will draw a basic frame filling the entire screen and add a slider and a progress bar on the upper half of the screen.

The users task is then to add a sub-frame and a button. The button should increment a counter presented in the sub-frame each time the button is pressed.


Define Documentation

#define APP_BACKGROUND_COLOR   GFX_COLOR(50, 50, 50)

Background color for application.

Definition at line 81 of file app_widget.c.

#define LABEL_POS_X   10

Label position on top of display.

Definition at line 92 of file app_widget.c.

#define LABEL_POS_Y   10

Label position on top of display.

Definition at line 94 of file app_widget.c.

#define PB_SIZE_X   SLIDER_SIZE_X

Slider progress bar on display.

Definition at line 108 of file app_widget.c.

#define PB_SIZE_Y   SLIDER_SIZE_Y

Slider progress bar on display.

Definition at line 110 of file app_widget.c.

#define SLIDER_MAX_VALUE   100

Max value for slider.

Definition at line 121 of file app_widget.c.

#define SLIDER_PB_SPACING_X   10

Spacing from slider to progress bar.

Definition at line 106 of file app_widget.c.

#define SLIDER_POS_X   10

Slider position.

Definition at line 97 of file app_widget.c.

#define SLIDER_POS_Y   60

Slider position.

Definition at line 99 of file app_widget.c.

#define SLIDER_SIZE_X   80

Slider size on display.

Definition at line 101 of file app_widget.c.

#define SLIDER_SIZE_Y   40

Slider size on display.

Definition at line 103 of file app_widget.c.


Enumeration Type Documentation

Event command ID for the application widgets.

Note:
The command IDs cannot be 0, since this value is reserved for no command event callback for certain widgets.
Enumerator:
SLIDER_ID 

Event command ID for the slider.

BUTTON_ID 

Event command ID for the button.

Definition at line 67 of file app_widget.c.


Function Documentation

void app_widget_launch ( struct workqueue_task task  ) 

Setup widget demo.

This function launches the widget demo.

Parameters:
task Workqueue task used to start the application.

Todo:
Add code to set up button here.
Todo:
Add code to set up basic frame here.

static void sub_frame_draw_handler ( struct win_window win,
struct win_clip_region const *  clip 
) [static]

Frame draw event handler.

This function will draw the contents of the sub-frame.

See also:
wtk_basic_frame_draw_handler_t

Todo:
Add code here to draw text on screen using the gfx_draw_string() function.

Definition at line 194 of file app_widget.c.

References counter, GFX_COLOR, GFX_COLOR_TRANSPARENT, gfx_draw_string(), win_clip_region::origin, snprintf(), and sysfont.

static bool widget_frame_command_handler ( struct wtk_basic_frame frame,
win_command_t  command_data 
) [static]

Frame command events handler.

This function handles the command events generated by the widgets.

See also:
wtk_basic_frame_command_handler_t

Todo:
Add code here to handle button press.

Definition at line 166 of file app_widget.c.

References BUTTON_ID, counter, SLIDER_ID, win_redraw(), wtk_basic_frame_as_child(), wtk_progress_bar_set_value(), and wtk_slider_get_value().


Variable Documentation

uint8_t counter [static]

Counter for button.

Definition at line 151 of file app_widget.c.

Referenced by sub_frame_draw_handler(), and widget_frame_command_handler().

const char* demo_string = "Demonstrating widgets" [static]

Description for label.

Definition at line 132 of file app_widget.c.

struct wtk_basic_frame* frame [static]

Pointer to frame for application.

Definition at line 143 of file app_widget.c.

Referenced by wtk_basic_frame_handler(), wtk_frame_create(), and wtk_frame_handler().

struct gfx_bitmap frame_background [static]

Frame background bitmap.

Definition at line 149 of file app_widget.c.

struct wtk_progress_bar* progress_bar [static]

Pointer to progress bar.

Definition at line 147 of file app_widget.c.

struct wtk_slider* slider [static]

Pointer to slider.

Definition at line 145 of file app_widget.c.

Referenced by wtk_slider_create(), and wtk_slider_handler().

struct wtk_basic_frame* sub_frame [static]

Pointer to the sub-frame.

Definition at line 153 of file app_widget.c.

Sub-frame background bitmap.

Definition at line 155 of file app_widget.c.

Generated on Thu Apr 29 15:18:22 2010 for display-training by  doxygen 1.6.3