-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmenu_manager.h
More file actions
48 lines (38 loc) · 1.37 KB
/
menu_manager.h
File metadata and controls
48 lines (38 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef MENU_MANAGER_H
#define MENU_MANAGER_H
#include <QUndoGroup>
#include "menus/abstract_menu_item.h"
#include "events/event_types.h"
class QMenuBar;
class main_window;
class menu_manager : public QObject
{
Q_OBJECT
public:
explicit menu_manager(main_window *parent, QMenuBar *m, QUndoGroup *u);
~menu_manager();
void connect_to_widget(QObject *object, event_types event){ event_map[event] = object; }
void group_connect_to_widget(QObject *object, event_types event);
public slots:
void post_event(QEvent *event);
private:
typedef QKeySequence hotkey;
QMenuBar *menu_bar;
QList<QMenu *> menu_list;
QMap<event_types, QObject *> event_map;
static main_window *window;
void create_menus();
void create_actions(QUndoGroup *undo_group);
QMenu *find_menu(QString id);
void enable_checkable(QActionGroup *group);
void check_enabled(QMenu *menu);
template <typename T, typename S>
void add_toggle_action(QString text, S type, toggle_function toggle, hotkey key, QMenu *menu);
template <typename T, typename S>
void add_action(QString text, S type, hotkey key, QMenu *menu);
template <typename T, typename S>
void add_check_action(QString text, S type, hotkey key, QMenu *menu);
template <typename T, typename S>
void add_group_action(QString text, S type, hotkey key, QMenu *menu, QActionGroup *group);
};
#endif // MENU_MANAGER_H