| 1 |
/* |
| 2 |
* This file is part of the apvlv package |
| 3 |
* |
| 4 |
* Copyright (C) 2008 Alf. |
| 5 |
* |
| 6 |
* Contact: Alf <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; either version 2.0 of |
| 11 |
* the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, but |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public |
| 19 |
* License along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 |
* |
| 22 |
*/ |
| 23 |
/* @CPPFILE ApvlvWindow.h |
| 24 |
* |
| 25 |
* Author: Alf <[email protected]> |
| 26 |
*/ |
| 27 |
|
| 28 |
#ifndef _APVLV_WINDOW_H_ |
| 29 |
#define _APVLV_WINDOW_H_ |
| 30 |
|
| 31 |
#include "ApvlvFrame.h" |
| 32 |
|
| 33 |
namespace apvlv |
| 34 |
{ |
| 35 |
class ApvlvFrame; |
| 36 |
class ApvlvWindowContext; |
| 37 |
|
| 38 |
class ApvlvWindow final : public QFrame |
| 39 |
{ |
| 40 |
Q_OBJECT |
| 41 |
public: |
| 42 |
ApvlvWindow (); |
| 43 |
~ApvlvWindow () override; |
| 44 |
|
| 45 |
/* WE operate the AW_DOC window |
| 46 |
* Any SP, VSP are a virtual window, just for contain the AW_DOC window |
| 47 |
* AW_NONE is an empty window, need free |
| 48 |
* So, ANY user interface function can only get the AW_DOC window |
| 49 |
* */ |
| 50 |
enum class WindowType |
| 51 |
{ |
| 52 |
FRAME, |
| 53 |
SP, |
| 54 |
VSP, |
| 55 |
}; |
| 56 |
WindowType mType{ WindowType::FRAME }; |
| 57 |
|
| 58 |
bool birth (WindowType type, ApvlvFrame *doc); |
| 59 |
|
| 60 |
void perish (); |
| 61 |
|
| 62 |
void setActive (bool act); |
| 63 |
|
| 64 |
void setFrame (ApvlvFrame *doc); |
| 65 |
ApvlvFrame *stealFrame (); |
| 66 |
ApvlvFrame *getFrame (); |
| 67 |
|
| 68 |
ApvlvWindow *firstWindow (); |
| 69 |
ApvlvWindow *secondWindow (); |
| 70 |
ApvlvWindow *parentWindow (); |
| 71 |
ApvlvWindow *rootWindow (); |
| 72 |
ApvlvWindow *firstFrameWindow (); |
| 73 |
|
| 74 |
void |
| 75 |
setActiveWindow (ApvlvWindow *win) |
| 76 |
{ |
| 77 |
mActive = win; |
| 78 |
} |
| 79 |
ApvlvWindow * |
| 80 |
getActiveWindow () |
| 81 |
{ |
| 82 |
return mActive; |
| 83 |
} |
| 84 |
|
| 85 |
bool isRoot (); |
| 86 |
|
| 87 |
void smaller (int times = 1); |
| 88 |
void bigger (int times = 1); |
| 89 |
|
| 90 |
ApvlvWindow *getNeighbor (int count, uint key); |
| 91 |
|
| 92 |
ApvlvWindow *getNext (); |
| 93 |
|
| 94 |
CmdReturn process (int times, uint keyval); |
| 95 |
|
| 96 |
ApvlvWindow *findWindowByWidget (QWidget *widget); |
| 97 |
|
| 98 |
private: |
| 99 |
QVBoxLayout mLayout; |
| 100 |
QSplitter mPaned; |
| 101 |
|
| 102 |
ApvlvWindow *mActive{ nullptr }; |
| 103 |
|
| 104 |
ApvlvWindow *getLeft (); |
| 105 |
ApvlvWindow *getRight (); |
| 106 |
ApvlvWindow *getTop (); |
| 107 |
ApvlvWindow *getBottom (); |
| 108 |
|
| 109 |
void splitWidget (WindowType type, QWidget *one, QWidget *other); |
| 110 |
|
| 111 |
private slots: |
| 112 |
void perishWidget (); |
| 113 |
void setAsRootActive (); |
| 114 |
}; |
| 115 |
|
| 116 |
} |
| 117 |
|
| 118 |
#endif |
| 119 |
|
| 120 |
/* Local Variables: */ |
| 121 |
/* mode: c++ */ |
| 122 |
/* End: */ |