aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h
blob: af9250b71cd0998af27299b0cc7fca672994fae7 (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
61
62
63
64
65
66
67
68
69
70
71
72
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, Susanne Jaeckel
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_DESKTOP_SWITCHER_H
#define _LUMINA_DESKTOP_SWITCHER_H

#include <QTimer>
#include <QWidget>
#include <QString>
//#include <QX11Info>
#include <QMenu>
#include <QToolButton>

#include <LUtils.h>
#include <LuminaXDG.h>
#include <LuminaX11.h>

//#include "../LTBWidget.h"
#include "../LPPlugin.h"

//#include <X11/Xlib.h>
//#include <X11/Xutil.h>
//#include <X11/Xatom.h>

class LDesktopSwitcher : public LPPlugin{
	Q_OBJECT
public:
	LDesktopSwitcher(QWidget *parent = 0, QString id = "desktopswitcher", bool horizontal=true);
	~LDesktopSwitcher();
	
private:
	QTimer *timer;
	QToolButton *label;
	QMenu *menu;
	int iconOld;

	//void setNumberOfDesktops(int);
	//void setCurrentDesktop(int);
	//int getNumberOfDesktops();
	//int getCurrentDesktop();


	QAction* newAction(int, QString);
	
private slots:
	void openMenu();
	void createMenu();
	void menuActionTriggered(QAction*);

public slots:
	void LocaleChange(){
	  createMenu();
	}
	
	void OrientationChange(){
	  QSize sz;
	  if(this->layout()->direction()==QBoxLayout::LeftToRight){
	    this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
	    sz = QSize(this->height(), this->height());
	  }else{
	    this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
	    sz = QSize(this->width(), this->width());
	  }
	  label->setIconSize(sz);
	  this->layout()->update();
	}
};

#endif
bgstack15