-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathapplicationsmenuapplet.h
73 lines (59 loc) · 1.25 KB
/
applicationsmenuapplet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef APPLICATIONSMENUAPPLET_H
#define APPLICATIONSMENUAPPLET_H
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtGui/QAction>
#include <QtGui/QPlastiqueStyle>
#include "applet.h"
class ApplicationsMenuStyle: public QPlastiqueStyle
{
Q_OBJECT
public:
int pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const;
};
class SubMenu
{
public:
SubMenu()
{
}
SubMenu(QMenu* parent, const QString& title, const QString& category, const QString& icon);
QMenu* menu()
{
return m_menu;
}
const QString& category() const
{
return m_category;
}
private:
QMenu* m_menu;
QString m_category;
};
class TextGraphicsItem;
class DesktopApplication;
class ApplicationsMenuApplet: public Applet
{
Q_OBJECT
public:
ApplicationsMenuApplet(PanelWindow* panelWindow);
~ApplicationsMenuApplet();
bool init();
QSize desiredSize();
void clicked();
protected:
void layoutChanged();
bool isHighlighted();
private slots:
void actionTriggered();
void applicationUpdated(const DesktopApplication& app);
void applicationRemoved(const QString& path);
private:
ApplicationsMenuStyle m_style;
TextGraphicsItem* m_textItem;
bool m_menuOpened;
QMenu* m_menu;
QList<SubMenu> m_subMenus;
QMap<QString, QAction*> m_actions;
};
#endif