Added locale setting before calling dpkg to fix "link to" parsing on non-C locales
[midnight-commander.git] / lib / widget / menu.h
blob3a210a4e4a8981a9024825081fc64fa18c76261a
1 /* Header file for pulldown menu engine for Midnignt Commander
2 Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 2007, 2009 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 /** \file menu.h
20 * \brief Header: pulldown menu code
23 #ifndef MC__WIDGET_MENU_H
24 #define MC__WIDGET_MENU_H
26 /*** typedefs(not structures) and defined constants **********************************************/
28 #define menu_separator_create() NULL
30 /*** enums ***************************************************************************************/
32 /*** structures declarations (and typedefs of structures)*****************************************/
34 typedef struct menu_entry_t
36 unsigned char first_letter;
37 hotkey_t text;
38 unsigned long command;
39 char *shortcut;
40 } menu_entry_t;
42 typedef struct Menu
44 int start_x; /* position relative to menubar start */
45 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 /* The button bar menu */
54 typedef struct WMenuBar
56 Widget widget;
58 gboolean is_visible; /* If the menubar is visible */
59 gboolean is_active; /* If the menubar is in use */
60 gboolean is_dropped; /* If the menubar has dropped */
61 GList *menu; /* The actual menus */
62 size_t selected; /* Selected menu on the top bar */
63 int previous_widget; /* Selected widget ID before activating menu */
64 } WMenuBar;
66 /*** global variables defined in .c file *********************************************************/
68 /*** declarations of public functions ************************************************************/
70 menu_entry_t *menu_entry_create (const char *name, unsigned long command);
71 void menu_entry_free (menu_entry_t * me);
73 Menu *create_menu (const char *name, GList * entries, const char *help_node);
74 void menu_set_name (Menu * menu, const char *name);
75 void destroy_menu (Menu * menu);
77 WMenuBar *menubar_new (int y, int x, int cols, GList * menu);
78 void menubar_set_menu (WMenuBar * menubar, GList * menu);
79 void menubar_add_menu (WMenuBar * menubar, Menu * menu);
80 void menubar_arrange (WMenuBar * menubar);
82 WMenuBar *find_menubar (const Dlg_head * h);
84 /*** inline functions ****************************************************************************/
86 static inline void
87 menubar_set_visible (WMenuBar * menubar, gboolean visible)
89 menubar->is_visible = visible;
92 #endif /* MC__WIDGET_MENU_H */