Contiki 3.x
|
The CTK device driver functions are divided into two modules, the ctk-draw module and the ctk-arch module. More...
Data Structures | |
struct | ctk_widget |
The generic CTK widget structure that contains all other widget structures. More... | |
struct | ctk_window |
Representation of a CTK window. More... | |
struct | ctk_menuitem |
Representation of an individual menu item. More... | |
struct | ctk_menu |
Representation of an individual menu. More... | |
struct | ctk_menus |
Representation of the menu bar. More... | |
Macros | |
#define | CTK_WIDGET_SEPARATOR 1 |
Widget number: The CTK separator widget. More... | |
#define | CTK_WIDGET_LABEL 2 |
Widget number: The CTK label widget. More... | |
#define | CTK_WIDGET_BUTTON 3 |
Widget number: The CTK button widget. More... | |
#define | CTK_WIDGET_HYPERLINK 4 |
Widget number: The CTK hyperlink widget. More... | |
#define | CTK_WIDGET_TEXTENTRY 5 |
Widget number: The CTK textentry widget. More... | |
#define | CTK_WIDGET_BITMAP 6 |
Widget number: The CTK bitmap widget. More... | |
#define | CTK_WIDGET_ICON 7 |
Widget number: The CTK icon widget. More... | |
#define | CTK_FOCUS_NONE 0 |
Widget focus flag: no focus. More... | |
#define | CTK_FOCUS_WIDGET 1 |
Widget focus flag: widget has focus. More... | |
#define | CTK_FOCUS_WINDOW 2 |
Widget focus flag: widget's window is the foremost one. More... | |
#define | CTK_FOCUS_DIALOG 4 |
Widget focus flag: widget is in a dialog. More... | |
Typedefs | |
typedef char | ctk_arch_key_t |
The keyboard character type of the system. More... | |
Functions | |
void | ctk_draw_init (void) |
The initialization function. More... | |
void | ctk_draw_clear (unsigned char clipy1, unsigned char clipy2) |
Clear the screen between the clip bounds. More... | |
void | ctk_draw_clear_window (struct ctk_window *window, unsigned char focus, unsigned char clipy1, unsigned char clipy2) |
Draw the window background. More... | |
void | ctk_draw_window (struct ctk_window *window, unsigned char focus, unsigned char clipy1, unsigned char clipy2, unsigned char draw_borders) |
Draw a window onto the screen. More... | |
void | ctk_draw_dialog (struct ctk_window *dialog) |
Draw a dialog onto the screen. More... | |
void | ctk_draw_widget (struct ctk_widget *w, unsigned char focus, unsigned char clipy1, unsigned char clipy2) |
Draw a widget on a window. More... | |
ctk_arch_key_t | ctk_arch_getkey (void) |
Get a keypress from the keyboard input queue. More... | |
unsigned char | ctk_arch_keyavail (void) |
Check if there is a keypress in the keyboard input queue. More... | |
The CTK device driver functions are divided into two modules, the ctk-draw module and the ctk-arch module.
The purpose of the ctk-arch and the ctk-draw modules is to act as an interface between the CTK and the actual hardware of the system on which Contiki is run. The ctk-arch takes care of the keyboard input from the user, and the ctk-draw is responsible for drawing the CTK desktop, windows and user interface widgets onto the actual screen.
More information about the ctk-draw and the ctk-arch modules can be found in the sections The ctk-draw module and The ctk-arch module.
#define CTK_FOCUS_DIALOG 4 |
#define CTK_FOCUS_WIDGET 1 |
Widget focus flag: widget has focus.
Definition at line 988 of file ctk.h.
Referenced by ctk_draw_widget().
#define CTK_FOCUS_WINDOW 2 |
Widget focus flag: widget's window is the foremost one.
Definition at line 990 of file ctk.h.
Referenced by ctk_window_redraw().
#define CTK_WIDGET_BITMAP 6 |
#define CTK_WIDGET_BUTTON 3 |
#define CTK_WIDGET_HYPERLINK 4 |
#define CTK_WIDGET_LABEL 2 |
Widget number: The CTK label widget.
Definition at line 66 of file ctk.h.
Referenced by ctk_widget_add().
#define CTK_WIDGET_SEPARATOR 1 |
Widget number: The CTK separator widget.
Definition at line 64 of file ctk.h.
Referenced by ctk_widget_add().
#define CTK_WIDGET_TEXTENTRY 5 |
typedef char ctk_arch_key_t |
The keyboard character type of the system.
The ctk_arch_key_t is usually typedef'd to the char type, but some systems (such as VNC) have a 16-bit key type.
Definition at line 40 of file ctk-conio.h.
ctk_arch_key_t ctk_arch_getkey | ( | void | ) |
Get a keypress from the keyboard input queue.
This function will remove the first keypress in the keyboard input queue and return it. If the keyboard queue is empty, the return value is undefined. This function is intended to be used only after the ctk_arch_keyavail() function has returned non-zero.
Definition at line 452 of file ctk-curses.c.
unsigned char ctk_arch_keyavail | ( | void | ) |
Check if there is a keypress in the keyboard input queue.
Definition at line 464 of file ctk-curses.c.
void ctk_draw_clear | ( | unsigned char | clipy1, |
unsigned char | clipy2 | ||
) |
Clear the screen between the clip bounds.
This function should clear the screen between the y coordinates "clipy1" and "clipy2", including the line at y coordinate "clipy1", but not the line at y coordinate "clipy2".
clipy1 | The lower y coordinate of the clip region. |
clipy2 | The upper y coordinate of the clip region. |
Definition at line 441 of file ctk-conio.c.
Referenced by ctk_draw_init().
void ctk_draw_clear_window | ( | struct ctk_window * | window, |
unsigned char | focus, | ||
unsigned char | clipy1, | ||
unsigned char | clipy2 | ||
) |
Draw the window background.
This function will be called by the CTK before a window will be completely redrawn.The function is supposed to draw the window background, excluding window borders as these should be drawn by the function that actually draws the window, between "clipy1" and "clipy2".
window | The window for which the background should be drawn. |
focus | The focus of the window, either CTK_FOCUS_NONE for a background window, or CTK_FOCUS_WINDOW for the foreground window. |
clipy1 | The lower y coordinate of the clip region. |
clipy2 | The upper y coordinate of the clip region. |
Definition at line 265 of file ctk-conio.c.
References ctk_window::h, and ctk_window::w.
void ctk_draw_dialog | ( | struct ctk_window * | dialog | ) |
Draw a dialog onto the screen.
In CTK, a dialog is similar to a window, with the only exception being that they are drawn in a different style. Also, since dialogs always are drawn on top of everything else, they do not need to be drawn within any special boundaries.
dialog | The dialog that is to be drawn. |
Referenced by ctk_window_redraw().
void ctk_draw_init | ( | void | ) |
The initialization function.
This function is supposed to get the screen ready for drawing, and may be called at more than one time during the operation of the system.
Definition at line 74 of file ctk-conio.c.
References ctk_draw_clear().
void ctk_draw_widget | ( | struct ctk_widget * | w, |
unsigned char | focus, | ||
unsigned char | clipy1, | ||
unsigned char | clipy2 | ||
) |
Draw a widget on a window.
This function is used for drawing a CTK widgets onto the screem is likely to be the most complex function in the ctk-draw module. Still, it is straightforward to implement as it can be written in an incremental fashion, starting with a single widget type and adding more widget types, one at a time.
The ctk-draw module may exploit how the CTK focus constants are defined in order to use a look-up table for the colors. The CTK focus constants are defined in the file ctk/ctk.h as follows:
This gives the following table:
w | The widget to be drawn. |
focus | The focus of the widget. |
clipy1 | The lower y coordinate of the clip region. |
clipy2 | The upper y coordinate of the clip region. |
Definition at line 239 of file ctk-conio.c.
References CTK_FOCUS_WIDGET, ctk_window::focused, ctk_window::h, ctk_window::w, and ctk_widget::window.
void ctk_draw_window | ( | struct ctk_window * | window, |
unsigned char | focus, | ||
unsigned char | clipy1, | ||
unsigned char | clipy2, | ||
unsigned char | draw_borders | ||
) |
Draw a window onto the screen.
This function is called by the CTK when a window should be drawn on the screen. The ctk-draw layer is free to choose how the window will appear on screen; with or without window borders and the style of the borders, with or without transparent window background and how the background shall look, etc.
window | The window which is to be drawn. |
focus | Specifies if the window should be drawn in foreground or background colors and can be either CTK_FOCUS_NONE or CTK_FOCUS_WINDOW. Windows with a focus of CTK_FOCUS_WINDOW is usually drawn in a brighter color than those with CTK_FOCUS_NONE. |
clipy1 | Specifies the first lines on screen that actually should be drawn, in screen coordinates (line 1 is the first line below the menus). |
clipy2 | Specifies the last + 1 line on screen that should be drawn, in screen coordinates (line 1 is the first line below the menus) |
Definition at line 327 of file ctk-conio.c.
References ctk_widget::h, ctk_window::h, ctk_window::titlelen, ctk_window::w, ctk_widget::x, and ctk_widget::y.
Referenced by ctk_window_redraw().