56 #include "ctk/ctk-mouse.h"
58 static unsigned char height, width;
60 static unsigned char mode;
74 static unsigned char maxnitems;
78 #define NULL (void *)0
83 #define REDRAW_FOCUS 2
84 #define REDRAW_WIDGETS 4
85 #define REDRAW_MENUS 8
86 #define REDRAW_MENUPART 16
88 #define MAX_REDRAWWIDGETS 4
89 static unsigned char redraw;
90 static struct ctk_widget *redraw_widgets[MAX_REDRAWWIDGETS];
91 static unsigned char redraw_widgetptr;
94 static unsigned char iconx, icony;
95 #define ICONX_START (width - 6)
96 #define ICONY_START (height - 6 - CTK_CONF_MENUS)
97 #define ICONX_DELTA -16
98 #define ICONY_DELTA -5
99 #define ICONY_MAX height
102 #ifndef ctk_arch_keyavail
106 #ifndef ctk_arch_getkey
110 #ifndef ctk_arch_isprint
114 PROCESS(ctk_process,
"CTK Contiki GUI");
157 #if CTK_CONF_MOUSE_SUPPORT
161 process_event_t ctk_signal_pointer_move,
164 ctk_signal_pointer_button;
167 #if CTK_CONF_SCREENSAVER
170 process_event_t ctk_signal_screensaver_stop,
173 ctk_signal_screensaver_start;
178 #if CTK_CONF_MOUSE_SUPPORT
179 unsigned short mouse_x, mouse_y, mouse_button;
182 #if CTK_CONF_SCREENSAVER
183 static unsigned short screensaver_timer = 0;
184 unsigned short ctk_screensaver_timeout = (5*60);
203 make_desktopmenu(
void)
207 desktopmenu.nitems = 0;
209 if(windows ==
NULL) {
212 for(w = windows; w !=
NULL; w = w->
next) {
228 for(icon = desktop_window.active; icon !=
NULL; icon = icon->
next) {
233 icony += ICONY_DELTA;
234 if(icony >= ICONY_MAX) {
236 iconx += ICONX_DELTA;
247 height = ctk_draw_height();
248 width = ctk_draw_width();
307 icon->widget.icon.owner = p;
324 redraw |= REDRAW_FOCUS;
333 ctk_dialog_close(
void)
336 redraw |= REDRAW_ALL;
353 for(w2 = windows; w2 != w && w2 !=
NULL; w2 = w2->
next);
358 if(windows !=
NULL) {
367 if(w->next !=
NULL) {
368 w->next->prev = w->prev;
370 if(w->prev !=
NULL) {
371 w->prev->next = w->next;
388 redraw |= REDRAW_ALL;
402 #if CTK_CONF_WINDOWCLOSE
412 if(windows !=
NULL) {
420 for(w2 = windows; w2 !=
NULL && w2->
next !=
w; w2 = w2->
next);
439 redraw |= REDRAW_ALL;
451 unsigned char placement;
453 if(ctk_draw_windowtitle_height >= 2) {
454 placement = -1 - ctk_draw_windowtitle_height/2;
458 #if CTK_CONF_WINDOWMOVE
459 CTK_BUTTON_NEW(&window->titlebutton, 0, placement,
460 window->titlelen, window->title);
462 CTK_LABEL_NEW(&window->titlebutton, 0, placement,
463 window->titlelen, 1, window->title);
467 #if CTK_CONF_WINDOWCLOSE
468 CTK_BUTTON_NEW(&window->closebutton, window->w - 3, placement,
471 CTK_LABEL_NEW(&window->closebutton, window->w - 4, placement,
490 make_windowbuttons(w);
509 if(lastmenu ==
NULL) {
521 redraw |= REDRAW_MENUPART;
538 if(m->
next == menu) {
540 if(menu == lastmenu) {
543 redraw |= REDRAW_MENUPART;
559 do_redraw_all(
unsigned char clipy1,
unsigned char clipy2)
567 if(mode != CTK_MODE_NORMAL && mode != CTK_MODE_WINDOWMOVE) {
575 for(widget = desktop_window.active;
576 widget !=
NULL; widget = widget->
next) {
581 if(windows !=
NULL) {
586 for(; w != windows; w = w->
prev) {
592 focus = mode == CTK_MODE_WINDOWMOVE?
611 ctk_draw_menus(&menus);
627 ctk_desktop_redraw(
struct ctk_desktop *d)
630 if(mode == CTK_MODE_NORMAL || mode == CTK_MODE_WINDOWMOVE) {
631 do_redraw_all(CTK_CONF_MENUS, height);
634 height = ctk_draw_height();
635 width = ctk_draw_width();
637 redraw |= REDRAW_ALL;
656 if(mode != CTK_MODE_NORMAL) {
663 }
else if(dialog ==
NULL &&
665 menus.open ==
NULL &&
685 unsigned char w,
unsigned char h,
char *
title)
691 window->x = (width - w - 2) / 2;
693 if(h >= height - 2 - ctk_draw_windowtitle_height) {
696 window->y = (height - h - 2 - ctk_draw_windowtitle_height) / 2;
702 window->title =
title;
704 window->titlelen = (
unsigned char)strlen(title);
706 window->titlelen = 0;
708 window->next = window->prev =
NULL;
710 window->active = window->inactive = window->focused =
NULL;
733 unsigned char w,
unsigned char h,
char *title)
735 window_new(window, w, h, title);
738 make_windowbuttons(window);
757 unsigned char w,
unsigned char h)
759 window_new(dialog, w, h,
NULL);
780 menu->titlelen = (
unsigned char)strlen(title);
803 if(menu->nitems == CTK_MAXMENUITEMS) {
806 menu->items[menu->nitems].title = name;
807 menu->items[menu->nitems].titlelen = (
unsigned char)strlen(name);
808 return menu->nitems++;
824 static unsigned char i;
826 if(redraw_widgetptr == MAX_REDRAWWIDGETS) {
827 redraw |= REDRAW_FOCUS;
829 redraw |= REDRAW_WIDGETS;
832 for(i = 0; i < redraw_widgetptr; ++i) {
833 if(redraw_widgets[i] == w) {
837 redraw_widgets[redraw_widgetptr++] =
w;
859 if(mode != CTK_MODE_NORMAL || widget ==
NULL) {
872 if(menus.open ==
NULL)
877 if(window == dialog) {
879 }
else if(dialog ==
NULL &&
880 (window == windows ||
881 window == &desktop_window))
906 if(mode != CTK_MODE_NORMAL || widget ==
NULL) {
912 add_redrawwidget(widget);
932 widget->next = window->inactive;
933 window->inactive = widget;
934 widget->window = window;
936 widget->next = window->active;
937 window->active = widget;
938 widget->window = window;
954 return ctk_draw_width();
969 return ctk_draw_height();
996 add_redrawwidget(window->
focused);
1007 switch_focus_widget(
unsigned char direction)
1009 #if CTK_CONF_WINDOWS
1015 #if CTK_CONF_WINDOWS
1016 if(dialog !=
NULL) {
1024 if(window ==
NULL) {
1025 window = &desktop_window;
1028 if(window ==
NULL) {
1040 add_redrawwidget(focus);
1042 if((direction & 1) == 0) {
1044 focus = focus->
next;
1047 for(widget = window->
active;
1048 widget !=
NULL; widget = widget->
next) {
1049 if(widget->
next == focus) {
1056 for(focus = window->
active;
1065 select_widget(focus);
1070 switch_open_menu(
unsigned char rightleft)
1074 if(rightleft == 0) {
1076 for(menu = menus.menus; menu !=
NULL; menu = menu->
next) {
1077 if(menu->
next == menus.open) {
1081 lastmenu = menus.open;
1083 if(menus.open ==
NULL) {
1084 for(menu = menus.menus;
1090 lastmenu = menus.open;
1091 menus.open = menus.open->
next;
1092 if(menus.open ==
NULL) {
1093 menus.open = menus.menus;
1101 switch_menu_item(
unsigned char updown)
1131 static unsigned char
1135 #if CTK_CONF_WINDOWCLOSE
1136 if(w == (
struct ctk_widget *)&windows->closebutton) {
1142 #if CTK_CONF_WINDOWMOVE
1143 if(w == (
struct ctk_widget *)&windows->titlebutton) {
1144 mode = CTK_MODE_WINDOWMOVE;
1153 if(w->widget.icon.owner != PROCESS_NONE) {
1162 if(w->widget.textentry.state == CTK_TEXTENTRY_NORMAL) {
1163 w->widget.textentry.state = CTK_TEXTENTRY_EDIT;
1164 textentry_input(0, (
struct ctk_textentry *)w);
1166 w->widget.textentry.state = CTK_TEXTENTRY_NORMAL;
1169 add_redrawwidget(w);
1170 return REDRAW_WIDGETS;
1182 ctk_textentry_input_null(
ctk_arch_key_t c,
struct ctk_textentry *t)
1191 register char *cptr, *cptr2;
1192 static unsigned char len, txpos, typos, tlen;
1194 if(t->input !=
NULL && t->input(c, t)) {
1202 cptr = &t->text[txpos + typos * (tlen + 1)];
1212 if(txpos < tlen - 1 && *cptr != 0) {
1223 txpos = (
unsigned char)strlen(t->text);
1231 switch_focus_widget(DOWN);
1234 case CTK_CONF_WIDGETDOWN_KEY:
1235 t->state = CTK_TEXTENTRY_NORMAL;
1236 switch_focus_widget(DOWN);
1238 case CTK_CONF_WIDGETUP_KEY:
1239 t->state = CTK_TEXTENTRY_NORMAL;
1240 switch_focus_widget(UP);
1246 if(len == 1 && *cptr != 0) {
1251 strcpy(cptr - 1, cptr);
1255 if(ctk_arch_isprint(c)) {
1257 cptr2 = cptr + len - 1;
1258 while(cptr2 > cptr) {
1259 *cptr2 = *(cptr2 - 1);
1275 static unsigned char
1280 lastmenu = menus.open;
1281 if(menus.open == &desktopmenu) {
1282 for(w = windows; w !=
NULL; w = w->
next) {
1283 if(w->
title == desktopmenu.items[desktopmenu.active].title) {
1293 return REDRAW_MENUPART;
1296 static unsigned char
1299 if(menus.open->nitems > maxnitems) {
1300 maxnitems = menus.open->nitems;
1305 switch_open_menu(1);
1306 return REDRAW_MENUPART;
1309 switch_menu_item(1);
1310 return REDRAW_MENUS;
1313 switch_open_menu(0);
1314 return REDRAW_MENUPART;
1317 switch_menu_item(0);
1318 return REDRAW_MENUS;
1321 return activate_menu();
1323 case CTK_CONF_MENU_KEY:
1324 lastmenu = menus.open;
1326 return REDRAW_MENUPART;
1333 #if CTK_CONF_SCREENSAVER
1337 if(mode == CTK_MODE_NORMAL) {
1338 ++screensaver_timer;
1339 if(screensaver_timer >= ctk_screensaver_timeout) {
1341 #ifdef CTK_SCREENSAVER_INIT
1342 CTK_SCREENSAVER_INIT();
1345 screensaver_timer = 0;
1355 redraw |= REDRAW_WIDGETS;
1356 add_redrawwidget(w);
1358 ((
struct ctk_textentry *)w)->state =
1359 CTK_TEXTENTRY_NORMAL;
1361 w->window->focused =
NULL;
1368 static unsigned char i;
1369 #if CTK_CONF_WINDOWS
1374 #if CTK_CONF_MOUSE_SUPPORT
1375 static unsigned char mxc, myc, mouse_button_changed, mouse_moved,
1378 static unsigned char menux;
1388 menus.menus = menus.desktopmenu = &desktopmenu;
1391 #if CTK_CONF_MOUSE_SUPPORT
1398 #if CTK_CONF_WINDOWS
1399 desktop_window.owner = &ctk_process;
1417 #if CTK_CONF_MOUSE_SUPPORT
1422 #if CTK_CONF_SCREENSAVER
1427 mode = CTK_MODE_NORMAL;
1430 iconx = ICONX_START;
1431 icony = ICONY_START;
1434 #if CTK_CONF_SCREENSAVER
1442 #if CTK_CONF_SCREENSAVER
1450 if(menus.open !=
NULL) {
1451 maxnitems = menus.open->nitems;
1457 #if CTK_CONF_MOUSE_SUPPORT
1458 mouse_button_changed = mouse_moved = mouse_clicked = 0;
1461 if(ctk_mouse_button() != mouse_button) {
1462 mouse_button = ctk_mouse_button();
1463 mouse_button_changed = 1;
1464 if(mouse_button == 0) {
1470 if(ctk_mouse_x() != mouse_x ||
1471 ctk_mouse_y() != mouse_y) {
1472 mouse_x = ctk_mouse_x();
1473 mouse_y = ctk_mouse_y();
1477 mxc = ctk_mouse_xtoc(mouse_x);
1478 myc = ctk_mouse_ytoc(mouse_y);
1481 #if CTK_CONF_SCREENSAVER
1482 if(mode == CTK_MODE_SCREENSAVER) {
1484 #
if CTK_CONF_MOUSE_SUPPORT
1485 || mouse_moved || mouse_button_changed
1489 mode = CTK_MODE_NORMAL;
1493 if(mode == CTK_MODE_NORMAL) {
1494 #if CTK_CONF_MOUSE_SUPPORT
1498 if(mouse_moved || mouse_button_changed) {
1500 #if CTK_CONF_SCREENSAVER
1501 screensaver_timer = 0;
1517 for(menu = menus.menus->
next;
1520 if(mxc >= menux && mxc <= menux + titlelen) {
1527 if(mxc >= width - 7 &&
1529 menu = &desktopmenu;
1533 redraw |= REDRAW_MENUPART;
1538 if(menus.open !=
NULL) {
1539 static unsigned char nitems;
1545 if(menus.open == &desktopmenu) {
1546 menux = width - CTK_CONF_MENUWIDTH;
1549 for(menu = menus.menus->
next; menu != menus.open;
1550 menu = menu->
next) {
1555 nitems = menus.open->nitems;
1558 if(mxc >= menux && mxc <= menux + CTK_CONF_MENUWIDTH) {
1560 menus.open->active = myc;
1562 menus.open->active = nitems - 1;
1567 if(mxc >= menux && mxc <= menux + CTK_CONF_MENUWIDTH &&
1569 redraw |= activate_menu();
1571 lastmenu = menus.open;
1573 redraw |= REDRAW_MENUPART;
1576 redraw |= REDRAW_MENUS;
1581 #if CTK_CONF_WINDOWS
1584 if(dialog !=
NULL) {
1587 for(window = windows; window !=
NULL;
1588 window = window->
next) {
1591 if(mxc >= window->x &&
1592 mxc <= window->x + window->
w +
1593 2 * ctk_draw_windowborder_width &&
1595 myc <= window->y + window->
h +
1596 ctk_draw_windowtitle_height +
1597 ctk_draw_windowborder_height) {
1606 if(window ==
NULL) {
1607 window = &desktop_window;
1614 if(windows !=
NULL &&
1615 window != windows &&
1617 unfocus_widget(windows->
focused);
1621 if(window !=
NULL) {
1622 #if CTK_CONF_WINDOWS
1625 if(dialog ==
NULL &&
1626 window != &desktop_window &&
1627 window != windows &&
1631 redraw |= REDRAW_ALL;
1637 mxc = mxc - window->x - ctk_draw_windowborder_width;
1638 myc = myc - window->y - ctk_draw_windowtitle_height;
1645 widget = widget->
next) {
1647 if(mxc >= widget->
x &&
1648 mxc <= widget->x + widget->
w + 1 &&
1650 myc <= widget->y + widget->
h - 1) {
1659 #
if CTK_CONF_WINDOWS
1660 && (window != &desktop_window || windows ==
NULL)
1671 unfocus_widget(window->
focused);
1673 redraw |= REDRAW_WIDGETS;
1674 if(widget !=
NULL) {
1675 select_widget(widget);
1679 if(mouse_button_changed) {
1681 (process_data_t)(
size_t)mouse_button);
1682 if(mouse_clicked && widget !=
NULL) {
1683 select_widget(widget);
1684 redraw |= activate(widget);
1687 #if CTK_CONF_WINDOWS
1702 #if CTK_CONF_SCREENSAVER
1703 screensaver_timer = 0;
1708 #if CTK_CONF_WINDOWS
1709 if(dialog !=
NULL) {
1711 }
else if(windows !=
NULL) {
1714 window = &desktop_window;
1717 if(window ==
NULL) {
1732 if(widget !=
NULL &&
1734 widget->
widget.textentry.state == CTK_TEXTENTRY_EDIT) {
1735 textentry_input(c, (
struct ctk_textentry *)widget);
1736 add_redrawwidget(widget);
1738 }
else if(menus.open !=
NULL) {
1739 redraw |= menus_input(c);
1743 case CTK_CONF_WIDGETDOWN_KEY:
1744 switch_focus_widget(DOWN);
1746 case CTK_CONF_WIDGETUP_KEY:
1747 switch_focus_widget(UP);
1750 case CTK_CONF_MENU_KEY:
1751 if(dialog ==
NULL) {
1752 if(lastmenu ==
NULL) {
1753 menus.open = menus.menus;
1755 menus.open = lastmenu;
1758 redraw |= REDRAW_MENUS;
1762 #if CTK_CONF_WINDOWS
1763 case CTK_CONF_WINDOWSWITCH_KEY:
1764 if(windows !=
NULL) {
1765 for(window = windows; window->
next !=
NULL;
1766 window = window->
next);
1775 redraw |= activate(widget);
1777 if(widget !=
NULL &&
1779 if(widget->
widget.textentry.state == CTK_TEXTENTRY_NORMAL) {
1780 widget->
widget.textentry.state = CTK_TEXTENTRY_EDIT;
1781 textentry_input(0, (
struct ctk_textentry *)widget);
1783 textentry_input(c, (
struct ctk_textentry *)widget);
1784 add_redrawwidget(widget);
1786 unfocus_widget(window->
focused);
1788 (process_data_t)(
size_t)c);
1796 if(redraw & REDRAW_WIDGETS) {
1797 widgetptr = redraw_widgets;
1798 for(i = 0; i < MAX_REDRAWWIDGETS; ++i) {
1799 widget_redraw(*widgetptr);
1803 redraw &= ~REDRAW_WIDGETS;
1804 redraw_widgetptr = 0;
1808 #if CTK_CONF_WINDOWMOVE
1809 }
else if(mode == CTK_MODE_WINDOWMOVE) {
1815 #if CTK_CONF_MOUSE_SUPPORT
1820 if(window->
w + mxc + 2 >= width) {
1821 window->x = width - 2 - window->
w;
1826 if(window->
h + myc + ctk_draw_windowtitle_height +
1827 ctk_draw_windowborder_height >= height) {
1828 window->y = height - window->
h -
1829 ctk_draw_windowtitle_height - ctk_draw_windowborder_height;
1839 redraw = REDRAW_ALL;
1844 if(mouse_button_changed &&
1845 mouse_button == 0) {
1846 mode = CTK_MODE_NORMAL;
1847 redraw = REDRAW_ALL;
1853 #if CTK_CONF_SCREENSAVER
1854 screensaver_timer = 0;
1862 if(window->x + window->
w + 1 >= width) {
1865 redraw = REDRAW_ALL;
1871 redraw = REDRAW_ALL;
1875 if(window->y + window->
h + 1 + CTK_CONF_MENUS >= height) {
1878 redraw = REDRAW_ALL;
1884 redraw = REDRAW_ALL;
1887 mode = CTK_MODE_NORMAL;
1888 redraw = REDRAW_ALL;
1895 if(redraw & REDRAW_ALL) {
1896 do_redraw_all(CTK_CONF_MENUS, height);
1898 }
else if(redraw & REDRAW_MENUPART) {
1899 do_redraw_all(CTK_CONF_MENUS, maxnitems + 1);
1900 }
else if(redraw & REDRAW_MENUS) {
1901 ctk_draw_menus(&menus);
1903 }
else if(redraw & REDRAW_FOCUS) {
1904 #if CTK_CONF_WINDOWS
1905 if(dialog !=
NULL) {
1907 }
else if(windows !=
NULL) {
1913 if(window !=
NULL) {
1917 }
else if(redraw & REDRAW_WIDGETS) {
1918 widgetptr = redraw_widgets;
1919 for(i = 0; i < MAX_REDRAWWIDGETS; ++i) {
1920 widget_redraw(*widgetptr);
1926 redraw_widgetptr = 0;
process_event_t ctk_signal_hyperlink_hover
Same as ctk_signal_widget_select.
void process_poll(struct process *p)
Request a process to be polled.
struct ctk_window * next
The next window in the doubly linked list of open windows.
void timer_reset(struct timer *t)
Reset the timer with the same interval.
#define CC_REGISTER_ARG
Configure if the C compiler supports the "register" keyword for function arguments.
struct ctk_window * prev
The previous window in the doubly linked list of open windows.
void ctk_window_close(struct ctk_window *w)
Close a window if it is open.
#define CTK_WIDGET_ADD(win, widg)
Add a widget to a window.
process_event_t ctk_signal_keypress
Emitted for every key being pressed.
struct ctk_widget * inactive
The list if widgets that cannot be selected by the user.
unsigned char x
The x position of the widget within the containing window, in character coordinates.
void ctk_icon_add(CC_REGISTER_ARG struct ctk_widget *icon, struct process *p)
Add an icon to the desktop.
process_event_t ctk_signal_widget_select
Emitted when a widget is selected.
CTK screen drawing module interface, ctk-draw.
void ctk_window_new(struct ctk_window *window, unsigned char w, unsigned char h, char *title)
Create a new window.
process_event_t ctk_signal_widget_activate
Emitted when a widget is activated (pressed).
void ctk_draw_widget(struct ctk_widget *w, unsigned char focus, unsigned char clipy1, unsigned char clipy2)
Draw a widget on a window.
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
process_event_t ctk_signal_button_hover
Same as ctk_signal_widget_select.
struct ctk_menuitem items[CTK_MAXMENUITEMS]
The array which contains all the menu items.
#define PROCESS_END()
Define the end of a process.
struct process * owner
The process that owns the window.
#define PROCESS(name, strname)
Declare a process.
process_event_t ctk_signal_hyperlink_activate
Emitted when a hyperlink is activated.
process_event_t ctk_signal_window_close
Emitted when a window is closed.
unsigned char type
The type of the widget: CTK_WIDGET_SEPARATOR, CTK_WIDGET_LABEL, CTK_WIDGET_BUTTON, CTK_WIDGET_HYPERLINK, CTK_WIDGET_TEXTENTRY, CTK_WIDGET_BITMAP or CTK_WIDGET_ICON.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
Representation of the menu bar.
void ctk_draw_clear(unsigned char y1, unsigned char y2)
Clear the screen between the clip bounds.
void ctk_menu_new(CC_REGISTER_ARG struct ctk_menu *menu, char *title)
Creates a new menu.
Representation of an individual menu.
unsigned char h
The height of the widget in character coordinates.
void ctk_mode_set(unsigned char m)
Sets the current CTK mode.
#define CTK_WIDGET_SEPARATOR
Widget number: The CTK separator widget.
union ctk_widget::@34 widget
The union which contains the actual widget structure, as determined by the type field.
char * title
The menu items text.
char * title
The title of the window.
Representation of a CTK window.
struct ctk_widget * focused
A pointer to the widget on the active list that is currently selected, or NULL if no widget is select...
#define CTK_FOCUS_WINDOW
Widget focus flag: widget's window is the foremost one.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
process_event_t process_alloc_event(void)
Allocate a global event number.
#define CTK_WIDGET_TYPE(w)
Obtain the type of a widget.
unsigned char titlelen
The length of the title in characters.
process_event_t ctk_signal_menu_activate
Emitted when a menu item is activated.
struct ctk_menu * next
Apointer to the next menu, or is NULL if this is the last menu, and should be used by the ctk-draw mo...
unsigned char ctk_desktop_height(struct ctk_desktop *d)
Gets the height of the desktop.
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.
void ctk_menu_add(struct ctk_menu *menu)
Add a menu to the menu bar.
void process_post_synch(struct process *p, process_event_t ev, process_data_t data)
Post a synchronous event to a process.
unsigned char ctk_desktop_width(struct ctk_desktop *d)
Gets the width of the desktop.
unsigned char y
The y position of the widget within the containing window, in character coordinates.
#define NULL
The null pointer.
unsigned char ctk_arch_keyavail(void)
Check if there is a keypress in the keyboard input queue.
void ctk_window_clear(struct ctk_window *w)
Remove all widgets from a window.
#define CTK_WIDGET_BUTTON
Widget number: The CTK button widget.
unsigned char active
The currently active menu item.
process_event_t ctk_signal_button_activate
Same as ctk_signal_widget_activate.
#define CLOCK_SECOND
A second, measured in system clock time.
void ctk_widget_redraw(struct ctk_widget *widget)
Redraws a widget.
#define CTK_FOCUS_DIALOG
Widget focus flag: widget is in a dialog.
unsigned char w
The width of the window, excluding window borders.
unsigned char h
The height of the window, excluding window borders.
struct ctk_menu * menus
A pointer to a linked list of all menus, including the open menu and the desktop menu.
void ctk_draw_init(void)
The initialization function.
void ctk_draw_dialog(struct ctk_window *dialog)
Draw a dialog onto the screen.
struct ctk_widget * active
The list of widgets that can be selected by the user.
#define CTK_WIDGET_HYPERLINK
Widget number: The CTK hyperlink widget.
void ctk_widget_add(CC_REGISTER_ARG struct ctk_window *window, CC_REGISTER_ARG struct ctk_widget *widget)
Adds a widget to a window.
void ctk_draw_clear_window(struct ctk_window *window, unsigned char focus, unsigned char clipy1, unsigned char clipy2)
Draw the window background.
void ctk_window_redraw(struct ctk_window *w)
Redraw a window.
struct ctk_window * window
The window in which the widget is contained.
struct ctk_widget * next
The next widget in the linked list of widgets that is contained in the ctk_window structure...
unsigned char nitems
The total number of menu items in the menu.
unsigned char ctk_menuitem_add(CC_REGISTER_ARG struct ctk_menu *menu, char *name)
Adds a menu item to a menu.
ctk_arch_key_t ctk_arch_getkey(void)
Get a keypress from the keyboard input queue.
#define CTK_WIDGET_ICON
Widget number: The CTK icon widget.
unsigned char ctk_mode_get(void)
Retrieves the current CTK mode.
void ctk_window_open(CC_REGISTER_ARG struct ctk_window *w)
Open a window, or bring window to front if already open.
unsigned char w
The width of the widget in character coordinates.
#define CTK_WIDGET_TEXTENTRY
Widget number: The CTK textentry widget.
char ctk_arch_key_t
The keyboard character type of the system.
#define PROCESS_CURRENT()
Get a pointer to the currently running process.
The generic CTK widget structure that contains all other widget structures.
#define CTK_FOCUS_WIDGET
Widget focus flag: widget has focus.
#define CTK_WIDGET_LABEL
Widget number: The CTK label widget.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
void ctk_menu_remove(struct ctk_menu *menu)
Remove a menu from the menu bar.
int timer_expired(struct timer *t)
Check if a timer has expired.
#define PROCESS_BEGIN()
Define the beginning of a process.