diff options
author | Ken Moore <moorekou@gmail.com> | 2016-04-25 13:08:12 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-04-25 13:08:12 -0400 |
commit | ed5ecf7ea7a482b4649e66ecb35fbc60af680684 (patch) | |
tree | acc0fa17d228259e847f55c678db9fb0a9b50f0c /src-qt5/core/lumina-desktop/panel-plugins/LPPlugin.h | |
parent | Merge branch 'master' of github.com:pcbsd/lumina (diff) | |
download | lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.gz lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.bz2 lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.zip |
Rearrange the Lumina source tree quite a bit:
Now the utilites are arranged by category (core, core-utils, desktop-utils), so all the -utils may be excluded by a package system (or turned into separate packages) as needed.
Diffstat (limited to 'src-qt5/core/lumina-desktop/panel-plugins/LPPlugin.h')
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/LPPlugin.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/LPPlugin.h b/src-qt5/core/lumina-desktop/panel-plugins/LPPlugin.h new file mode 100644 index 00000000..c4c76297 --- /dev/null +++ b/src-qt5/core/lumina-desktop/panel-plugins/LPPlugin.h @@ -0,0 +1,77 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014-2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This class is the generic container layout for all panel plugins +// Simply subclass this when creating a new plugin to enable correct +// visibility and usage within a panel +//=========================================== +#ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_H +#define _LUMINA_DESKTOP_PANEL_PLUGIN_H + +#include <QObject> +#include <QWidget> +#include <QString> +#include <QBoxLayout> +#include <QApplication> + +class LPPlugin : public QWidget{ + Q_OBJECT + +private: + QBoxLayout *LY; + QString plugintype; + +public: + LPPlugin(QWidget *parent = 0, QString ptype="unknown", bool horizontal = true) : QWidget(parent){ + plugintype=ptype; + this->setContentsMargins(1,1,1,1); + this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + this->setFocusPolicy(Qt::NoFocus); //no keyboard focus on the panel/plugins + if(horizontal){LY = new QBoxLayout(QBoxLayout::LeftToRight, this); } + else{ LY = new QBoxLayout(QBoxLayout::TopToBottom, this); } + this->setObjectName(ptype.section("---",0,0)); + LY->setContentsMargins(0,0,0,0); + LY->setSpacing(1); + this->setLayout(LY); + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); + connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(ThemeChange()) ); + } + + ~LPPlugin(){ + } + + QBoxLayout* layout(){ + return LY; + } + + QString type(){ + return plugintype; + } + + virtual void AboutToClose(){ + //This needs to be re-implemented in the subclasses plugin + //This is for any last-minute cleanup before the plugin gets deleted + } + +public slots: + virtual void LocaleChange(){ + //This needs to be re-implemented in the subclassed plugin + //This is where all text is set/translated + } + virtual void ThemeChange(){ + //This needs to be re-implemented in the subclasses plugin + //This is where all the visuals are set if using Theme-dependant icons. + } + virtual void OrientationChange(){ + //This needs to be re-implemented in the subclasses plugin + //This is where any horizontal/vertical orientations can be changed appropriately + } + +signals: + void MenuClosed(); //This needs to be emitted when any plugin's menu is closed for some reason (check/set focus properly) +}; + +#endif |