diff options
author | Paul Reilly <[email protected]> | 1994-10-02 12:14:00 +0000 |
---|---|---|
committer | Paul Reilly <[email protected]> | 1994-10-02 12:14:00 +0000 |
commit | 84593cae2f5eaa9f6475054440abd69d327fe177 (patch) | |
tree | 907a9718b41004f0665898d255025f993e71b8a8 /lwlib | |
parent | f78c517706b749debd6cd270c69c26416de12141 (diff) |
(display_menu_item): Add support for displaying the title in pop up menus.
Diffstat (limited to 'lwlib')
-rw-r--r-- | lwlib/xlwmenu.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 31773e1e00..4b5e589538 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -516,10 +516,19 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p, just_compute } 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)); |