aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
blob: 471da58fe0847c639136f8edaad82ab8d5e4c192 (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
//===========================================
//  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 <QQmlEngine>
#include <QDebug>

PanelObject::PanelObject(QString id, QObject *parent) : QObject(parent){
  panel_id = id;
}

void PanelObject::RegisterType(){
  static bool done = false;
  if(done){ return; }
  done=true;
  qmlRegisterType<PanelObject>("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();
  }
}
bgstack15