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 
29 class PreferenceAction;
30 
37  public MenuButton
38 {
39  Q_OBJECT
40  PIMPL(MenuToolButton)
41 
42 signals:
43  void sig_open();
44  void sig_new();
45  void sig_undo();
46  void sig_save();
47  void sig_save_as();
48  void sig_rename();
49  void sig_delete();
50  void sig_default();
51 
52 public:
53  explicit MenuToolButton(QWidget *parent=nullptr);
54  virtual ~MenuToolButton();
55 
60  void register_action(QAction* action);
61 
67 
74 
75 private:
80  void show_menu(QPoint pos) override;
81 
86  bool prove_enabled() override;
87 
88 
89 public slots:
96  void show_action(ContextMenu::Entry entry, bool visible);
97 
103  void show_actions(ContextMenuEntries options);
104 
108  void show_all();
109 };
110 
111 #endif // MENUTOOL_H
void show_all()
show all actions
uint16_t ContextMenuEntries
Combination of ContextMenu::Entry values.
Definition: ContextMenu.h:35
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:52
void register_action(QAction *action)
Use this to add custom actions.
Definition: PreferenceAction.h:30
void show_actions(ContextMenuEntries options)
shows all actions specified in options. Hide every other action calls ContextMenu::show_actions(Conte...
void register_preference_action(PreferenceAction *action)
Use this to add a preference Action.
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:36
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