diff options
-rw-r--r-- | lumina-wm-INCOMPLETE/LWindow.cpp | 105 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LWindow.h | 67 |
2 files changed, 172 insertions, 0 deletions
diff --git a/lumina-wm-INCOMPLETE/LWindow.cpp b/lumina-wm-INCOMPLETE/LWindow.cpp new file mode 100644 index 00000000..3d15393d --- /dev/null +++ b/lumina-wm-INCOMPLETE/LWindow.cpp @@ -0,0 +1,105 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LWindow.h" + +LWindow::LWindow(WId client) : QFrame(){ + activeState = LWindow::Normal; + this->setMouseTracking(true); //need this to determine mouse location when not clicked + this->setObjectName("LWindowFrame"); + this->setWindowFlags(Qt::Window | Qt::X11BypassWindowManagerHint); //ensure that this frame does not get a frame itself + InitWindow(); //initially create all the child widgets + updateAppearance(); //this loads the appearance based on window/theme settings +} + +LWindow::~LWindow(){ + +} + +// ================= +// PUBLIC +// ================= +//Return the ID of the managed window for the current graphics system (X11/Wayland/other) +WId LWindow::clientID(){ return CID; } + +bool LWindow::hasFrame(){ return this->isEnabled(); } + +// ================= +// PRIVATE +// ================= +void LWindow::InitWindow(){ + titleBar = new QLabel(this); //This is the "container" for all the title buttons/widgets + titleBar->setObjectName("TitleBar"); + title = new QLabel(this); //Shows the window title/text + title->setObjectName("Title"); + title->setCursor(Qt::SizeAllCursor); + icon = new QLabel(this); //Contains the window icon + icon->setObjectName("Icon"); + minB = new QToolButton(this); //Minimize Button + minB->setObjectName("Minimize"); + connect(minB, SIGNAL(clicked()), this, SLOT(minClicked()) ); + maxB = new QToolButton(this); //Maximize Button + maxB->setObjectName("Maximize"); + connect(maxB, SIGNAL(clicked()), this, SLOT(maxClicked()) ); + closeB = new QToolButton(this); + closeB->setObjectName("Close"); + connect(closeB, SIGNAL(clicked()), this, SLOT(closeClicked()) ); + otherB = new QToolButton(this); //Button to place any other actions + otherB->setObjectName("Options"); + otherB->setToolButtonPopupMode(QToolButton::InstantPopup); + otherM = new QMenu(this); //menu of "other" actions for the window + otherB->setMenu(otherM); + connect(otherM, SIGNAL(triggered(QAction*)), this, SLOT(otherClicked(QAction*)) ); +} + +ModStatus LWindow::getStateAtPoint(QPoint pt){ + +} + +void LWindow::setMouseCursor(ModStatus state){ + +} + +// ================= +// PUBLIC SLOTS +// ================= +void LWindow::updateAppearance(){ + +} + +// ================= +// PRIVATE SLOTS +// ================= +void LWindow::closeClicked(){ + +} + +void LWindow::minClicked(){ + +} + +void LWindow::maxClicked(){ + +} + +void LWindow::otherClicked(QAction* act){ + +} + +// ===================== +// PROTECTED +// ===================== +void LWindow::mousePressEvent(QMouseEvent *ev){ + +} + +void LWindow::mouseMoveEvent(QMouseEvent *ev){ + +} + +void LWindow::mouseReleaseEvent(QMouseEvent *ev){ + +} diff --git a/lumina-wm-INCOMPLETE/LWindow.h b/lumina-wm-INCOMPLETE/LWindow.h new file mode 100644 index 00000000..af5a8054 --- /dev/null +++ b/lumina-wm-INCOMPLETE/LWindow.h @@ -0,0 +1,67 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_H +#define _LUMINA_DESKTOP_SCREEN_SAVER_H + +#include <QFrame> +#include <QLabel> +#include <QToolButton> +#include <QMenu> +#include <QMouseEvent> +#include <QAction> +#include <QPoint> + +class LWindow : public QFrame{ + Q_OBJECT +public: + LWindow(WId client); //MUST have a valid client window + ~LWindow(); + + WId clientID(); + bool hasFrame(); + +private: + void InitWindow(); //Initialize all the internal widgets + + //Window status + enum ModStatus{Normal, Move, ResizeTop, ResizeTopRight, ResizeRight, ResizeBottomRight, ResizeBottom, ResizeBottomLeft, ResizeLeft, ResizeTopLeft}; + ModStatus activeState; + //Functions for getting/setting state + ModStatus getStateAtPoint(QPoint); //generally used for mouse location detection + void setMouseCursor(ModStatus); //Update the mouse cursor based on state + + //General Properties + WId CID; //Client ID + + //Window Frame Widgets/Items + QLabel *titleBar, *title, *icon; + QToolButton *minB, *maxB, *closeB, *otherB; + QMenu *otherM; //menu of "other" actions for the window + +public slots: + //These slots are generally used for the outside event watcher to + void updateAppearance(); //reload the theme and change styling as necessary + void propertiesChanged(); + void + +private slots: + void closeClicked(); + void minClicked(); + void maxClicked(); + void otherClicked(QAction*); + +protected: + void mousePressEvent(QMouseEvent*); + void mouseMoveEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); + +signals: + + +}; + +#endif
\ No newline at end of file |