changeset 9227:968bb25ec1af

(display_menu_item): Add support for displaying the title in pop up menus.
author Paul Reilly <pmr@pajato.com>
date Sun, 02 Oct 1994 12:14:00 +0000
parents fc3f748ccf9e
children 2ac31fc0facb
files lwlib/xlwmenu.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/xlwmenu.c	Sun Oct 02 12:07:01 1994 +0000
+++ b/lwlib/xlwmenu.c	Sun Oct 02 12:14:00 1994 +0000
@@ -516,10 +516,19 @@
 	}
       else 
 	{
+	  int x_offset = x + h_spacing + shadow;
 	  char* display_string = resource_widget_value (mw, val);
 	  draw_shadow_rectangle (mw, ws->window, x, y, width, height, True);
-	  XDrawString (XtDisplay (mw), ws->window, text_gc,
-		       x + h_spacing + shadow,
+
+	  /* Deal with centering a menu title. */
+	  if (!horizontal_p && !val->contents && !val->call_data)
+	    {
+	      int l = string_width (mw, display_string);
+
+	      if (width > l)
+		x_offset = (width - l) >> 1;
+	    }
+          XDrawString (XtDisplay (mw), ws->window, text_gc, x_offset,
 		       y + v_spacing + shadow + font_ascent,
 		       display_string, strlen (display_string));