1 //=========================================== 2 // Lumina-DE source code 3 // Copyright (c) 2014, Ken Moore 4 // Available under the 3-clause BSD license 5 // See the LICENSE file for full details 6 //=========================================== 7 // Note: The basic idea behind this class that that it puts the app window 8 // in the same spot as the tray icon (to directly pass mouse events and such), 9 // while keeping the tray icon visual in sync with the app window 10 //=========================================== 11 #ifndef _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H 12 #define _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H 13 14 //Qt includes 15 #include <QWidget> 16 #include <QTimer> 17 #include <QPaintEvent> 18 #include <QMoveEvent> 19 #include <QResizeEvent> 20 #include <QPainter> 21 #include <QPixmap> 22 #include <QImage> 23 //#include <QWindow> 24 // libLumina includes 25 //#include <LuminaX11.h> 26 27 class TrayIcon : public QWidget{ 28 Q_OBJECT 29 public: 30 TrayIcon(QWidget* parent = 0); 31 ~TrayIcon(); 32 33 void cleanup(); //about to be removed after window was detroyed 34 35 WId appID(); //the ID for the attached application 36 void attachApp(WId id); 37 void setSizeSquare(int side); 38 39 public slots: 40 void detachApp(); 41 void updateIcon(); 42 43 private: 44 WId IID, AID; //icon ID and app ID 45 int badpaints; 46 uint dmgID; 47 int scalefactor; 48 49 protected: 50 void paintEvent(QPaintEvent *event); 51 void resizeEvent(QResizeEvent *event); 52 53 signals: 54 void BadIcon(); 55 }; 56 #endif 57