Sayonara Player
MenuButton.h
1 /* MenuButton.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef MENUBUTTON_H
24 #define MENUBUTTON_H
25 
26 #include <QPushButton>
27 #include <QShowEvent>
28 #include <QFocusEvent>
29 #include <QMouseEvent>
30 #include <QMenu>
31 #include "Helper/Settings/SayonaraClass.h"
32 
39 class MenuButton :
40  public QPushButton,
41  protected SayonaraClass
42 {
43 
44  Q_OBJECT
45 
46 signals:
47  void sig_triggered(QPoint);
48 
49 protected:
50  virtual void mouseReleaseEvent(QMouseEvent *e) override;
51  virtual void mousePressEvent(QMouseEvent* e) override;
52  virtual void enterEvent(QEvent* e) override;
53  virtual void leaveEvent(QEvent* e) override;
54 
59  virtual void show_menu(QPoint pos);
60 
66  virtual bool prove_enabled();
67 
71  void set_std_icon();
72 
73 public:
74  MenuButton(QWidget* parent=nullptr);
75  virtual ~MenuButton();
76 
77 protected slots:
78  void _sl_skin_changed();
79 };
80 
81 #endif // MENUBUTTON_H
virtual bool prove_enabled()
subclasses should reimplement this function. This method should return false if the button should be ...
void set_std_icon()
sets the icon depending on the skin
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
virtual void show_menu(QPoint pos)
subclasses should call this function and show their menu
The MenuButton class. A button that sends a signal when clicked. This Class is meant for inheritance...
Definition: MenuButton.h:39