aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-glwidgets/glw-widget.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-09 22:28:38 -0400
committerKen Moore <ken@ixsystems.com>2017-10-09 22:28:38 -0400
commit4723568e850cf593b2212054a766c5d7b6051739 (patch)
tree97c6eeaa89a32666a95b12d31cd59eff960637e4 /src-qt5/src-glwidgets/glw-widget.cpp
parentRead the default app desktop files from full path to fix settings persistance... (diff)
downloadlumina-4723568e850cf593b2212054a766c5d7b6051739.tar.gz
lumina-4723568e850cf593b2212054a766c5d7b6051739.tar.bz2
lumina-4723568e850cf593b2212054a766c5d7b6051739.zip
Remove the src-glwidgets tree. No longer needed since it has been replaced by the src-qml source tree.
Diffstat (limited to 'src-qt5/src-glwidgets/glw-widget.cpp')
-rw-r--r--src-qt5/src-glwidgets/glw-widget.cpp115
1 files changed, 0 insertions, 115 deletions
diff --git a/src-qt5/src-glwidgets/glw-widget.cpp b/src-qt5/src-glwidgets/glw-widget.cpp
deleted file mode 100644
index e8d255b9..00000000
--- a/src-qt5/src-glwidgets/glw-widget.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//===========================================
-// Lumina-desktop source code
-// Copyright (c) 2017, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#include "glw-widget.h"
-#include <QDebug>
-
-// --- PUBLIC ---
-GLW_Widget::GLW_Widget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f){
- glw_base = 0;
- draggable = false;
- drag_offset = QPoint();
-}
-
-GLW_Widget::~GLW_Widget(){
-
-}
-
-QRect GLW_Widget::widgetRect(){
- QPoint pos = this->mapTo(glw_base, QPoint(0,0));
- return QRect(pos, this->size());
-}
-
-bool GLW_Widget::mouseOverWidget(){
- return (glw_base->mouseOverWidget()==this);
-}
-
-void GLW_Widget::setGLBase(GLW_Base *base){
- if(glw_base!=0){ this->disconnect(glw_base, SLOT(repaintArea(QRect))); }
- glw_base=base;
- connect(this, SIGNAL(repaintArea(QRect)), glw_base, SLOT(repaintArea(QRect)) );
-}
-
-void GLW_Widget::paintYourself(QStylePainter *painter, const QRect *prect){
- QRect rect = widgetRect();
- rect = prect->intersected(rect);
- QColor color( mouseOverWidget() ? Qt::gray : Qt::yellow);
- //if(this->windowOpacity()!=1.0){ qDebug() << "Opacity:" << this->windowOpacity(); }
- //color.setAlpha( qRound(this->windowOpacity()*255) );
- color.setAlpha( 125);
- painter->fillRect(rect, color);
-}
-
-void GLW_Widget::paintChildren(QStylePainter *painter, const QRect *prect){
- QObjectList child = this->children(); //Note: This is returned in stacking order (lowest -> highest)
- for(int i=0; i<child.length(); i++){
- if( !child[i]->isWidgetType() ){ continue; } //not a widget
- GLW_Widget *glww = qobject_cast<GLW_Widget*>(child[i]);
- if(glww!=0){
- if( !prect->intersected(glww->widgetRect()).isNull() ){
- glww->paintYourself(painter, prect);
- glww->paintChildren(painter,prect);
- }
- }
- }
-}
-
-
-// --- PROTECTED ---
-void GLW_Widget::enterEvent(QEvent*){
- if(!mouseOverWidget()){ glw_base->setMouseOverWidget(this); }
- this->update();
-}
-
-void GLW_Widget::leaveEvent(QEvent*){
- if(mouseOverWidget()){ glw_base->setMouseOverWidget(0); }
- this->update();
-}
-
-void GLW_Widget::mousePressEvent(QMouseEvent *ev){
- if(!draggable){ QWidget::mousePressEvent(ev); return; }
- if(ev->button()==Qt::LeftButton){
- drag_offset = ev->pos();
- }
-}
-
-void GLW_Widget::mouseReleaseEvent(QMouseEvent *ev){
- if(!draggable){ QWidget::mouseReleaseEvent(ev); return; }
- if(ev->button()==Qt::LeftButton){
- if(drag_offset!=ev->pos()){ emit doneDragging(); }
- drag_offset = QPoint(); } //reset offset
-}
-
-void GLW_Widget::mouseMoveEvent(QMouseEvent *ev){
- if(!mouseOverWidget()){ glw_base->setMouseOverWidget(this); }
- if(!draggable){ QWidget::mouseMoveEvent(ev); return; }
- if(!drag_offset.isNull()){
- this->move( this->mapTo(glw_base, ev->pos()-drag_offset) );
- }
-}
-
-
-void GLW_Widget::moveEvent(QMoveEvent *ev){
- QRect oldgeom = QRect(ev->oldPos(), this->size());
- QRect newgeom = QRect(ev->pos(), this->size());
- emit repaintArea( oldgeom.united(newgeom) );
-}
-
-void GLW_Widget::resizeEvent(QResizeEvent *ev){
- if(glw_base==0){ return; }
- QPoint pos = this->mapTo(glw_base, QPoint(0,0));
- QSize sz = ev->oldSize();
- if(ev->size().width() > sz.width()){ sz.setWidth(ev->size().width()); }
- if(ev->size().height() > sz.height()){ sz.setHeight(ev->size().height()); }
- emit repaintArea(QRect(pos, sz));
-}
-
-void GLW_Widget::paintEvent(QPaintEvent *ev){
- //qDebug() << "Got paint event:" << ev->rect();
- QPoint pos = this->mapTo(glw_base, ev->rect().topLeft());
- emit repaintArea(QRect(pos, ev->rect().size()) );
- return;
-}
bgstack15