Microchip® Advanced Software Framework

widget_scr_settings_date.c File Reference

Date settings widget for SAM toolkit demo application.

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

#include "demo.h"
#include <asf.h>
#include "string.h"
#include "bitmaps.h"

Data Structures

struct  widget_context_settings_date
 Widget application context for date settings. More...
 

Macros

#define TOTAL_NUM_DATE_LABLE   6
 Total number of date settings widget labels. More...
 

Enumerations

enum  date_command_id {
  ICON_DUMMY_ID = 0,
  ICON_SETTINGS_DATE_YEAR_UP_ID,
  ICON_SETTINGS_DATE_MONTH_UP_ID,
  ICON_SETTINGS_DATE_DAY_UP_ID,
  ICON_SETTINGS_DATE_YEAR_DOWN_ID,
  ICON_SETTINGS_DATE_MONTH_DOWN_ID,
  ICON_SETTINGS_DATE_DAY_DOWN_ID,
  ICON_SETTINGS_DATE_RET_ID,
  ICON_SETTINGS_DATE_MAX_ID
}
 Command event IDs for date settings widget. More...
 
enum  time_command_id {
  ICON_DUMMY_ID = 0,
  ICON_SETTINGS_TIME_HOUR_UP_ID,
  ICON_SETTINGS_TIME_MIN_UP_ID,
  ICON_SETTINGS_TIME_SEC_UP_ID,
  ICON_SETTINGS_TIME_HOUR_DOWN_ID,
  ICON_SETTINGS_TIME_MIN_DOWN_ID,
  ICON_SETTINGS_TIME_SEC_DOWN_ID,
  ICON_SETTINGS_TIME_RET_ID,
  ICON_SETTINGS_TIME_MAX_ID,
  LABEL_YEAR_ID = 0,
  LABEL_MONTH_ID,
  LABEL_DATE_ID
}
 Label widget IDs. More...
 

Functions

static void app_widget_launch_settings_date (void)
 Launch date settings widget. More...
 
void app_widget_settings_date_on (uint8_t on)
 Enable/disable date settings widget. More...
 
static bool widget_settings_date_setup_command_handler (struct wtk_basic_frame *frame, win_command_t command_data)
 Frame handler for the date settings widget. More...
 

Variables

static char demo_func_date_name [] = "Set Date"
 Function name. More...
 
static char str_day [3]
 String array for day. More...
 
static char str_month [3]
 String array for month. More...
 
static char str_year [5]
 String array for year. More...
 
static struct
widget_context_settings_date
widget_ctx_settings_date
 Statically allocated context pointer. More...
 
static struct gfx_bitmap win_root_logo_icon
 Root logo bitmap. More...
 
static struct gfx_bitmap win_settings_date_date_down_icon
 Date down icon bitmap. More...
 
static struct gfx_bitmap win_settings_date_date_up_icon
 Date up icon bitmap. More...
 
static struct gfx_bitmap win_settings_date_month_down_icon
 Month down icon bitmap. More...
 
static struct gfx_bitmap win_settings_date_month_up_icon
 Month up icon bitmap. More...
 
static struct gfx_bitmap win_settings_date_ret_icon
 Return icon bitmap. More...
 
static struct gfx_bitmap win_settings_date_year_down_icon
 Year down icon bitmap. More...
 
static struct gfx_bitmap win_settings_date_year_up_icon
 Year up icon bitmap. More...
 

#define TOTAL_NUM_DATE_LABLE   6

Total number of date settings widget labels.

Command event IDs for date settings widget.

Enumerator
ICON_DUMMY_ID 

Dummy icon.

ICON_SETTINGS_DATE_YEAR_UP_ID 

Command event ID for year up icon.

ICON_SETTINGS_DATE_MONTH_UP_ID 

Command event ID for month up icon.

ICON_SETTINGS_DATE_DAY_UP_ID 

Command event ID for date up icon.

ICON_SETTINGS_DATE_YEAR_DOWN_ID 

Command event ID for year down icon.

ICON_SETTINGS_DATE_MONTH_DOWN_ID 

Command event ID for month down icon.

ICON_SETTINGS_DATE_DAY_DOWN_ID 

Command event ID for date down icon.

ICON_SETTINGS_DATE_RET_ID 

Command event ID for screen return icon.

ICON_SETTINGS_DATE_MAX_ID 

Max date settings icon number.

Label widget IDs.

Enumerator
ICON_DUMMY_ID 

Dummy icon.

ICON_SETTINGS_TIME_HOUR_UP_ID 

Command event ID for hour up icon button.

ICON_SETTINGS_TIME_MIN_UP_ID 

Command event ID for minutes up icon button.

ICON_SETTINGS_TIME_SEC_UP_ID 

Command event ID for second up icon button.

ICON_SETTINGS_TIME_HOUR_DOWN_ID 

Command event ID for hour down icon button.

ICON_SETTINGS_TIME_MIN_DOWN_ID 

Command event ID for minutes down icon button.

ICON_SETTINGS_TIME_SEC_DOWN_ID 

Command event ID for second down icon button.

ICON_SETTINGS_TIME_RET_ID 

Command event ID for second icon button.

ICON_SETTINGS_TIME_MAX_ID 

Max time settings icon number.

LABEL_YEAR_ID 

Year label ID.

LABEL_MONTH_ID 

Month label ID.

LABEL_DATE_ID 

Date label ID.

static void app_widget_launch_settings_date ( void  )
static

Launch date settings widget.

Allocates memory for the widget context, and creates all widgets that make up its interface. If memory allocation or widget creation fails, the application exits immediately.

References win_attributes::area, gfx_bitmap::color, gfx_bitmap::data, demo_param_t::day, demo_board_name, demo_func_date_name, widget_context_settings_date::frame, widget_context_settings_date::frame_bg, g_demo_parameters, GFX_BITMAP_SOLID, GFX_COLOR, widget_context_settings_date::icon_group, ICON_SETTINGS_DATE_DAY_DOWN_ID, ICON_SETTINGS_DATE_DAY_UP_ID, ICON_SETTINGS_DATE_MONTH_DOWN_ID, ICON_SETTINGS_DATE_MONTH_UP_ID, ICON_SETTINGS_DATE_RET_ID, ICON_SETTINGS_DATE_YEAR_DOWN_ID, ICON_SETTINGS_DATE_YEAR_UP_ID, widget_context_settings_date::icons, LABEL_DATE_ID, LABEL_MONTH_ID, LABEL_YEAR_ID, widget_context_settings_date::lbl_board_name, widget_context_settings_date::lbl_func_name, widget_context_settings_date::lbl_indication, widget_context_settings_date::logo_frame, membag_alloc(), membag_free(), demo_param_t::month, NULL, win_window::parent, win_area::pos, win_area::size, str_day, str_month, str_year, gfx_bitmap::type, widget_settings_date_setup_command_handler(), win_destroy(), win_get_attributes(), win_get_root(), win_show(), wtk_basic_frame_as_child(), wtk_basic_frame_create(), wtk_icon_button_as_child(), wtk_icon_button_create(), wtk_icon_button_size_hint(), wtk_icon_group_create(), wtk_label_as_child(), wtk_label_create(), wtk_label_size_hint(), win_point::x, win_point::y, and demo_param_t::year.

Referenced by app_widget_settings_date_on().

void app_widget_settings_date_on ( uint8_t  on)

Enable/disable date settings widget.

Parameters
onTurn on/off date settings widget.

References app_widget_launch_settings_date(), widget_context_settings_date::frame, win_destroy(), and wtk_basic_frame_as_child().

Referenced by widget_settings_date_setup_command_handler(), and widget_settings_frame_command_handler().

static bool widget_settings_date_setup_command_handler ( struct wtk_basic_frame frame,
win_command_t  command_data 
)
static

char demo_func_date_name[] = "Set Date"
static

Function name.

Referenced by app_widget_launch_settings_date().

char str_day[3]
static
char str_month[3]
static
char str_year[5]
static
struct widget_context_settings_date* widget_ctx_settings_date
static

Statically allocated context pointer.

struct gfx_bitmap win_root_logo_icon
static
Initial value:
= {
.width = 87, .height = 40,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_LOGO_ATMEL
}
Definition: gfx_generic.h:68
#define DEMO_BMP_LOGO_ATMEL
Definition: bitmaps.h:43

Root logo bitmap.

struct gfx_bitmap win_settings_date_date_down_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_DOWN
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_DOWN
Definition: bitmaps.h:81

Date down icon bitmap.

struct gfx_bitmap win_settings_date_date_up_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_UP
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_UP
Definition: bitmaps.h:80

Date up icon bitmap.

struct gfx_bitmap win_settings_date_month_down_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_DOWN
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_DOWN
Definition: bitmaps.h:81

Month down icon bitmap.

struct gfx_bitmap win_settings_date_month_up_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_UP
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_UP
Definition: bitmaps.h:80

Month up icon bitmap.

struct gfx_bitmap win_settings_date_ret_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_BACK
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_BACK
Definition: bitmaps.h:44

Return icon bitmap.

struct gfx_bitmap win_settings_date_year_down_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_DOWN
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_DOWN
Definition: bitmaps.h:81

Year down icon bitmap.

struct gfx_bitmap win_settings_date_year_up_icon
static
Initial value:
= {
.width = 48, .height = 48,
.type = GFX_BITMAP_EXT,
.data.custom = DEMO_BMP_BTN_UP
}
Definition: gfx_generic.h:68
#define DEMO_BMP_BTN_UP
Definition: bitmaps.h:80

Year up icon bitmap.