Atmel Software Framework

app_widget.c File Reference

Widget ToolKit training widget.

Copyright (C) 2014-2015 Atmel Corporation. All rights reserved.

#include <asf.h>
#include <stdio.h>
#include "app_widget.h"

Macros

Color scheme
#define APP_BACKGROUND_COLOR   GFX_COLOR(50, 50, 50)
 Background color for application. More...
 
Widget sizes and positions
#define LABEL_POS_X   10
 Label position on top of display. More...
 
#define LABEL_POS_Y   10
 Label position on top of display. More...
 
#define SLIDER_POS_X   10
 Slider position. More...
 
#define SLIDER_POS_Y   60
 Slider position. More...
 
#define SLIDER_SIZE_X   80
 Slider size on display. More...
 
#define SLIDER_SIZE_Y   40
 Slider size on display. More...
 
#define SLIDER_PB_SPACING_X   10
 Spacing from slider to progress bar. More...
 
#define PB_SIZE_X   SLIDER_SIZE_X
 Slider progress bar on display. More...
 
#define PB_SIZE_Y   SLIDER_SIZE_Y
 Slider progress bar on display. More...
 
Widget configurations
#define SLIDER_MAX_VALUE   100
 Max value for slider. More...
 

Enumerations

enum  app_widget_ids {
  SLIDER_ID = 1,
  BUTTON_ID
}
 Event command ID for the application widgets. More...
 

Functions

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

Variables

Static text strings
static const char * demo_string = "Demonstrating widgets"
 Description for label. More...
 
Static variables
static struct wtk_basic_framemain_frame
 Pointer to frame for application. More...
 
static struct wtk_sliderslider
 Pointer to slider. More...
 
static struct wtk_progress_barprogress_bar
 Pointer to progress bar. More...
 
static struct gfx_bitmap frame_background
 Frame background bitmap. More...
 
static uint8_t counter
 Counter for button. More...
 
static struct wtk_basic_framesub_frame
 Pointer to the sub-frame. More...
 
static struct gfx_bitmap sub_frame_background
 Sub-frame background bitmap. More...
 

#define APP_BACKGROUND_COLOR   GFX_COLOR(50, 50, 50)

Background color for application.

Referenced by app_widget_launch().

#define LABEL_POS_X   10

Label position on top of display.

Referenced by app_widget_launch().

#define LABEL_POS_Y   10

Label position on top of display.

Referenced by app_widget_launch().

#define PB_SIZE_X   SLIDER_SIZE_X

Slider progress bar on display.

Referenced by app_widget_launch().

#define PB_SIZE_Y   SLIDER_SIZE_Y

Slider progress bar on display.

Referenced by app_widget_launch().

#define SLIDER_MAX_VALUE   100

Max value for slider.

Referenced by app_widget_launch().

#define SLIDER_PB_SPACING_X   10

Spacing from slider to progress bar.

Referenced by app_widget_launch().

#define SLIDER_POS_X   10

Slider position.

Referenced by app_widget_launch().

#define SLIDER_POS_Y   60

Slider position.

Referenced by app_widget_launch().

#define SLIDER_SIZE_X   80

Slider size on display.

Referenced by app_widget_launch().

#define SLIDER_SIZE_Y   40

Slider size on display.

Referenced by app_widget_launch().

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.

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.

References buffer, and counter.

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.

References BUTTON_ID, SLIDER_ID, wtk_progress_bar_set_value(), and wtk_slider_get_value().

Referenced by app_widget_launch().

uint8_t counter
static

Counter for button.

Referenced by classb_wdt_test(), main(), and sub_frame_draw_handler().

const char* demo_string = "Demonstrating widgets"
static

Description for label.

Referenced by app_widget_launch().

struct gfx_bitmap frame_background
static

Frame background bitmap.

Referenced by app_widget_launch().

struct wtk_basic_frame* main_frame
static

Pointer to frame for application.

struct wtk_progress_bar* progress_bar
static

Pointer to progress bar.

struct wtk_slider* slider
static

Pointer to slider.

Referenced by wtk_slider_create(), and wtk_slider_handler().

struct wtk_basic_frame* sub_frame
static

Pointer to the sub-frame.

struct gfx_bitmap sub_frame_background
static

Sub-frame background bitmap.