Sayonara Player
MenuTool.h
1 /* MenuTool.h */
2 
3 /* Copyright (C) 2011-2017 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 #ifndef MENUTOOL_H
22 #define MENUTOOL_H
23 
24 #include "MenuButton.h"
25 #include "GUI/Helper/ContextMenu/ContextMenu.h"
26 
32 class MenuToolButton : public MenuButton
33 {
34  Q_OBJECT
35 
36 signals:
37  void sig_open();
38  void sig_new();
39  void sig_undo();
40  void sig_save();
41  void sig_save_as();
42  void sig_rename();
43  void sig_delete();
44  void sig_default();
45 
46 public:
47  explicit MenuToolButton(QWidget *parent=nullptr);
48  virtual ~MenuToolButton();
49 
54  void register_action(QAction* action);
55 
62 
63 private:
64  ContextMenu* _menu=nullptr;
65 
70  void show_menu(QPoint pos) override;
71 
76  bool prove_enabled() override;
77 
78 
79 public slots:
86  void show_action(ContextMenu::Entry entry, bool visible);
87 
93  void show_actions(ContextMenuEntries options);
94 
98  void show_all();
99 };
100 
101 #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:53
void register_action(QAction *action)
Use this to add custom actions.
A context menu with some standard actions.
Definition: ContextMenu.h:42
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:30
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:32
ContextMenuEntries get_entries() const
get current visible entries in menu calls ContextMenu::get_entries()
The MenuButton class. A button that sends a signal when clicked. This Class is meant for inheritance...
Definition: MenuButton.h:34