mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
4f00496233
like buttons use menu entries hotkey_t. But menus are staticly defined, so this change is much bigger. All menu declaration must be edited. follow standard changes in drawing and handling hotkeys. now basic mc's functions works in utf-8, remain correct calculation of controls width in dialogs, replace functions like tolower, toupper,isspace, ... width functions from strutil or g_ascii variant.
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
#ifndef MC_MENU_H
|
|
#define MC_MENU_H
|
|
|
|
#include "widget.h"
|
|
|
|
typedef void (*callfn) (void);
|
|
|
|
typedef struct {
|
|
char first_letter;
|
|
const char *label;
|
|
struct hotkey_t text;
|
|
callfn call_back;
|
|
} menu_entry;
|
|
|
|
typedef struct Menu {
|
|
struct hotkey_t text;
|
|
int count;
|
|
int max_entry_len;
|
|
int selected;
|
|
menu_entry *entries;
|
|
int start_x; /* position relative to menubar start */
|
|
char *help_node;
|
|
} Menu;
|
|
|
|
extern int menubar_visible;
|
|
|
|
/* The button bar menu */
|
|
typedef struct WMenu {
|
|
Widget widget;
|
|
|
|
int active; /* If the menubar is in use */
|
|
int dropped; /* If the menubar has dropped */
|
|
Menu **menu; /* The actual menus */
|
|
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 */
|
|
int previous_widget; /* Selected widget ID before activating menu */
|
|
} WMenu;
|
|
|
|
Menu *create_menu (const char *name, menu_entry *entries, int count,
|
|
const char *help_node);
|
|
void destroy_menu (Menu *menu);
|
|
WMenu *menubar_new (int y, int x, int cols, Menu *menu[], int items);
|
|
void menubar_arrange (WMenu *menubar);
|
|
|
|
#endif
|