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 "Utils/Pimpl.h"
26 
27 #include "GUI/Utils/ContextMenu/ContextMenu.h"
28 
35  public MenuButton
36 {
37  Q_OBJECT
38  PIMPL(MenuToolButton)
39 
40 signals:
41  void sig_open();
42  void sig_new();
43  void sig_undo();
44  void sig_save();
45  void sig_save_as();
46  void sig_rename();
47  void sig_delete();
48  void sig_default();
49 
50 public:
51  explicit MenuToolButton(QWidget *parent=nullptr);
52  virtual ~MenuToolButton();
53 
58  void register_action(QAction* action);
59 
66 
67 private:
72  void show_menu(QPoint pos) override;
73 
78  bool prove_enabled() override;
79 
80 
81 public slots:
88  void show_action(ContextMenu::Entry entry, bool visible);
89 
95  void show_actions(ContextMenuEntries options);
96 
100  void show_all();
101 };
102 
103 #endif // MENUTOOL_H
int ContextMenuEntries
Combination of ContextMenu::Entry values.
Definition: ContextMenu.h:36
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.
void show_actions(ContextMenuEntries options)
shows all actions specified in options. Hide every other action calls ContextMenu::show_actions(Conte...
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:34
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