Microchip® Advanced Software Framework

services/wtk/example1_widgets/widget_gui.c File Reference

Display demo widget application.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include <string.h>
#include "widget_gui.h"

Data Structures

struct  widget_context
 Widget application context. More...
 

Macros

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...
 

Enumerations

enum  command_id {
  DUMMY_ID,
  ICON_BUTTON_1_ID,
  ICON_BUTTON_2_ID,
  ICON_BUTTON_3_ID,
  BUTTON_PREV_ID,
  BUTTON_NEXT_ID,
  BUTTON_SELECT_ID,
  DUMMY_ID,
  SLIDER_ID,
  CHECK_BOX_ID,
  RADIO_BUTTON_1_ID,
  RADIO_BUTTON_2_ID,
  BUTTON_ID,
  DUMMY_ID,
  SLIDER_ID,
  BUTTON_ID,
  ICON_DUMMY_ID = 0,
  ICON_AUDIO_RECORD_ID,
  ICON_AUDIO_MIC_ID,
  ICON_AUDIO_PLAY_PAUSE_ID,
  ICON_AUDIO_STOP_ID,
  ICON_AUDIO_VOLUME_ID,
  ICON_AUDIO_RET_ID,
  ICON_AUDIO_MAX_ID,
  ICON_DUMMY_ID = 0,
  ICON_LPM_WAIT_ID,
  ICON_LPM_SLEEP_ID,
  ICON_LPM_BACKUP_ID,
  ICON_LPM_RET_ID,
  ICON_LPM_MAX
}
 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_contextwidget_ctx
 Statically allocated context pointer. More...
 

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.

See Also
wtk_basic_frame_command_handler_t
Parameters
framePointer to the application frame
command_dataCommand event ID
Returns
True if exiting, to destroy the window

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().