Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Examples

CTK graphical user interface


Detailed Description

The Contiki Toolkit (CTK) provides the graphical user interface for the Contiki system.


Files

file  ctk.h
 CTK header file.
file  ctk.c
 The Contiki Toolkit CTK, the Contiki GUI.
file  ctk-draw.h
 CTK screen drawing module interface, ctk-draw.

Modules

 CTK application functions
 The CTK functions used by an application program.
 CTK events
 CTK device driver functions
 The CTK device driver functions are divided into two modules, the ctk-draw module and the ctk-arch module.

Defines

#define CTK_WIDGET_FLAG_INITIALIZER(x)
#define CTK_MODE_NORMAL   0
#define CTK_MODE_WINDOWMOVE   1
#define CTK_MODE_SCREENSAVER   2
#define CTK_MODE_EXTERNAL   3
#define ctk_window_move(w, xpos, ypos)   do { (w)->x=xpos; (w)->y=ypos; } while(0)
#define ctk_window_isopen(w)   ((w)->next != NULL)
#define NULL   (void *)0
#define REDRAW_NONE   0
#define REDRAW_ALL   1
#define REDRAW_FOCUS   2
#define REDRAW_WIDGETS   4
#define REDRAW_MENUS   8
#define REDRAW_MENUPART   16
#define MAX_REDRAWWIDGETS   4
#define ICONX_START   (width - 6)
#define ICONY_START   (height - 7)
#define ICONX_DELTA   -16
#define ICONY_DELTA   -5
#define ICONY_MAX   height
#define ICONY_MIN   0

Functions

void ctk_restore (void)
void ctk_mode_set (unsigned char mode)
 Sets the current CTK mode.
unsigned char ctk_mode_get (void)
 Retrieves the current CTK mode.
void ctk_window_new (struct ctk_window *window, unsigned char w, unsigned char h, char *title)
 Create a new window.
void ctk_window_clear (struct ctk_window *w)
 Remove all widgets from a window.
void ctk_window_close (struct ctk_window *w)
 Close a window if it is open.
void ctk_window_redraw (struct ctk_window *w)
 Redraw a window.
void ctk_dialog_open (struct ctk_window *d)
 Open a dialog box.
void ctk_dialog_close (void)
 Close the dialog box, if one is open.
void ctk_menu_add (struct ctk_menu *menu)
 Add a menu to the menu bar.
void ctk_menu_remove (struct ctk_menu *menu)
 Remove a menu from the menu bar.

Variables

unsigned short ctk_screensaver_timeout = (5*60)


Function Documentation

void ctk_dialog_open struct ctk_window d  ) 
 

Open a dialog box.

Parameters:
d The dialog to be opened.

Definition at line 313 of file ctk.c.

References REDRAW_FOCUS.

Referenced by PROCESS_THREAD(), and program_handler_load().

void ctk_menu_add struct ctk_menu menu  ) 
 

Add a menu to the menu bar.

Parameters:
menu The menu to be added.
Note:
Do not call this function multiple times for the same menu, as no check is made to see if the menu already is in the menu bar.

Definition at line 488 of file ctk.c.

References ctk_menus::menus, ctk_menu::next, NULL, and REDRAW_MENUPART.

Referenced by PROCESS_THREAD().

void ctk_menu_remove struct ctk_menu menu  ) 
 

Remove a menu from the menu bar.

Parameters:
menu The menu to be removed.

Definition at line 516 of file ctk.c.

References ctk_menus::menus, ctk_menu::next, NULL, and REDRAW_MENUPART.

unsigned char ctk_mode_get void   ) 
 

Retrieves the current CTK mode.

Returns:
The current CTK mode.

Definition at line 275 of file ctk.c.

void ctk_mode_set unsigned char  m  ) 
 

Sets the current CTK mode.

The CTK mode can be either CTK_MODE_NORMAL, CTK_MODE_SCREENSAVER or CTK_MODE_EXTERNAL. CTK_MODE_NORMAL is the normal mode, in which keypresses and mouse pointer movements are processed and the screen is redrawn. In CTK_MODE_SCREENSAVER, no screen redraws are performed and the first key press or pointer movement will cause the ctk_signal_screensaver_stop to be emitted. In the CTK_MODE_EXTERNAL mode, key presses and pointer movements are ignored and no screen redraws are made.

Parameters:
m The mode.

Definition at line 264 of file ctk.c.

void ctk_window_clear struct ctk_window w  ) 
 

Remove all widgets from a window.

Parameters:
w The window to be cleared.

Definition at line 471 of file ctk.c.

References ctk_window::active, ctk_window::focused, ctk_window::inactive, and NULL.

void ctk_window_close struct ctk_window w  ) 
 

Close a window if it is open.

If the window is not open, this function does nothing.

Parameters:
w The window to be closed.

Definition at line 387 of file ctk.c.

References ctk_window::next, NULL, ctk_window::prev, and REDRAW_ALL.

Referenced by PROCESS_THREAD().

void ctk_window_new struct ctk_window window,
unsigned char  w,
unsigned char  h,
char *  title
 

Create a new window.

Creates a new window. The memory for the window structure must already be allocated by the caller, and is usually done with a static declaration.

This function sets up the internal structure of the ctk_window struct and creates the move and close buttons, but it does not open the window. The window must be explicitly opened by calling the ctk_window_open() function.

Parameters:
window The window to be created.
w The width of the new window.
h The height of the new window.
title The title of the new window.

Definition at line 707 of file ctk.c.

void ctk_window_redraw struct ctk_window w  ) 
 

Redraw a window.

This function redraws the window, but only if it is the foremost one on the desktop.

Parameters:
w The window to be redrawn.

Definition at line 628 of file ctk.c.

References ctk_draw_dialog(), ctk_draw_window(), CTK_FOCUS_WINDOW, CTK_MODE_NORMAL, NULL, and ctk_menus::open.

Referenced by PROCESS_THREAD().


Generated on Thu Jun 22 17:45:43 2006 for Contiki 2.x by  doxygen 1.4.4