Sayonara Player
MenuToolButton.h
1/* MenuToolButton.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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 "Utils/Pimpl.h"
25
26#include "Gui/Utils/Widgets/WidgetTemplate.h"
27#include "Gui/Utils/ContextMenu/ContextMenu.h"
28
29#include <QPushButton>
30
31namespace Gui
32{
33 class PreferenceAction;
34
41 public WidgetTemplate<QPushButton>
42 {
43 Q_OBJECT
44 PIMPL(MenuToolButton)
45
46 signals:
47 void sigOpen();
48 void sigNew();
49 void sigUndo();
50 void sigSave();
51 void sigSaveAs();
52 void sigRename();
53 void sigDelete();
54 void sigEdit();
55 void sigDefault();
56
57 public:
58 explicit MenuToolButton(QWidget* parent);
59 explicit MenuToolButton(QMenu* menu, QWidget* parent);
60 virtual ~MenuToolButton() override;
61
66 void registerAction(QAction* action);
67
73
80
81 void setOverrideText(bool b);
82
83
84 public slots:
91 void showAction(ContextMenu::Entry entry, bool visible);
92
99
103 void showAll();
104
105 private slots:
106 void mouseReleaseEvent(QMouseEvent* e) override;
107
108 private:
117 bool proveEnabled();
118
119 protected:
120 void languageChanged() override;
121 void skinChanged() override;
122 };
123}
124
125#endif // MENUTOOL_H
Entry
The Entry enum.
Definition: ContextMenu.h:55
This is the little button you often see near comboboxes It opens up a menu when clicked....
Definition: MenuToolButton.h:42
void registerPreferenceAction(Gui::PreferenceAction *action)
Use this to add a preference Action.
void showActions(ContextMenuEntries options)
shows all actions specified in options. Hide every other action calls ContextMenu::show_actions(Conte...
void showAll()
show all actions
Gui::ContextMenuEntries entries() const
get current visible entries in menu calls ContextMenu::get_entries()
void registerAction(QAction *action)
Use this to add custom actions.
void showAction(ContextMenu::Entry entry, bool visible)
show/hide an action calls ContextMenu::show_action(ContextMenu::Entry entry, bool visible)
A PreferenceAction can be added to each widget supporting QActions. When triggering this action,...
Definition: PreferenceAction.h:40
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
uint16_t ContextMenuEntries
Combination of ContextMenu::Entry values.
Definition: ContextMenu.h:37