aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/NativeWindow.cpp
blob: bd42ecaac29556189165abc839ace8ef9f1b962c (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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2017, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include "NativeWindow.h"

// === PUBLIC ===
NativeWindow::NativeWindow(WId id) : QObject(){
  winid = id;
  WIN = QWindow::fromWinId(winid);
}

NativeWindow::~NativeWindow(){
  hash.clear();
  //WIN->deleteLater(); //This class only deals with Native windows which were created outside the app - they need to be cleaned up outside the app too
}

WId NativeWindow::id(){
  return winid;
}

QWindow* NativeWindow::window(){
  return WIN;
}

QVariant NativeWindow::property(NativeWindow::Property prop){
  if(hash.contains(prop)){ return hash.value(prop); }
  return QVariant(); //null variant
}

void NativeWindow::setProperty(NativeWindow::Property prop, QVariant val){
  if(prop == NativeWindow::None){ return; }
  hash.insert(prop, val);
  emit PropertyChanged(prop, val);
}
bgstack15