MIRA
EditorPartWindow.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef MIRA_EDITORPARTWINDOW_H_
48 #define MIRA_EDITORPARTWINDOW_H_
49 
50 #include <QWidget>
51 #include <QFrame>
52 #include <QVBoxLayout>
53 
54 namespace mira {
55 
57 
58 class EditorPartTitleBar;
59 class EditorPartArea;
60 
61 class EditorPartWindow : public QFrame
62 {
63  Q_OBJECT
64 public:
65 
66  EditorPartWindow(EditorPartArea* area=NULL, Qt::WindowFlags flags=Qt::WindowFlags());
67  virtual ~EditorPartWindow();
68 
69 public:
70 
71  void setWidget(QWidget* widget);
72  QWidget* widget() const;
73 
74 public:
75 
77 
78 public:
79 
81  void undock() {
82  onUndock();
83  }
84 
86  void dock() {
87  onDock();
88  }
89 
91  bool isDocked() const {
92  return mDocked;
93  }
94 
96  void setOnTop(bool onTop) {
97  onOnTop(onTop);
98  }
99 
101  bool isOnTop() const {
102  return mOnTop;
103  }
104 
105 public:
106 
107  void showDecorations(bool show);
108 
109  void setAutoHideDecorations(bool on);
110 
111 
112 protected:
113 
114  virtual void paintEvent(QPaintEvent *paintEvent);
115  virtual void changeEvent(QEvent* event);
116  //virtual void enterEvent(QEvent* event);
117  //virtual void leaveEvent(QEvent* event);
118 
119 protected:
120  friend class EditorPartArea;
121 
122  // managed by EditorPartArea
123  void setActive(bool activate);
124 
125  virtual void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
126 
127  void updateDecorations();
128  void updateStateButtons(); // buttons for minimize, maximize, restore
129 
130 protected slots:
131 
132  void onMinimized();
133  void onMaximized();
134  void onRestored();
135  void onUndock();
136  void onDock();
137  void onOnTop(bool onTop);
138 
139 signals:
140 
141  void windowTitleChanged(EditorPartWindow* editor);
142 
143 private:
144 
146  EditorPartArea* mArea;
147 
149  QVBoxLayout* mLayout;
150 
152  EditorPartTitleBar* mTitleBar;
153 
154  QAction* mOnTopAction;
155 
157  QWidget* mWidget;
158 
160  QWidget* mEmptyContentWidget;
161 
163  QRect mRestoreGeometry;
164  bool mRestoreOnTop;
165 
166  bool mAutoHideDecorations;
167  bool mDecorationsShown;
168  bool mActivated;
169  bool mOnTop;
170 
171  enum WindowState {
172  Minimized,
173  Maximized,
174  Normal,
175  };
176 
178  WindowState mWindowState;
179 
180 
181  bool mDocked;
182 };
183 
185 
186 }
187 
188 #endif
This is a replacement for QMdiArea.
Definition: EditorPartArea.h:71
void onOnTop(bool onTop)
void setActive(bool activate)
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
QWidget * widget() const
void windowTitleChanged(EditorPartWindow *editor)
void undock()
Undocks the window from the EditorPartArea and makes it floating.
Definition: EditorPartWindow.h:81
bool isOnTop() const
Returns true, if the window stays on top of other windows.
Definition: EditorPartWindow.h:101
void showDecorations(bool show)
virtual void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
void setWidget(QWidget *widget)
Definition: EditorPartWindow.h:61
Definition: EditorPartTitleBar.h:58
virtual void changeEvent(QEvent *event)
void setOnTop(bool onTop)
Makes the window stay on top of other windows.
Definition: EditorPartWindow.h:96
EditorPartWindow(EditorPartArea *area=NULL, Qt::WindowFlags flags=Qt::WindowFlags())
bool isDocked() const
Returns true, if the window is docked in the EditorPartArea.
Definition: EditorPartWindow.h:91
EditorPartTitleBar * getTitleBar()
void setAutoHideDecorations(bool on)
virtual void paintEvent(QPaintEvent *paintEvent)
void dock()
Docks the window back to the EditorPartArea.
Definition: EditorPartWindow.h:86