aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
blob: 0934374f1bf867e68e6f2b64e306770007214236 (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
//===========================================
//  Lumina-desktop source code
//  Copyright (c) 2018, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
// This is the Widgets version of a generic plugin
//===========================================
#ifndef _DESKTOP_WIDGETS_GENERIC_PLUGIN_H
#define _DESKTOP_WIDGETS_GENERIC_PLUGIN_H

#include <global-includes.h>

//Base plugin type for a canvas/widget
class Plugin : public QWidget{
	Q_OBJECT
private:
	bool isPanelPlugin;
	bool isVertical; //only used for panel plugins
	QString _id;

signals:
	void orientationChanged();

public:
	Plugin(QWidget *parent, QString id, bool panelplug = false) : QWidget(parent){
	  isPanelPlugin = panelplug;
	  isVertical = false;
	  _id = id;
	}

	void setVertical(bool set){
	  if(set!=isVertical){ isVertical = set; emit orientationChanged(); }
	}

	QString id(){ return _id; }

private slots:

};

//Special subclass for a button-based plugin
class PluginButton : public Plugin{
	Q_OBJECT
private:
	QToolButton *button;

public:
	PluginButton(QWidget *parent, QString id, bool panelplug=false) : Plugin(parent, id, panelplug) {
	  button = new QToolButton(this);
	  this->setLayout( new QBoxLayout(QBoxLayout::LeftToRight) );
	  this->layout()->setContentsMargins(0,0,0,0);
	  this->layout()->addWidget(button);
	}

	~PluginButton(){}
};
#endif
bgstack15