From 7b03f5af04943e2de6f3041e67be23280219a238 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 19 Dec 2017 23:54:07 -0500 Subject: Add a new C++ object: PanelObject This is tied into the RootDesktopObject as well as the ScreenObject, resulting in global-session panels as well as per-screen panels. --- .../src-desktop/src-cpp/PanelObject.cpp | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp new file mode 100644 index 00000000..471da58f --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp @@ -0,0 +1,44 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "PanelObject.h" +#include +#include + +PanelObject::PanelObject(QString id, QObject *parent) : QObject(parent){ + panel_id = id; +} + +void PanelObject::RegisterType(){ + static bool done = false; + if(done){ return; } + done=true; + qmlRegisterType("Lumina.Backend.PanelObject",2,0, "PanelObject"); +} + +QString PanelObject::name(){ return panel_id; } +QString PanelObject::background(){ + if(bg.isEmpty()){ return "transparent"; } + return bg; +} +int PanelObject::x(){ return geom.x(); } +int PanelObject::y(){ return geom.y(); } +int PanelObject::width(){ return geom.width(); } +int PanelObject::height(){ return geom.height(); } + +void PanelObject::setBackground(QString fileOrColor){ + if(bg!=fileOrColor){ + bg = fileOrColor; + emit backgroundChanged(); + } +} + +void PanelObject::setGeometry( QRect newgeom ){ + if(geom!=newgeom){ + geom = newgeom; + emit geomChanged(); + } +} -- cgit