Analog and digital clock application
[Applications]

This application will display an analog and digital clock on the screen. More...

Collaboration diagram for Analog and digital clock application:

Data Structures

struct  app_clock
 Context for the clock application. More...

Enumerations

enum  app_clock_button_ids { BUTTON_EXIT_ID = 1 }
 

Event command ID for the application widgets.

More...

Functions

static void app_clock_frame_draw_handler (struct win_window *win, const struct win_clip_region *clip)
 Frame draw handler handling draw events.
static bool app_clock_frame_command_handler (struct wtk_basic_frame *frame, win_command_t command_data)
 Frame command handler handling the button events.
void app_clock_launch (struct workqueue_task *task)
 Launcher for the clock application.

Variables

static struct app_clockthe_clock_app
 Pointer to the clock application context.

Clock color scheme.



#define COLOR_TEXT   GFX_COLOR(255, 255, 255)
 Color on text strings.
#define COLOR_BACKGROUND   GFX_COLOR(0, 0, 0)
 Background color.
#define COLOR_BORDER   GFX_COLOR(150, 150, 150)
 Color on frame border.

Clock frame size and layout.



#define FRAME_PADDING   40
 Padding in pixels from screen border to frame.
#define FRAME_HEIGHT   (gfx_get_height() - (2 * FRAME_PADDING))
 Height of frame.
#define FRAME_WIDTH   (gfx_get_width() - (2 * FRAME_PADDING))
 Width of frame.
#define FRAME_POS_X   FRAME_PADDING
 X position of top left corner.
#define FRAME_POS_Y   FRAME_PADDING
 Y position of top left corner.

Clock text appearance.



#define TEXT_INDENT   15
 Number of pixels to indent a string.
#define TEXT_PADDING_NEWLINE   4
 Number of pixels to pad after a string newline.

Detailed Description

This application will display an analog and digital clock on the screen.

To adjust the clock, touch the screen continuously for three seconds to enter adjustment mode.

Note:
The clock application has not been implemented, hence a pop-up window is shown instead, informing the user about this missing application.
Todo:
Implement the clock application and replace the dummy pop-up window.

Define Documentation

#define COLOR_BACKGROUND   GFX_COLOR(0, 0, 0)

Background color.

Definition at line 64 of file app_clock.c.

Referenced by slide_launch_helper().

#define COLOR_BORDER   GFX_COLOR(150, 150, 150)

Color on frame border.

Definition at line 66 of file app_clock.c.

Referenced by app_clock_frame_draw_handler().

#define COLOR_TEXT   GFX_COLOR(255, 255, 255)
#define FRAME_HEIGHT   (gfx_get_height() - (2 * FRAME_PADDING))

Height of frame.

Definition at line 79 of file app_clock.c.

Referenced by app_clock_frame_draw_handler().

#define FRAME_PADDING   40

Padding in pixels from screen border to frame.

Definition at line 77 of file app_clock.c.

#define FRAME_POS_X   FRAME_PADDING

X position of top left corner.

Definition at line 83 of file app_clock.c.

Referenced by app_clock_frame_draw_handler().

#define FRAME_POS_Y   FRAME_PADDING

Y position of top left corner.

Definition at line 85 of file app_clock.c.

Referenced by app_clock_frame_draw_handler().

#define FRAME_WIDTH   (gfx_get_width() - (2 * FRAME_PADDING))

Width of frame.

Definition at line 81 of file app_clock.c.

Referenced by app_clock_frame_draw_handler().

#define TEXT_INDENT   15
#define TEXT_PADDING_NEWLINE   4

Enumeration Type Documentation

Event command ID for the application widgets.

Enumerator:
BUTTON_EXIT_ID 

Event command ID for the exit button.

Definition at line 105 of file app_clock.c.


Function Documentation

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

Frame command handler handling the button events.

See also:
wtk_basic_frame_command_handler_t
Parameters:
frame Pointer to the basic frame object
command_data Command data provided with the event, holds button ID
Returns:
true when application is exiting, false otherwise

Definition at line 185 of file app_clock.c.

References app_desktop_restart(), BUTTON_EXIT_ID, membag_free(), memcpy(), app_clock::prev_sysfont, and sysfont.

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

Frame draw handler handling draw events.

This function will draw the contents of the frame to the screen.

See also:
wtk_basic_frame_draw_handler_t

Definition at line 138 of file app_clock.c.

References COLOR_BORDER, COLOR_TEXT, FRAME_HEIGHT, FRAME_POS_X, FRAME_POS_Y, FRAME_WIDTH, GFX_COLOR_TRANSPARENT, gfx_draw_rect, gfx_draw_string(), gfx_font_get_height(), sysfont, TEXT_INDENT, and TEXT_PADDING_NEWLINE.

void app_clock_launch ( struct workqueue_task task  ) 

Launcher for the clock application.

Parameters:
task Workqueue task to use for the application's worker functions.

Variable Documentation

struct app_clock* the_clock_app [static]

Pointer to the clock application context.

Note:
This pointer is statically allocated, but the context itself is only allocated when the application is launched, and then destroyed upon exit to conserve memory.

Definition at line 129 of file app_clock.c.

Generated on Thu Apr 29 14:09:59 2010 for display-demo by  doxygen 1.6.3