changeset 27334:b0f7b611a20e

(highlight_hook): New function. (xlw_create_menubar, xlw_create_popup_menu): Add highlight_hook as callback XtNhighlightCallback.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 17 Jan 2000 09:09:39 +0000
parents a5bceda5d689
children 314e947f85ea
files lwlib/lwlib-Xlw.c
diffstat 1 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/lwlib-Xlw.c	Mon Jan 17 09:09:08 2000 +0000
+++ b/lwlib/lwlib-Xlw.c	Mon Jan 17 09:09:39 2000 +0000
@@ -31,6 +31,26 @@
 #include "xlwmenu.h"
 
 /* Menu callbacks */
+
+/* Callback XtNhighlightCallback for Lucid menus.  W is the menu
+   widget, CLIENT_DATA contains a pointer to the widget_instance
+   for the menu, CALL_DATA contains a pointer to the widget_value
+   structure for the highlighted menu item.  The latter may be null
+   if there isn't any highlighted menu item.  */
+
+static void
+highlight_hook (w, client_data, call_data)
+     Widget w;
+     XtPointer client_data;
+     XtPointer call_data;
+{
+  widget_instance *instance = (widget_instance *) client_data;
+
+  if (instance->info->highlight_cb
+      && !w->core.being_destroyed)
+    instance->info->highlight_cb (w, instance->info->id, call_data);
+}
+
 static void
 pre_hook (w, client_data, call_data)
      Widget w;
@@ -100,6 +120,8 @@
 
   XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
   XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
+  XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
+		 (XtPointer)instance);
   return widget;
 }
 
@@ -125,7 +147,8 @@
 			     popup_shell, al, ac);
 
   XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
-
+  XtAddCallback (widget, XtNhighlightCallback, highlight_hook,
+		 (XtPointer)instance);
   return popup_shell;
 }