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;
857 if(mode != CTK_MODE_NORMAL || widget ==
NULL) {
870 if(menus.open ==
NULL)
875 if(window == dialog) {
877 }
else if(dialog ==
NULL &&
878 (window == windows ||
879 window == &desktop_window))
904 if(mode != CTK_MODE_NORMAL || widget ==
NULL) {
910 add_redrawwidget(widget);
930 widget->next = window->inactive;
931 window->inactive = widget;
932 widget->window = window;
934 widget->next = window->active;
935 window->active = widget;
936 widget->window = window;
952 return ctk_draw_width();
967 return ctk_draw_height();
994 add_redrawwidget(window->
focused);
1005 switch_focus_widget(
unsigned char direction)
1007 #if CTK_CONF_WINDOWS
1013 #if CTK_CONF_WINDOWS
1014 if(dialog !=
NULL) {
1022 if(window ==
NULL) {
1023 window = &desktop_window;
1026 if(window ==
NULL) {
1038 add_redrawwidget(focus);
1040 if((direction & 1) == 0) {
1042 focus = focus->
next;
1045 for(widget = window->
active;
1046 widget !=
NULL; widget = widget->
next) {
1047 if(widget->
next == focus) {
1054 for(focus = window->
active;
1063 select_widget(focus);
1068 switch_open_menu(
unsigned char rightleft)
1072 if(rightleft == 0) {
1074 for(menu = menus.menus; menu !=
NULL; menu = menu->
next) {
1075 if(menu->
next == menus.open) {
1079 lastmenu = menus.open;
1081 if(menus.open ==
NULL) {
1082 for(menu = menus.menus;
1088 lastmenu = menus.open;
1089 menus.open = menus.open->
next;
1090 if(menus.open ==
NULL) {
1091 menus.open = menus.menus;
1099 switch_menu_item(
unsigned char updown)
1133 #if CTK_CONF_WINDOWCLOSE
1134 if(w == (
struct ctk_widget *)&windows->closebutton) {
1140 #if CTK_CONF_WINDOWMOVE
1141 if(w == (
struct ctk_widget *)&windows->titlebutton) {
1142 mode = CTK_MODE_WINDOWMOVE;
1151 if(w->widget.icon.owner != PROCESS_NONE) {
1160 if(w->widget.textentry.state == CTK_TEXTENTRY_NORMAL) {
1161 w->widget.textentry.state = CTK_TEXTENTRY_EDIT;
1162 textentry_input(0, (
struct ctk_textentry *)w);
1164 w->widget.textentry.state = CTK_TEXTENTRY_NORMAL;
1167 add_redrawwidget(w);
1168 return REDRAW_WIDGETS;
1180 ctk_textentry_input_null(
ctk_arch_key_t c,
struct ctk_textentry *t)
1189 register char *cptr, *cptr2;
1190 static unsigned char len, txpos, typos, tlen;
1192 if(t->input !=
NULL && t->input(c, t)) {
1200 cptr = &t->text[txpos + typos * (tlen + 1)];
1210 if(txpos < tlen - 1 && *cptr != 0) {
1221 txpos = (
unsigned char)strlen(t->text);
1229 switch_focus_widget(DOWN);
1232 case CTK_CONF_WIDGETDOWN_KEY:
1233 t->state = CTK_TEXTENTRY_NORMAL;
1234 switch_focus_widget(DOWN);
1236 case CTK_CONF_WIDGETUP_KEY:
1237 t->state = CTK_TEXTENTRY_NORMAL;
1238 switch_focus_widget(UP);
1244 if(len == 1 && *cptr != 0) {
1249 strcpy(cptr - 1, cptr);
1253 if(ctk_arch_isprint(c)) {
1255 cptr2 = cptr + len - 1;
1256 while(cptr2 > cptr) {
1257 *cptr2 = *(cptr2 - 1);
1273 static unsigned char
1278 lastmenu = menus.open;
1279 if(menus.open == &desktopmenu) {
1280 for(w = windows; w !=
NULL; w = w->
next) {
1281 if(w->
title == desktopmenu.items[desktopmenu.active].title) {
1291 return REDRAW_MENUPART;
1294 static unsigned char
1297 if(menus.open->nitems > maxnitems) {
1298 maxnitems = menus.open->nitems;
1303 switch_open_menu(1);
1304 return REDRAW_MENUPART;
1307 switch_menu_item(1);
1308 return REDRAW_MENUS;
1311 switch_open_menu(0);
1312 return REDRAW_MENUPART;
1315 switch_menu_item(0);
1316 return REDRAW_MENUS;
1319 return activate_menu();
1321 case CTK_CONF_MENU_KEY:
1322 lastmenu = menus.open;
1324 return REDRAW_MENUPART;
1331 #if CTK_CONF_SCREENSAVER
1335 if(mode == CTK_MODE_NORMAL) {
1336 ++screensaver_timer;
1337 if(screensaver_timer >= ctk_screensaver_timeout) {
1339 #ifdef CTK_SCREENSAVER_INIT
1340 CTK_SCREENSAVER_INIT();
1343 screensaver_timer = 0;
1353 redraw |= REDRAW_WIDGETS;
1354 add_redrawwidget(w);
1356 ((
struct ctk_textentry *)w)->state =
1357 CTK_TEXTENTRY_NORMAL;
1359 w->window->focused =
NULL;
1366 static unsigned char i;
1367 #if CTK_CONF_WINDOWS
1372 #if CTK_CONF_MOUSE_SUPPORT
1373 static unsigned char mxc, myc, mouse_button_changed, mouse_moved,
1376 static unsigned char menux;
1386 menus.menus = menus.desktopmenu = &desktopmenu;
1389 #if CTK_CONF_MOUSE_SUPPORT
1396 #if CTK_CONF_WINDOWS
1397 desktop_window.owner = &ctk_process;
1415 #if CTK_CONF_MOUSE_SUPPORT
1420 #if CTK_CONF_SCREENSAVER
1425 mode = CTK_MODE_NORMAL;
1428 iconx = ICONX_START;
1429 icony = ICONY_START;
1432 #if CTK_CONF_SCREENSAVER
1440 #if CTK_CONF_SCREENSAVER
1448 if(menus.open !=
NULL) {
1449 maxnitems = menus.open->nitems;
1455 #if CTK_CONF_MOUSE_SUPPORT
1456 mouse_button_changed = mouse_moved = mouse_clicked = 0;
1459 if(ctk_mouse_button() != mouse_button) {
1460 mouse_button = ctk_mouse_button();
1461 mouse_button_changed = 1;
1462 if(mouse_button == 0) {
1468 if(ctk_mouse_x() != mouse_x ||
1469 ctk_mouse_y() != mouse_y) {
1470 mouse_x = ctk_mouse_x();
1471 mouse_y = ctk_mouse_y();
1475 mxc = ctk_mouse_xtoc(mouse_x);
1476 myc = ctk_mouse_ytoc(mouse_y);
1479 #if CTK_CONF_SCREENSAVER
1480 if(mode == CTK_MODE_SCREENSAVER) {
1482 #
if CTK_CONF_MOUSE_SUPPORT
1483 || mouse_moved || mouse_button_changed
1487 mode = CTK_MODE_NORMAL;
1491 if(mode == CTK_MODE_NORMAL) {
1492 #if CTK_CONF_MOUSE_SUPPORT
1496 if(mouse_moved || mouse_button_changed) {
1498 #if CTK_CONF_SCREENSAVER
1499 screensaver_timer = 0;
1515 for(menu = menus.menus->
next;
1518 if(mxc >= menux && mxc <= menux + titlelen) {
1525 if(mxc >= width - 7 &&
1527 menu = &desktopmenu;
1531 redraw |= REDRAW_MENUPART;
1536 if(menus.open !=
NULL) {
1537 static unsigned char nitems;
1543 if(menus.open == &desktopmenu) {
1544 menux = width - CTK_CONF_MENUWIDTH;
1547 for(menu = menus.menus->
next; menu != menus.open;
1548 menu = menu->
next) {
1553 nitems = menus.open->nitems;
1556 if(mxc >= menux && mxc <= menux + CTK_CONF_MENUWIDTH) {
1558 menus.open->active = myc;
1560 menus.open->active = nitems - 1;
1565 if(mxc >= menux && mxc <= menux + CTK_CONF_MENUWIDTH &&
1567 redraw |= activate_menu();
1569 lastmenu = menus.open;
1571 redraw |= REDRAW_MENUPART;
1574 redraw |= REDRAW_MENUS;
1579 #if CTK_CONF_WINDOWS
1582 if(dialog !=
NULL) {
1585 for(window = windows; window !=
NULL;
1586 window = window->
next) {
1589 if(mxc >= window->x &&
1590 mxc <= window->x + window->
w +
1591 2 * ctk_draw_windowborder_width &&
1593 myc <= window->y + window->
h +
1594 ctk_draw_windowtitle_height +
1595 ctk_draw_windowborder_height) {
1604 if(window ==
NULL) {
1605 window = &desktop_window;
1612 if(windows !=
NULL &&
1613 window != windows &&
1615 unfocus_widget(windows->
focused);
1619 if(window !=
NULL) {
1620 #if CTK_CONF_WINDOWS
1623 if(dialog ==
NULL &&
1624 window != &desktop_window &&
1625 window != windows &&
1629 redraw |= REDRAW_ALL;
1635 mxc = mxc - window->x - ctk_draw_windowborder_width;
1636 myc = myc - window->y - ctk_draw_windowtitle_height;
1643 widget = widget->
next) {
1645 if(mxc >= widget->
x &&
1646 mxc <= widget->x + widget->
w + 1 &&
1648 myc <= widget->y + widget->
h - 1) {
1657 #
if CTK_CONF_WINDOWS
1658 && (window != &desktop_window || windows ==
NULL)
1669 unfocus_widget(window->
focused);
1671 redraw |= REDRAW_WIDGETS;
1672 if(widget !=
NULL) {
1673 select_widget(widget);
1677 if(mouse_button_changed) {
1679 (process_data_t)(
size_t)mouse_button);
1680 if(mouse_clicked && widget !=
NULL) {
1681 select_widget(widget);
1682 redraw |= activate(widget);
1685 #if CTK_CONF_WINDOWS
1700 #if CTK_CONF_SCREENSAVER
1701 screensaver_timer = 0;
1706 #if CTK_CONF_WINDOWS
1707 if(dialog !=
NULL) {
1709 }
else if(windows !=
NULL) {
1712 window = &desktop_window;
1715 if(window ==
NULL) {
1730 if(widget !=
NULL &&
1732 widget->
widget.textentry.state == CTK_TEXTENTRY_EDIT) {
1733 textentry_input(c, (
struct ctk_textentry *)widget);
1734 add_redrawwidget(widget);
1736 }
else if(menus.open !=
NULL) {
1737 redraw |= menus_input(c);
1741 case CTK_CONF_WIDGETDOWN_KEY:
1742 switch_focus_widget(DOWN);
1744 case CTK_CONF_WIDGETUP_KEY:
1745 switch_focus_widget(UP);
1748 case CTK_CONF_MENU_KEY:
1749 if(dialog ==
NULL) {
1750 if(lastmenu ==
NULL) {
1751 menus.open = menus.menus;
1753 menus.open = lastmenu;
1756 redraw |= REDRAW_MENUS;
1760 #if CTK_CONF_WINDOWS
1761 case CTK_CONF_WINDOWSWITCH_KEY:
1762 if(windows !=
NULL) {
1763 for(window = windows; window->
next !=
NULL;
1764 window = window->
next);
1773 redraw |= activate(widget);
1775 if(widget !=
NULL &&
1777 if(widget->
widget.textentry.state == CTK_TEXTENTRY_NORMAL) {
1778 widget->
widget.textentry.state = CTK_TEXTENTRY_EDIT;
1779 textentry_input(0, (
struct ctk_textentry *)widget);
1781 textentry_input(c, (
struct ctk_textentry *)widget);
1782 add_redrawwidget(widget);
1784 unfocus_widget(window->
focused);
1786 (process_data_t)(
size_t)c);
1794 if(redraw & REDRAW_WIDGETS) {
1795 widgetptr = redraw_widgets;
1796 for(i = 0; i < MAX_REDRAWWIDGETS; ++i) {
1797 widget_redraw(*widgetptr);
1801 redraw &= ~REDRAW_WIDGETS;
1802 redraw_widgetptr = 0;
1806 #if CTK_CONF_WINDOWMOVE
1807 }
else if(mode == CTK_MODE_WINDOWMOVE) {
1813 #if CTK_CONF_MOUSE_SUPPORT
1818 if(window->
w + mxc + 2 >= width) {
1819 window->x = width - 2 - window->
w;
1824 if(window->
h + myc + ctk_draw_windowtitle_height +
1825 ctk_draw_windowborder_height >= height) {
1826 window->y = height - window->
h -
1827 ctk_draw_windowtitle_height - ctk_draw_windowborder_height;
1837 redraw = REDRAW_ALL;
1842 if(mouse_button_changed &&
1843 mouse_button == 0) {
1844 mode = CTK_MODE_NORMAL;
1845 redraw = REDRAW_ALL;
1851 #if CTK_CONF_SCREENSAVER
1852 screensaver_timer = 0;
1860 if(window->x + window->
w + 1 >= width) {
1863 redraw = REDRAW_ALL;
1869 redraw = REDRAW_ALL;
1873 if(window->y + window->
h + 1 + CTK_CONF_MENUS >= height) {
1876 redraw = REDRAW_ALL;
1882 redraw = REDRAW_ALL;
1885 mode = CTK_MODE_NORMAL;
1886 redraw = REDRAW_ALL;
1893 if(redraw & REDRAW_ALL) {
1894 do_redraw_all(CTK_CONF_MENUS, height);
1896 }
else if(redraw & REDRAW_MENUPART) {
1897 do_redraw_all(CTK_CONF_MENUS, maxnitems + 1);
1898 }
else if(redraw & REDRAW_MENUS) {
1899 ctk_draw_menus(&menus);
1901 }
else if(redraw & REDRAW_FOCUS) {
1902 #if CTK_CONF_WINDOWS
1903 if(dialog !=
NULL) {
1905 }
else if(windows !=
NULL) {
1911 if(window !=
NULL) {
1915 }
else if(redraw & REDRAW_WIDGETS) {
1916 widgetptr = redraw_widgets;
1917 for(i = 0; i < MAX_REDRAWWIDGETS; ++i) {
1918 widget_redraw(*widgetptr);
1924 redraw_widgetptr = 0;
#define PROCESS_CURRENT()
Get a pointer to the currently running process.
#define CTK_WIDGET_ADD(win, widg)
Add a widget to a window.
process_event_t ctk_signal_window_close
Emitted when a window is closed.
#define CTK_WIDGET_TEXTENTRY
Widget number: The CTK textentry widget.
char ctk_arch_key_t
The keyboard character type of the system.
void ctk_mode_set(unsigned char m)
Sets the current CTK mode.
process_event_t ctk_signal_button_activate
Same as ctk_signal_widget_activate.
unsigned char ctk_menuitem_add(CC_REGISTER_ARG struct ctk_menu *menu, char *name)
Adds a menu item to a menu.
struct ctk_window * next
The next window in the doubly linked list of open windows.
Representation of the menu bar.
void process_poll(struct process *p)
Request a process to be polled.
unsigned char w
The width of the window, excluding window borders.
void ctk_window_open(CC_REGISTER_ARG struct ctk_window *w)
Open a window, or bring window to front if already open.
struct ctk_menu * menus
A pointer to a linked list of all menus, including the open menu and the desktop menu.
void ctk_window_close(struct ctk_window *w)
Close a window if it is open.
struct ctk_widget * next
The next widget in the linked list of widgets that is contained in the ctk_window structure...
process_event_t ctk_signal_widget_select
Emitted when a widget is selected.
struct ctk_widget * inactive
The list if widgets that cannot be selected by the user.
unsigned char active
The currently active menu item.
#define PROCESS_BEGIN()
Define the beginning of a process.
process_event_t ctk_signal_hyperlink_hover
Same as ctk_signal_widget_select.
void process_post_synch(struct process *p, process_event_t ev, process_data_t data)
Post a synchronous event to a process.
void ctk_menu_add(struct ctk_menu *menu)
Add a menu to the menu bar.
void ctk_draw_clear(unsigned char y1, unsigned char y2)
Clear the screen between the clip bounds.
unsigned char x
The x position of the widget within the containing window, in character coordinates.
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
struct ctk_menuitem items[CTK_MAXMENUITEMS]
The array which contains all the menu items.
void CC_FASTCALL ctk_widget_add(CC_REGISTER_ARG struct ctk_window *window, CC_REGISTER_ARG struct ctk_widget *widget)
Adds a widget to a window.
#define CTK_FOCUS_WINDOW
Widget focus flag: widget's window is the foremost one.
unsigned char ctk_desktop_width(struct ctk_desktop *d)
Gets the width of the desktop.
unsigned char nitems
The total number of menu items in the menu.
#define NULL
The null pointer.
void ctk_draw_widget(struct ctk_widget *w, unsigned char focus, unsigned char clipy1, unsigned char clipy2)
Draw a widget on a window.
void ctk_window_redraw(struct ctk_window *w)
Redraw a window.
void ctk_widget_redraw(struct ctk_widget *widget)
Redraws a widget.
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...
process_event_t process_alloc_event(void)
Allocate a global event number.
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.
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_menu_activate
Emitted when a menu item is activated.
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.
unsigned char y
The y position of the widget within the containing window, in character coordinates.
#define CTK_WIDGET_SEPARATOR
Widget number: The CTK separator widget.
struct ctk_window * prev
The previous window in the doubly linked list of open windows.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
unsigned char ctk_arch_keyavail(void)
Check if there is a keypress in the keyboard input queue.
process_event_t ctk_signal_keypress
Emitted for every key being pressed.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
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_button_hover
Same as ctk_signal_widget_select.
unsigned char ctk_mode_get(void)
Retrieves the current CTK mode.
char * title
The title of the 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_DIALOG
Widget focus flag: widget is in a dialog.
void ctk_menu_new(CC_REGISTER_ARG struct ctk_menu *menu, char *title)
Creates a new menu.
struct process * owner
The process that owns the window.
void ctk_menu_remove(struct ctk_menu *menu)
Remove a menu from the menu bar.
void ctk_window_clear(struct ctk_window *w)
Remove all widgets from a window.
process_event_t ctk_signal_hyperlink_activate
Emitted when a hyperlink is activated.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PROCESS(name, strname)
Declare a process.
#define CTK_WIDGET_BUTTON
Widget number: The CTK button widget.
unsigned char ctk_desktop_height(struct ctk_desktop *d)
Gets the height of the desktop.
process_event_t ctk_signal_widget_activate
Emitted when a widget is activated (pressed).
#define CC_REGISTER_ARG
Configure if the C compiler supports the "register" keyword for function arguments.
ctk_arch_key_t ctk_arch_getkey(void)
Get a keypress from the keyboard input queue.
union ctk_widget::@20 widget
The union which contains the actual widget structure, as determined by the type field.
CTK screen drawing module interface, ctk-draw.
Representation of an individual menu.
void ctk_draw_init(void)
The initialization function.
void ctk_draw_dialog(struct ctk_window *dialog)
Draw a dialog onto the screen.
#define CTK_WIDGET_HYPERLINK
Widget number: The CTK hyperlink widget.
Representation of a CTK window.
struct ctk_window * window
The window in which the widget is contained.
#define CTK_FOCUS_WIDGET
Widget focus flag: widget has focus.
#define CTK_WIDGET_LABEL
Widget number: The CTK label widget.
void ctk_draw_clear_window(struct ctk_window *window, unsigned char focus, unsigned char clipy1, unsigned char clipy2)
Draw the window background.
The generic CTK widget structure that contains all other widget structures.
unsigned char w
The width of the widget in character coordinates.
#define CC_FASTCALL
Configure if the C compiler supports fastcall function declarations.
int timer_expired(struct timer *t)
Check if a timer has expired.
unsigned char h
The height of the window, excluding window borders.
char * title
The menu items text.
unsigned char titlelen
The length of the title in characters.
#define CTK_WIDGET_TYPE(w)
Obtain the type of a widget.
struct ctk_widget * active
The list of widgets that can be selected by the user.
#define CTK_WIDGET_ICON
Widget number: The CTK icon widget.
void timer_reset(struct timer *t)
Reset the timer with the same interval.
#define CLOCK_SECOND
A second, measured in system clock time.
unsigned char h
The height of the widget in character coordinates.