aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/systemtray/TrayIcon.h
blob: 97f2fdf560ac57e50085b65e834ab08bf39bc6af (plain)
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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
//  Note: The basic idea behind this class that that it puts the app window
//    in the same spot as the tray icon (to directly pass mouse events and such), 
//    while keeping the tray icon visual in sync with the app window
//===========================================
#ifndef _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H
#define _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H

//Qt includes
#include <QWidget>
#include <QTimer>
#include <QPaintEvent>
#include <QMoveEvent>
#include <QResizeEvent>
#include <QPainter>
#include <QPixmap>
#include <QImage>

// libLumina includes
#include <LuminaX11.h>

//Local includes

class TrayIcon : public QWidget{
	Q_OBJECT
public:
	TrayIcon(QWidget* parent = 0);
	~TrayIcon();

	WId appID(); //the ID for the attached application
	void attachApp(WId id);
	void setSizeSquare(int side);

public slots:
	void detachApp();
	void updateIcon();

private:
	WId IID, AID; //icon ID and app ID

private slots:
	void slotAttach(); //so that the attachment can be done in a new thread
	

protected:
	void paintEvent(QPaintEvent *event);
	//void moveEvent(QMoveEvent *event);
	void resizeEvent(QResizeEvent *event);
	//bool x11Event(XEvent *event);

signals:
	void AppClosed();
	void AppAttached();
};
#endif
bgstack15