Added ctk_signal_widget_activate and ctk_signal_widget_select, made mouse clicks on desktop icons work even with open windows, added ctk_bitmap_set_nbitmap and CTK_BITMAP_NEW macros
diff --git a/contiki/ctk/ctk.c b/contiki/ctk/ctk.c
index 516d3f2..250057b 100644
--- a/contiki/ctk/ctk.c
+++ b/contiki/ctk/ctk.c
@@ -32,7 +32,7 @@
*
* This file is part of the "ctk" console GUI toolkit for cc65
*
- * $Id: ctk.c,v 1.14 2003/04/16 18:29:19 adamdunkels Exp $
+ * $Id: ctk.c,v 1.15 2003/04/18 00:18:38 adamdunkels Exp $
*
*/
@@ -92,7 +92,9 @@
ek_signal_t ctk_signal_keypress,
ctk_signal_timer,
ctk_signal_button_activate,
+ ctk_signal_widget_activate,
ctk_signal_button_hover,
+ ctk_signal_widget_select,
ctk_signal_hyperlink_activate,
ctk_signal_hyperlink_hover,
ctk_signal_menu_activate,
@@ -164,10 +166,16 @@
ctk_signal_keypress = dispatcher_sigalloc();
ctk_signal_timer = dispatcher_sigalloc();
- ctk_signal_button_activate = dispatcher_sigalloc();
- ctk_signal_button_hover = dispatcher_sigalloc();
+
+ ctk_signal_button_activate =
+ ctk_signal_widget_activate = dispatcher_sigalloc();
+
+ ctk_signal_button_hover =
+ ctk_signal_hyperlink_hover =
+ ctk_signal_widget_select = dispatcher_sigalloc();
+
ctk_signal_hyperlink_activate = dispatcher_sigalloc();
- ctk_signal_hyperlink_hover = dispatcher_sigalloc();
+
ctk_signal_menu_activate = dispatcher_sigalloc();
ctk_signal_window_close = dispatcher_sigalloc();
@@ -625,6 +633,10 @@
}
add_redrawwidget(window->focused);
+
+ dispatcher_emit(ctk_signal_widget_select, focus,
+ focus->window->owner);
+
}
}
@@ -764,12 +776,12 @@
mode = CTK_MODE_WINDOWMOVE;
#endif /* CTK_CONF_WINDOWCLOSE */
} else {
- dispatcher_emit(ctk_signal_button_activate, w,
+ dispatcher_emit(ctk_signal_widget_activate, w,
w->window->owner);
}
#if CTK_CONF_ICONS
} else if(w->type == CTK_WIDGET_ICON) {
- dispatcher_emit(ctk_signal_button_activate, w,
+ dispatcher_emit(ctk_signal_widget_activate, w,
w->widget.icon.owner);
#endif /* CTK_CONF_ICONS */
} else if(w->type == CTK_WIDGET_HYPERLINK) {
@@ -787,6 +799,9 @@
}
add_redrawwidget(w);
return REDRAW_WIDGETS;
+ } else {
+ dispatcher_emit(ctk_signal_widget_activate, w,
+ w->window->owner);
}
return REDRAW_NONE;
}
@@ -1107,8 +1122,7 @@
/* If we didn't find any window, and there are no windows
open, the mouse pointer will definately be within the
background desktop window. */
- if(window == NULL &&
- windows == NULL) {
+ if(window == NULL) {
window = &desktop_window;
}
@@ -1158,12 +1172,12 @@
}
- if(mouse_moved) {
+ if(mouse_moved &&
+ (window != &desktop_window ||
+ windows == NULL)) {
dispatcher_emit(ctk_signal_pointer_move, NULL,
window->owner);
-
-
-
+
if(window->focused != NULL &&
widget != window->focused) {
add_redrawwidget(window->focused);
diff --git a/contiki/ctk/ctk.h b/contiki/ctk/ctk.h
index d11f1cd..3cb67d6 100644
--- a/contiki/ctk/ctk.h
+++ b/contiki/ctk/ctk.h
@@ -32,7 +32,7 @@
*
* This file is part of the "ctk" console GUI toolkit for cc65
*
- * $Id: ctk.h,v 1.7 2003/04/11 20:16:02 adamdunkels Exp $
+ * $Id: ctk.h,v 1.8 2003/04/18 00:18:39 adamdunkels Exp $
*
*/
@@ -320,6 +320,8 @@
#define ctk_button_set_text(b, t) (b)->text = (t)
+#define ctk_bitmap_set_bitmap(b, m) (b)->bitmap = (m)
+
#define CTK_BUTTON_NEW(widg, xpos, ypos, width, buttontext) \
(widg)->window = NULL; \
(widg)->next = NULL; \
@@ -339,6 +341,16 @@
(widg)->h = (height); \
(widg)->text = (labeltext)
+#define CTK_BITMAP_NEW(widg, xpos, ypos, width, height, bmap) \
+ (widg)->window = NULL; \
+ (widg)->next = NULL; \
+ (widg)->type = CTK_WIDGET_BITMAP; \
+ (widg)->x = (xpos); \
+ (widg)->y = (ypos); \
+ (widg)->w = (width); \
+ (widg)->h = (height); \
+ (widg)->bitmap = (bmap)
+
#define CTK_TEXTENTRY_NEW(widg, xxpos, yypos, width, height, textptr, textlen) \
(widg)->window = NULL; \
(widg)->next = NULL; \