diff options
author | Ken Moore <ken@ixsystems.com> | 2017-01-04 16:44:55 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-01-04 16:44:55 -0500 |
commit | 25b2e77aa2395ba9143683a5ce1a27b99ee7a211 (patch) | |
tree | bbd732bb72689b9b46dfc619d3d0e1748f7e435b /src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h | |
parent | Tag version 1.2.1 on the master branch in preparation for new changes from th... (diff) | |
download | lumina-25b2e77aa2395ba9143683a5ce1a27b99ee7a211.tar.gz lumina-25b2e77aa2395ba9143683a5ce1a27b99ee7a211.tar.bz2 lumina-25b2e77aa2395ba9143683a5ce1a27b99ee7a211.zip |
Create a new "lumina-desktop-unified" core subproject (DO NOT USE)
This is just a staging area for the merging of the desktop, window manager, etc.. into a single unified application. It is highly fragmented right now and will not build *AT ALL* for a while.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h new file mode 100644 index 00000000..560e5811 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h @@ -0,0 +1,71 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2013, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_TOOLBAR_WIDGET_H +#define _LUMINA_TOOLBAR_WIDGET_H + +#include <QToolButton> +#include <QEvent> +#include <QWheelEvent> + +#include "Globals.h" +#include <LuminaX11.h> + +class LTBWidget : public QToolButton{ + Q_OBJECT + +private: + LXCB::WINDOWVISIBILITY cstate; + //QString rawstyle; + void updateBackground(){ + //QString background = "background: transparent; "; //default value + //QString border = "border: 1px solid transparent;"; + if(cstate == LXCB::IGNORE){ this->setObjectName(""); } //just use the defaults + else if(cstate == LXCB::VISIBLE){ this->setObjectName("WindowVisible"); }//background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(255, 255, 255, 240), stop:0.505682 rgba(240, 240, 240, 150), stop:1 rgba(210, 210, 210, 55));"; border="border: 1px solid transparent;"; } + else if(cstate == LXCB::INVISIBLE){this->setObjectName("WindowInvisible"); } //background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(215, 215, 215, 240), stop:0.505682 rgba(184, 185, 186, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } + else if(cstate == LXCB::ACTIVE){ this->setObjectName("WindowActive"); }//background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(241, 233, 156, 240), stop:0.355682 rgba(255, 243, 127, 150), stop:1 rgba(221, 246, 255, 55));"; border ="border: 1px solid transparent;"; } + else if(cstate == LXCB::ATTENTION){ this->setObjectName("WindowAttention"); }//background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(252, 187, 127, 240), stop:0.505682 rgba(255, 222, 197, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } + this->setStyleSheet(""); //force the object to re-evaluate the current theme stylesheet and update visuals + //QString raw = rawstyle; + //this->setStyleSheet( raw.replace("%1",background).replace("%2", border) ); + } + +signals: + + void wheelScroll(int change); + +public: + LTBWidget(QWidget* parent) : QToolButton(parent){ + //this->setStyleSheet( this->styleSheet()+" LTBWidget::menu-indicator{image: none;}"); + cstate = LXCB::IGNORE; + + this->setPopupMode(QToolButton::InstantPopup); + this->setAutoRaise(true); + + //rawstyle = "LTBWidget{ %1 %2 border-radius: 5px;} LTBWidget::menu-indicator{image: none;} LTBWidget::hover{ %1 border: 1px solid black; border-radius: 5px; } LTBWidget::menu-button{ background: transparent; width: 15px; } LTBWidget[popupMode=\"1\"]{%1 %2 border-radius: 5px; padding-right: 15px;} LTBWidget[popupMode=\"1\"]::hover{%1 border: 1px solid black; border-radius: 5px; padding-right: 15px}"; + updateBackground(); + } + + ~LTBWidget(){ + } + + void setState(LXCB::WINDOWVISIBILITY newstate){ + cstate = newstate; + updateBackground(); + } + +public slots: + + +protected: + void wheelEvent(QWheelEvent *event){ + int change = event->delta()/120; // 1/15th of a rotation (delta/120) is usually one "click" of the wheel + emit wheelScroll(change); + } + +}; + +#endif |