Sayonara Player
MenuTool.h
1 /* MenuTool.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef MENUTOOL_H
24 #define MENUTOOL_H
25 
26 #include <QMenu>
27 
28 #include <QMouseEvent>
29 #include <QList>
30 #include <QAction>
31 #include <QTimer>
32 
33 #include "MenuButton.h"
34 #include "GUI/Helper/ContextMenu/ContextMenu.h"
35 
41 class MenuToolButton : public MenuButton {
42 
43  Q_OBJECT
44 
45 signals:
46  void sig_open();
47  void sig_new();
48  void sig_undo();
49  void sig_save();
50  void sig_save_as();
51  void sig_rename();
52  void sig_delete();
53 
54 public:
55  MenuToolButton(QWidget *parent=nullptr);
56  virtual ~MenuToolButton();
57 
62  void register_action(QAction* action);
63 
70 
71 private:
72  ContextMenu* _menu=nullptr;
73 
78  void show_menu(QPoint pos) override;
79 
84  bool prove_enabled() override;
85 
86 
87 public slots:
94  void show_action(ContextMenu::Entry entry, bool visible);
95 
101  void show_actions(ContextMenuEntries options);
102 
106  void show_all();
107 
108 };
109 
110 
111 
112 
113 #endif // MENUTOOL_H
void show_all()
show all actions
void show_action(ContextMenu::Entry entry, bool visible)
show/hide an action calls ContextMenu::show_action(ContextMenu::Entry entry, bool visible) ...
Entry
The Entry enum.
Definition: ContextMenu.h:55
void register_action(QAction *action)
Use this to add custom actions.
A context menu with some standard actions.
Definition: ContextMenu.h:44
void show_actions(ContextMenuEntries options)
shows all actions specified in options. Hide every other action calls ContextMenu::show_actions(Conte...
int ContextMenuEntries
Combination of ContextMenu::Entry values.
Definition: ContextMenu.h:32
This is the little button you often see near comboboxes It opens up a menu when clicked. The actions in the menu a configurable.
Definition: MenuTool.h:41
The MenuButton class. A button that sends a signal when clicked. This Class is meant for inheritance...
Definition: MenuButton.h:39
ContextMenuEntries get_entries() const
get current visible entries in menu calls ContextMenu::get_entries()