1998-02-27 07:54:42 +03:00
|
|
|
#ifndef __MENU_H
|
|
|
|
#define __MENU_H
|
|
|
|
|
|
|
|
#include "widget.h"
|
|
|
|
|
2002-11-14 09:30:16 +03:00
|
|
|
typedef void (*callfn) (void);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char first_letter;
|
2004-08-29 21:15:23 +04:00
|
|
|
const char *text;
|
1998-02-27 07:54:42 +03:00
|
|
|
int hot_key;
|
|
|
|
callfn call_back;
|
|
|
|
} menu_entry;
|
|
|
|
|
2002-11-13 00:01:50 +03:00
|
|
|
typedef struct Menu {
|
2004-08-29 20:42:40 +04:00
|
|
|
const char *name;
|
1998-02-27 07:54:42 +03:00
|
|
|
int count;
|
|
|
|
int max_entry_len;
|
|
|
|
int selected;
|
1998-06-08 04:33:31 +04:00
|
|
|
int hotkey;
|
1998-02-27 07:54:42 +03:00
|
|
|
menu_entry *entries;
|
1998-03-31 00:59:37 +04:00
|
|
|
int start_x; /* position relative to menubar start */
|
2004-08-29 20:42:40 +04:00
|
|
|
const char *help_node;
|
2002-11-13 00:01:50 +03:00
|
|
|
} Menu;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
extern int menubar_visible;
|
|
|
|
|
|
|
|
/* The button bar menu */
|
2002-11-11 10:35:08 +03:00
|
|
|
typedef struct WMenu {
|
1998-02-27 07:54:42 +03:00
|
|
|
Widget widget;
|
|
|
|
|
|
|
|
int active; /* If the menubar is in use */
|
|
|
|
int dropped; /* If the menubar has dropped */
|
2002-11-13 00:01:50 +03:00
|
|
|
Menu **menu; /* The actual menus */
|
1998-02-27 07:54:42 +03:00
|
|
|
int items;
|
|
|
|
int selected; /* Selected menu on the top bar */
|
|
|
|
int subsel; /* Selected entry on the submenu */
|
|
|
|
int max_entry_len; /* Cache value for the columns in a box */
|
2003-09-13 11:43:20 +04:00
|
|
|
int previous_widget; /* Selected widget ID before activating menu */
|
1998-02-27 07:54:42 +03:00
|
|
|
} WMenu;
|
|
|
|
|
2004-08-29 20:42:40 +04:00
|
|
|
Menu *create_menu (const char *name, menu_entry *entries, int count,
|
|
|
|
const char *help_node);
|
2002-11-13 00:01:50 +03:00
|
|
|
void destroy_menu (Menu *menu);
|
|
|
|
WMenu *menubar_new (int y, int x, int cols, Menu *menu[], int items);
|
|
|
|
void menubar_arrange (WMenu *menubar);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#endif /* __MENU_H */
|
|
|
|
|