Sayonara Player
MenuToolButton.h
1 /* MenuToolButton.h */
2 
3 /* Copyright (C) 2011-2019 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 namespace Gui
30 {
31  class PreferenceAction;
32 
39  public MenuButton
40  {
41  Q_OBJECT
42  PIMPL(MenuToolButton)
43 
44  signals:
45  void sig_open();
46  void sig_new();
47  void sig_undo();
48  void sig_save();
49  void sig_save_as();
50  void sig_rename();
51  void sig_delete();
52  void sig_edit();
53  void sig_default();
54 
55  public:
56  explicit MenuToolButton(QWidget* parent);
57  explicit MenuToolButton(QMenu* menu, QWidget *parent);
58  virtual ~MenuToolButton() override;
59 
64  void register_action(QAction* action);
65 
71 
78 
79  private:
84  void show_menu(QPoint pos) override;
85 
90  bool prove_enabled() override;
91 
92 
93  public slots:
100  void show_action(ContextMenu::Entry entry, bool visible);
101 
107  void show_actions(ContextMenuEntries options);
108 
112  void show_all();
113  };
114 }
115 
116 #endif // MENUTOOL_H
Gui::ContextMenu::Entry
Entry
The Entry enum.
Definition: ContextMenu.h:54
Gui::ContextMenuEntries
uint16_t ContextMenuEntries
Combination of ContextMenu::Entry values.
Definition: ContextMenu.h:37
Gui::MenuToolButton
This is the little button you often see near comboboxes It opens up a menu when clicked....
Definition: MenuToolButton.h:38
Gui::MenuButton
The MenuButton class. A button that sends a signal when clicked. This Class is meant for inheritance...
Definition: MenuButton.h:36
Gui::PreferenceAction
A PreferenceAction can be added to each widget supporting QActions. When triggering this action,...
Definition: PreferenceAction.h:38
Gui::MenuToolButton::register_action
void register_action(QAction *action)
Use this to add custom actions.
Gui::MenuToolButton::show_actions
void show_actions(ContextMenuEntries options)
shows all actions specified in options. Hide every other action calls ContextMenu::show_actions(Conte...
Gui::MenuToolButton::show_all
void show_all()
show all actions
Gui::MenuToolButton::show_action
void show_action(ContextMenu::Entry entry, bool visible)
show/hide an action calls ContextMenu::show_action(ContextMenu::Entry entry, bool visible)
Gui::MenuToolButton::register_preference_action
void register_preference_action(Gui::PreferenceAction *action)
Use this to add a preference Action.
Gui::MenuToolButton::get_entries
Gui::ContextMenuEntries get_entries() const
get current visible entries in menu calls ContextMenu::get_entries()