4 Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
6 The Free Software Foundation, Inc.
9 Andrew Borodin <aborodin@vmail.ru>, 2012
11 This file is part of the Midnight Commander.
13 The Midnight Commander is free software: you can redistribute it
14 and/or modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation, either version 3 of the License,
16 or (at your option) any later version.
18 The Midnight Commander is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 * \brief Source: pulldown menu code
36 #include <sys/types.h>
38 #include "lib/global.h"
40 #include "lib/tty/tty.h"
42 #include "lib/tty/mouse.h"
43 #include "lib/tty/key.h" /* key macros */
44 #include "lib/strutil.h"
45 #include "lib/widget.h"
46 #include "lib/event.h" /* mc_event_raise() */
48 /*** global variables ****************************************************************************/
50 /*** file scope macro definitions ****************************************************************/
52 /*** file scope type declarations ****************************************************************/
54 /*** file scope variables ************************************************************************/
56 static cb_ret_t
menubar_callback (Widget
* w
, widget_msg_t msg
, int parm
);
58 /*** file scope functions ************************************************************************/
59 /* --------------------------------------------------------------------------------------------- */
62 menu_arrange (Menu
* menu
, dlg_shortcut_str get_shortcut
)
67 size_t max_shortcut_len
= 0;
69 menu
->max_entry_len
= 1;
70 menu
->max_hotkey_len
= 1;
72 for (i
= menu
->entries
; i
!= NULL
; i
= g_list_next (i
))
74 menu_entry_t
*entry
= i
->data
;
80 len
= (size_t) hotkey_width (entry
->text
);
81 menu
->max_hotkey_len
= max (menu
->max_hotkey_len
, len
);
83 if (get_shortcut
!= NULL
)
84 entry
->shortcut
= get_shortcut (entry
->command
);
86 if (entry
->shortcut
!= NULL
)
88 len
= (size_t) str_term_width1 (entry
->shortcut
);
89 max_shortcut_len
= max (max_shortcut_len
, len
);
94 menu
->max_entry_len
= menu
->max_hotkey_len
+ max_shortcut_len
;
98 /* --------------------------------------------------------------------------------------------- */
101 menubar_paint_idx (WMenuBar
* menubar
, unsigned int idx
, int color
)
103 Widget
*w
= WIDGET (menubar
);
104 const Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
105 const menu_entry_t
*entry
= g_list_nth_data (menu
->entries
, idx
);
106 const int y
= 2 + idx
;
107 int x
= menu
->start_x
;
109 if (x
+ menu
->max_entry_len
+ 4 > (gsize
) w
->cols
)
110 x
= w
->cols
- menu
->max_entry_len
- 4;
115 tty_setcolor (MENU_ENTRY_COLOR
);
117 widget_move (w
, y
, x
- 1);
118 tty_print_alt_char (ACS_LTEE
, FALSE
);
119 tty_draw_hline (w
->y
+ y
, w
->x
+ x
, ACS_HLINE
, menu
->max_entry_len
+ 3);
120 widget_move (w
, y
, x
+ menu
->max_entry_len
+ 3);
121 tty_print_alt_char (ACS_RTEE
, FALSE
);
128 tty_setcolor (color
);
129 widget_move (w
, y
, x
);
130 tty_print_char ((unsigned char) entry
->first_letter
);
131 tty_getyx (&yt
, &xt
);
132 tty_draw_hline (yt
, xt
, ' ', menu
->max_entry_len
+ 2); /* clear line */
133 tty_print_string (entry
->text
.start
);
135 if (entry
->text
.hotkey
!= NULL
)
137 tty_setcolor (color
== MENU_SELECTED_COLOR
? MENU_HOTSEL_COLOR
: MENU_HOT_COLOR
);
138 tty_print_string (entry
->text
.hotkey
);
139 tty_setcolor (color
);
142 if (entry
->text
.end
!= NULL
)
143 tty_print_string (entry
->text
.end
);
145 if (entry
->shortcut
!= NULL
)
147 widget_move (w
, y
, x
+ menu
->max_hotkey_len
+ 3);
148 tty_print_string (entry
->shortcut
);
151 /* move cursor to the start of entry text */
152 widget_move (w
, y
, x
+ 1);
156 /* --------------------------------------------------------------------------------------------- */
159 menubar_draw_drop (WMenuBar
* menubar
)
161 Widget
*w
= WIDGET (menubar
);
162 const Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
163 const unsigned int count
= g_list_length (menu
->entries
);
164 int column
= menu
->start_x
- 1;
167 if (column
+ menu
->max_entry_len
+ 5 > (gsize
) w
->cols
)
168 column
= w
->cols
- menu
->max_entry_len
- 5;
170 tty_setcolor (MENU_ENTRY_COLOR
);
171 draw_box (w
->owner
, w
->y
+ 1, w
->x
+ column
, count
+ 2, menu
->max_entry_len
+ 5, FALSE
);
173 for (i
= 0; i
< count
; i
++)
174 menubar_paint_idx (menubar
, i
,
175 i
== menu
->selected
? MENU_SELECTED_COLOR
: MENU_ENTRY_COLOR
);
178 /* --------------------------------------------------------------------------------------------- */
181 menubar_set_color (WMenuBar
* menubar
, gboolean current
, gboolean hotkey
)
183 if (!menubar
->is_active
)
184 tty_setcolor (MENU_INACTIVE_COLOR
);
186 tty_setcolor (hotkey
? MENU_HOTSEL_COLOR
: MENU_SELECTED_COLOR
);
188 tty_setcolor (hotkey
? MENU_HOT_COLOR
: MENU_ENTRY_COLOR
);
191 /* --------------------------------------------------------------------------------------------- */
194 menubar_draw (WMenuBar
* menubar
)
196 Widget
*w
= WIDGET (menubar
);
199 /* First draw the complete menubar */
200 tty_setcolor (menubar
->is_active
? MENU_ENTRY_COLOR
: MENU_INACTIVE_COLOR
);
201 tty_draw_hline (w
->y
, w
->x
, ' ', w
->cols
);
203 /* Now each one of the entries */
204 for (i
= menubar
->menu
; i
!= NULL
; i
= g_list_next (i
))
206 Menu
*menu
= i
->data
;
207 gboolean is_selected
= (menubar
->selected
== (gsize
) g_list_position (menubar
->menu
, i
));
209 menubar_set_color (menubar
, is_selected
, FALSE
);
210 widget_move (w
, 0, menu
->start_x
);
212 tty_print_char (' ');
213 tty_print_string (menu
->text
.start
);
215 if (menu
->text
.hotkey
!= NULL
)
217 menubar_set_color (menubar
, is_selected
, TRUE
);
218 tty_print_string (menu
->text
.hotkey
);
219 menubar_set_color (menubar
, is_selected
, FALSE
);
222 if (menu
->text
.end
!= NULL
)
223 tty_print_string (menu
->text
.end
);
225 tty_print_char (' ');
228 if (menubar
->is_dropped
)
229 menubar_draw_drop (menubar
);
232 ((Menu
*) g_list_nth_data (menubar
->menu
, menubar
->selected
))->start_x
);
235 /* --------------------------------------------------------------------------------------------- */
238 menubar_remove (WMenuBar
* menubar
)
242 if (!menubar
->is_dropped
)
245 /* HACK: before refresh the dialog, change the current widget to keep the order
246 of overlapped widgets. This is useful in multi-window editor.
247 In general, menubar should be a special object, not an ordinary widget
248 in the current dialog. */
249 h
= WIDGET (menubar
)->owner
;
250 h
->current
= g_list_find (h
->widgets
, dlg_find_by_id (h
, menubar
->previous_widget
));
252 menubar
->is_dropped
= FALSE
;
254 menubar
->is_dropped
= TRUE
;
256 /* restore current widget */
257 h
->current
= g_list_find (h
->widgets
, menubar
);
260 /* --------------------------------------------------------------------------------------------- */
263 menubar_left (WMenuBar
* menubar
)
265 menubar_remove (menubar
);
266 if (menubar
->selected
== 0)
267 menubar
->selected
= g_list_length (menubar
->menu
) - 1;
270 menubar_draw (menubar
);
273 /* --------------------------------------------------------------------------------------------- */
276 menubar_right (WMenuBar
* menubar
)
278 menubar_remove (menubar
);
279 menubar
->selected
= (menubar
->selected
+ 1) % g_list_length (menubar
->menu
);
280 menubar_draw (menubar
);
283 /* --------------------------------------------------------------------------------------------- */
286 menubar_finish (WMenuBar
* menubar
)
288 Widget
*w
= WIDGET (menubar
);
290 menubar
->is_dropped
= FALSE
;
291 menubar
->is_active
= FALSE
;
293 widget_want_hotkey (w
, 0);
295 dlg_select_by_id (w
->owner
, menubar
->previous_widget
);
299 /* --------------------------------------------------------------------------------------------- */
302 menubar_drop (WMenuBar
* menubar
, unsigned int selected
)
304 menubar
->is_dropped
= TRUE
;
305 menubar
->selected
= selected
;
306 menubar_draw (menubar
);
309 /* --------------------------------------------------------------------------------------------- */
312 menubar_execute (WMenuBar
* menubar
)
314 const Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
315 const menu_entry_t
*entry
= g_list_nth_data (menu
->entries
, menu
->selected
);
317 if ((entry
!= NULL
) && (entry
->command
!= CK_IgnoreKey
))
319 Widget
*w
= WIDGET (menubar
);
321 mc_global
.widget
.is_right
= (menubar
->selected
!= 0);
322 menubar_finish (menubar
);
323 w
->owner
->callback (w
->owner
, w
, DLG_ACTION
, entry
->command
, NULL
);
328 /* --------------------------------------------------------------------------------------------- */
331 menubar_down (WMenuBar
* menubar
)
333 Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
334 const unsigned int len
= g_list_length (menu
->entries
);
337 menubar_paint_idx (menubar
, menu
->selected
, MENU_ENTRY_COLOR
);
341 menu
->selected
= (menu
->selected
+ 1) % len
;
342 entry
= (menu_entry_t
*) g_list_nth_data (menu
->entries
, menu
->selected
);
344 while ((entry
== NULL
) || (entry
->command
== CK_IgnoreKey
));
346 menubar_paint_idx (menubar
, menu
->selected
, MENU_SELECTED_COLOR
);
349 /* --------------------------------------------------------------------------------------------- */
352 menubar_up (WMenuBar
* menubar
)
354 Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
355 const unsigned int len
= g_list_length (menu
->entries
);
358 menubar_paint_idx (menubar
, menu
->selected
, MENU_ENTRY_COLOR
);
362 if (menu
->selected
== 0)
363 menu
->selected
= len
- 1;
366 entry
= (menu_entry_t
*) g_list_nth_data (menu
->entries
, menu
->selected
);
368 while ((entry
== NULL
) || (entry
->command
== CK_IgnoreKey
));
370 menubar_paint_idx (menubar
, menu
->selected
, MENU_SELECTED_COLOR
);
373 /* --------------------------------------------------------------------------------------------- */
376 menubar_first (WMenuBar
* menubar
)
378 Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
381 if (menu
->selected
== 0)
384 menubar_paint_idx (menubar
, menu
->selected
, MENU_ENTRY_COLOR
);
390 entry
= (menu_entry_t
*) g_list_nth_data (menu
->entries
, menu
->selected
);
392 if ((entry
== NULL
) || (entry
->command
== CK_IgnoreKey
))
398 menubar_paint_idx (menubar
, menu
->selected
, MENU_SELECTED_COLOR
);
401 /* --------------------------------------------------------------------------------------------- */
404 menubar_last (WMenuBar
* menubar
)
406 Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
407 const unsigned int len
= g_list_length (menu
->entries
);
410 if (menu
->selected
== len
- 1)
413 menubar_paint_idx (menubar
, menu
->selected
, MENU_ENTRY_COLOR
);
415 menu
->selected
= len
;
420 entry
= (menu_entry_t
*) g_list_nth_data (menu
->entries
, menu
->selected
);
422 while ((entry
== NULL
) || (entry
->command
== CK_IgnoreKey
));
424 menubar_paint_idx (menubar
, menu
->selected
, MENU_SELECTED_COLOR
);
427 /* --------------------------------------------------------------------------------------------- */
430 menubar_handle_key (WMenuBar
* menubar
, int key
)
434 key
= g_ascii_tolower (key
);
436 if (is_abort_char (key
))
438 menubar_finish (menubar
);
442 /* menubar help or menubar navigation */
447 ev_help_t event_data
= { NULL
, NULL
};
449 if (menubar
->is_dropped
)
451 ((Menu
*) g_list_nth_data (menubar
->menu
, menubar
->selected
))->help_node
;
453 event_data
.node
= "[Menu Bar]";
455 mc_event_raise (MCEVENT_GROUP_CORE
, "help", &event_data
);
456 menubar_draw (menubar
);
461 menubar_left (menubar
);
466 menubar_right (menubar
);
470 if (!menubar
->is_dropped
)
474 /* drop menu by hotkey */
475 for (i
= menubar
->menu
; i
!= NULL
; i
= g_list_next (i
))
477 Menu
*menu
= i
->data
;
479 if ((menu
->text
.hotkey
!= NULL
) && (key
== g_ascii_tolower (menu
->text
.hotkey
[0])))
481 menubar_drop (menubar
, g_list_position (menubar
->menu
, i
));
486 /* drop menu by Enter or Dowwn key */
487 if (key
== KEY_ENTER
|| key
== XCTRL ('n') || key
== KEY_DOWN
|| key
== '\n')
488 menubar_drop (menubar
, menubar
->selected
);
494 Menu
*menu
= g_list_nth_data (menubar
->menu
, menubar
->selected
);
497 /* execute menu command by hotkey */
498 for (i
= menu
->entries
; i
!= NULL
; i
= g_list_next (i
))
500 const menu_entry_t
*entry
= i
->data
;
502 if ((entry
!= NULL
) && (entry
->command
!= CK_IgnoreKey
)
503 && (entry
->text
.hotkey
!= NULL
) && (key
== g_ascii_tolower (entry
->text
.hotkey
[0])))
505 menu
->selected
= g_list_position (menu
->entries
, i
);
506 menubar_execute (menubar
);
511 /* menu execute by Enter or menu navigation */
516 menubar_execute (menubar
);
521 menubar_first (menubar
);
526 menubar_last (menubar
);
531 menubar_down (menubar
);
536 menubar_up (menubar
);
544 /* --------------------------------------------------------------------------------------------- */
547 menubar_callback (Widget
* w
, widget_msg_t msg
, int parm
)
549 WMenuBar
*menubar
= (WMenuBar
*) w
;
553 /* We do not want the focus unless we have been activated */
555 if (!menubar
->is_active
)
556 return MSG_NOT_HANDLED
;
558 /* Trick to get all the mouse events */
561 /* Trick to get all of the hotkeys */
562 widget_want_hotkey (w
, 1);
563 menubar_draw (menubar
);
566 /* We don't want the buttonbar to activate while using the menubar */
569 if (menubar
->is_active
)
571 menubar_handle_key (menubar
, parm
);
574 return MSG_NOT_HANDLED
;
577 /* Put the cursor in a suitable place */
578 return MSG_NOT_HANDLED
;
581 return menubar
->is_active
? MSG_NOT_HANDLED
: MSG_HANDLED
;
584 if (menubar
->is_visible
)
586 menubar_draw (menubar
);
592 /* try show menu after screen resize */
593 send_message (w
, WIDGET_FOCUS
, 0);
598 menubar_set_menu (menubar
, NULL
);
602 return default_proc (msg
, parm
);
606 /* --------------------------------------------------------------------------------------------- */
609 menubar_event (Gpm_Event
* event
, void *data
)
611 WMenuBar
*menubar
= (WMenuBar
*) data
;
612 Widget
*w
= WIDGET (data
);
613 gboolean was_active
= TRUE
;
614 int left_x
, right_x
, bottom_y
;
618 if (!mouse_global_in_widget (event
, w
))
619 return MOU_UNHANDLED
;
621 /* ignore unsupported events */
622 if ((event
->type
& (GPM_UP
| GPM_DOWN
| GPM_DRAG
)) == 0)
625 /* ignore wheel events if menu is inactive */
626 if (!menubar
->is_active
&& ((event
->buttons
& (GPM_B_MIDDLE
| GPM_B_UP
| GPM_B_DOWN
)) != 0))
629 local
= mouse_get_local (event
, w
);
631 if (local
.y
== 1 && (local
.type
& GPM_UP
) != 0)
634 if (!menubar
->is_dropped
)
636 menubar
->previous_widget
= dlg_get_current_widget_id (w
->owner
);
637 menubar
->is_active
= TRUE
;
638 menubar
->is_dropped
= TRUE
;
642 /* Mouse operations on the menubar */
643 if (local
.y
== 1 || !was_active
)
645 /* wheel events on menubar */
646 if ((local
.buttons
& GPM_B_UP
) != 0)
647 menubar_left (menubar
);
648 else if ((local
.buttons
& GPM_B_DOWN
) != 0)
649 menubar_right (menubar
);
652 const unsigned int len
= g_list_length (menubar
->menu
);
653 unsigned int new_selection
= 0;
655 while ((new_selection
< len
)
656 && (local
.x
> ((Menu
*) g_list_nth_data (menubar
->menu
,
657 new_selection
))->start_x
))
660 if (new_selection
!= 0) /* Don't set the invalid value -1 */
665 menubar
->selected
= new_selection
;
666 dlg_select_widget (menubar
);
670 menubar_remove (menubar
);
671 menubar
->selected
= new_selection
;
673 menubar_draw (menubar
);
678 if (!menubar
->is_dropped
|| (local
.y
< 2))
681 /* middle click -- everywhere */
682 if (((local
.buttons
& GPM_B_MIDDLE
) != 0) && ((local
.type
& GPM_DOWN
) != 0))
684 menubar_execute (menubar
);
688 /* the mouse operation is on the menus or it is not */
689 menu
= (Menu
*) g_list_nth_data (menubar
->menu
, menubar
->selected
);
690 left_x
= menu
->start_x
;
691 right_x
= left_x
+ menu
->max_entry_len
+ 3;
692 if (right_x
> w
->cols
)
694 left_x
= w
->cols
- menu
->max_entry_len
- 3;
698 bottom_y
= g_list_length (menu
->entries
) + 3;
700 if ((local
.x
>= left_x
) && (local
.x
<= right_x
) && (local
.y
<= bottom_y
))
702 int pos
= local
.y
- 3;
703 const menu_entry_t
*entry
= g_list_nth_data (menu
->entries
, pos
);
706 if ((local
.buttons
& GPM_B_UP
) != 0 && (local
.type
& GPM_DOWN
) != 0)
708 menubar_up (menubar
);
711 if ((local
.buttons
& GPM_B_DOWN
) != 0 && (local
.type
& GPM_DOWN
) != 0)
713 menubar_down (menubar
);
717 /* ignore events above and below dropped down menu */
718 if ((pos
< 0) || (pos
>= bottom_y
- 3))
721 if ((entry
!= NULL
) && (entry
->command
!= CK_IgnoreKey
))
723 menubar_paint_idx (menubar
, menu
->selected
, MENU_ENTRY_COLOR
);
724 menu
->selected
= pos
;
725 menubar_paint_idx (menubar
, menu
->selected
, MENU_SELECTED_COLOR
);
727 if ((event
->type
& GPM_UP
) != 0)
728 menubar_execute (menubar
);
731 else if (((local
.type
& GPM_DOWN
) != 0) && ((local
.buttons
& (GPM_B_UP
| GPM_B_DOWN
)) == 0))
733 /* use click not wheel to close menu */
734 menubar_finish (menubar
);
740 /* --------------------------------------------------------------------------------------------- */
741 /*** public functions ****************************************************************************/
742 /* --------------------------------------------------------------------------------------------- */
745 menu_entry_create (const char *name
, unsigned long command
)
749 entry
= g_new (menu_entry_t
, 1);
750 entry
->first_letter
= ' ';
751 entry
->text
= parse_hotkey (name
);
752 entry
->command
= command
;
753 entry
->shortcut
= NULL
;
758 /* --------------------------------------------------------------------------------------------- */
761 menu_entry_free (menu_entry_t
* entry
)
765 release_hotkey (entry
->text
);
766 g_free (entry
->shortcut
);
771 /* --------------------------------------------------------------------------------------------- */
774 create_menu (const char *name
, GList
* entries
, const char *help_node
)
778 menu
= g_new (Menu
, 1);
780 menu
->text
= parse_hotkey (name
);
781 menu
->entries
= entries
;
782 menu
->max_entry_len
= 1;
783 menu
->max_hotkey_len
= 0;
785 menu
->help_node
= g_strdup (help_node
);
790 /* --------------------------------------------------------------------------------------------- */
793 menu_set_name (Menu
* menu
, const char *name
)
795 release_hotkey (menu
->text
);
796 menu
->text
= parse_hotkey (name
);
799 /* --------------------------------------------------------------------------------------------- */
802 destroy_menu (Menu
* menu
)
804 release_hotkey (menu
->text
);
805 g_list_foreach (menu
->entries
, (GFunc
) menu_entry_free
, NULL
);
806 g_list_free (menu
->entries
);
807 g_free (menu
->help_node
);
811 /* --------------------------------------------------------------------------------------------- */
814 menubar_new (int y
, int x
, int cols
, GList
* menu
)
819 menubar
= g_new0 (WMenuBar
, 1);
820 w
= WIDGET (menubar
);
821 init_widget (w
, y
, x
, 1, cols
, menubar_callback
, menubar_event
);
823 menubar
->is_visible
= TRUE
; /* by default */
824 widget_want_cursor (w
, FALSE
);
825 menubar_set_menu (menubar
, menu
);
830 /* --------------------------------------------------------------------------------------------- */
833 menubar_set_menu (WMenuBar
* menubar
, GList
* menu
)
835 /* delete previous menu */
836 if (menubar
->menu
!= NULL
)
838 g_list_foreach (menubar
->menu
, (GFunc
) destroy_menu
, NULL
);
839 g_list_free (menubar
->menu
);
842 menubar
->is_active
= FALSE
;
843 menubar
->is_dropped
= FALSE
;
844 menubar
->menu
= menu
;
845 menubar
->selected
= 0;
846 menubar_arrange (menubar
);
849 /* --------------------------------------------------------------------------------------------- */
852 menubar_add_menu (WMenuBar
* menubar
, Menu
* menu
)
856 menu_arrange (menu
, WIDGET (menubar
)->owner
->get_shortcut
);
857 menubar
->menu
= g_list_append (menubar
->menu
, menu
);
860 menubar_arrange (menubar
);
863 /* --------------------------------------------------------------------------------------------- */
865 * Properly space menubar items. Should be called when menubar is created
866 * and also when widget width is changed (i.e. upon xterm resize).
870 menubar_arrange (WMenuBar
* menubar
)
876 if (menubar
->menu
== NULL
)
879 gap
= WIDGET (menubar
)->cols
- 2;
881 /* First, calculate gap between items... */
882 for (i
= menubar
->menu
; i
!= NULL
; i
= g_list_next (i
))
884 Menu
*menu
= (Menu
*) i
->data
;
885 /* preserve length here, to be used below */
886 menu
->start_x
= hotkey_width (menu
->text
) + 2;
887 gap
-= menu
->start_x
;
890 if (g_list_next (menubar
->menu
) == NULL
)
893 gap
/= (g_list_length (menubar
->menu
) - 1);
897 /* We are out of luck - window is too narrow... */
903 /* ...and now fix start positions of menubar items */
904 for (i
= menubar
->menu
; i
!= NULL
; i
= g_list_next (i
))
906 Menu
*menu
= (Menu
*) i
->data
;
907 int len
= menu
->start_x
;
909 menu
->start_x
= start_x
;
910 start_x
+= len
+ gap
;
914 /* --------------------------------------------------------------------------------------------- */
915 /** Find MenuBar widget in the dialog */
918 find_menubar (const Dlg_head
* h
)
920 return (WMenuBar
*) find_widget_type (h
, menubar_callback
);
923 /* --------------------------------------------------------------------------------------------- */