Ticket #1809 (invalid length of nonprintable chars)
[kaloumi3.git] / src / menu.h
blob1ef90d88ab57b8aed15f75066877112d956eb2ac
2 /* Header file for pulldown menu engine for Midnignt Commander
3 Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 2007, 2009 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 /** \file menu.h
21 * \brief Header: pulldown menu code
24 #ifndef MC_MENU_H
25 #define MC_MENU_H
27 #include "global.h"
28 #include "widget.h"
30 extern int menubar_visible;
32 typedef struct menu_entry_t {
33 unsigned char first_letter;
34 struct hotkey_t text;
35 unsigned long command;
36 char *shortcut;
37 } menu_entry_t;
39 menu_entry_t *menu_entry_create (const char *name, unsigned long command);
40 void menu_entry_free (menu_entry_t *me);
41 #define menu_separator_create() NULL
43 typedef struct Menu {
44 int start_x; /* position relative to menubar start */
45 struct hotkey_t text;
46 GList *entries;
47 size_t max_entry_len; /* cached max length of entry texts (text + shortcut) */
48 size_t max_hotkey_len; /* cached max length of shortcuts */
49 unsigned int selected; /* pointer to current menu entry */
50 char *help_node;
51 } Menu;
53 Menu *create_menu (const char *name, GList *entries,
54 const char *help_node);
56 void destroy_menu (Menu *menu);
58 /* The button bar menu */
59 typedef struct WMenuBar {
60 Widget widget;
62 gboolean is_active; /* If the menubar is in use */
63 gboolean is_dropped; /* If the menubar has dropped */
64 GList *menu; /* The actual menus */
65 size_t selected; /* Selected menu on the top bar */
66 int previous_widget; /* Selected widget ID before activating menu */
67 } WMenuBar;
69 WMenuBar *menubar_new (int y, int x, int cols, GList *menu);
70 void menubar_set_menu (WMenuBar *menubar, GList *menu);
71 void menubar_add_menu (WMenuBar *menubar, Menu *menu);
72 void menubar_arrange (WMenuBar *menubar);
74 WMenuBar *find_menubar (const Dlg_head *h);
76 #endif /* MC_MENU_H */