From 71737f70949bd25f9aa8bc4e7d03039ba83c6cb1 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Thu, 4 Sep 2014 11:42:13 -0400 Subject: Initial import of the lumina code from pcbsd git repo --- lumina-desktop/panel-plugins/systemtray/LSysTray.h | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 lumina-desktop/panel-plugins/systemtray/LSysTray.h (limited to 'lumina-desktop/panel-plugins/systemtray/LSysTray.h') diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.h b/lumina-desktop/panel-plugins/systemtray/LSysTray.h new file mode 100644 index 00000000..13eb0df1 --- /dev/null +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.h @@ -0,0 +1,76 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2012, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_SYSTRAY_H +#define _LUMINA_DESKTOP_SYSTRAY_H + +//Qt includes +#include +#include +#include +#include +#include +#include + +//Local includes +#include "../LPPlugin.h" +#include "TrayIcon.h" + +//SYSTEM TRAY STANDARD DEFINITIONS +#define SYSTEM_TRAY_REQUEST_DOCK 0 +#define SYSTEM_TRAY_BEGIN_MESSAGE 1 +#define SYSTEM_TRAY_CANCEL_MESSAGE 2 + +class LSysTray : public LPPlugin{ + Q_OBJECT +public: + LSysTray(QWidget *parent = 0, QString id="systemtray", bool horizontal=true); + ~LSysTray(); + + void start(); + void stop(); + +private: + bool isRunning; + QList trayIcons; + QFrame *frame; + QBoxLayout *LI; //layout items + WId TrayID; + QTimer *upTimer; //manual timer to force refresh of all items + +private slots: + void checkXEvent(XEvent *event); + void closeAll(); + void checkAll(); + + void initialTrayIconDetect(); //initial scan for previously running tray apps + void addTrayIcon(WId win); + void removeTrayIcon(WId win); + + void updateStatus(); + void trayAppClosed(); + +public slots: + virtual void OrientationChange(){ + //make sure the internal layout has the same orientation as the main widget + LI->setDirection( this->layout()->direction() ); + //Re-adjust the maximum widget size + int sz; + if(this->layout()->direction()==QBoxLayout::LeftToRight){ + this->setMaximumSize( trayIcons.length()*this->height(), 10000); + sz = this->height()-2*frame->frameWidth(); + }else{ + this->setMaximumSize(10000, trayIcons.length()*this->width()); + sz = this->width()-2*frame->frameWidth(); + } + for(int i=0; isetSizeSquare(sz); + trayIcons[i]->repaint(); + } + } +}; + +#endif -- cgit