-
Notifications
You must be signed in to change notification settings - Fork 8
/
wingmenuplugin.h
84 lines (69 loc) · 1.91 KB
/
wingmenuplugin.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
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include "common.h"
#include <ilxqtpanelplugin.h>
#include <pluginsettings.h>
#include <QAction>
#include <QDialog>
#include <QMenu>
#include <QObject>
#include <QString>
#include <QToolButton>
#include <QWidget>
#include <QWidgetAction>
#include <QKeyEvent>
#include <XdgMenu>
namespace GlobalKeyShortcut
{
class Action;
}
class WingMenuWidget;
class WingMenuPlugin : public QObject, public ILXQtPanelPlugin
{
Q_OBJECT
public:
WingMenuPlugin(const ILXQtPanelPluginStartupInfo& startupInfo);
~WingMenuPlugin();
virtual QWidget* widget() override { return mWidget; }
virtual QString themeId() const override
{
return QStringLiteral("WingMenuPlugin");
}
virtual Flags flags() const override { return HaveConfigDialog; }
QDialog* configureDialog() override;
bool isSeparate() const override { return true; }
bool isExpandable() const override { return false; }
void realign() override;
void buildMenu();
void showMenu();
void hideMenu();
const GlobalKeyShortcut::Action* shortcut() { return mShortcut; };
private:
QToolButton* mWidget;
GlobalKeyShortcut::Action* mShortcut;
QMenu* mMenu;
WingMenuWidget* mMenuWidget;
QWidgetAction* mMenuAction;
AppLayout::Layout mAppLayout;
QString mMenuFile;
XdgMenu* mXdgMenu;
bool mShowIcon;
QString mIcon;
bool mShowText;
QString mText;
void settingsChanged() override;
void setupShortcut();
void showHideMenu();
void showHideMenuDelayed();
};
// ***************************************************
class WingMenuLibrary : public QObject, public ILXQtPanelPluginLibrary
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "lxqt.org/Panel/PluginInterface/3.0")
Q_INTERFACES(ILXQtPanelPluginLibrary)
public:
ILXQtPanelPlugin* instance(const ILXQtPanelPluginStartupInfo& startupInfo) const
{
return new WingMenuPlugin(startupInfo);
}
};