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 #include <rcp/GuiRCPExports.h>
55 
56 namespace mira {
57 
59 
60 class EditorPartTitleBar;
61 class EditorPartArea;
62 
64 {
65  Q_OBJECT
66 public:
67 
68  EditorPartWindow(EditorPartArea* area=NULL, Qt::WindowFlags flags=Qt::WindowFlags());
69  virtual ~EditorPartWindow();
70 
71 public:
72 
73  void setWidget(QWidget* widget);
74  QWidget* widget() const;
75 
76 public:
77 
78  EditorPartTitleBar* getTitleBar();
79 
80 public:
81 
83  void undock() {
84  onUndock();
85  }
86 
88  void dock() {
89  onDock();
90  }
91 
93  bool isDocked() const {
94  return mDocked;
95  }
96 
98  void setOnTop(bool onTop) {
99  onOnTop(onTop);
100  }
101 
103  bool isOnTop() const {
104  return mOnTop;
105  }
106 
107 public:
108 
109  void showDecorations(bool show);
110 
111  void setAutoHideDecorations(bool on);
112 
113 
114 protected:
115 
116  virtual void paintEvent(QPaintEvent *paintEvent);
117  virtual void changeEvent(QEvent* event);
118  //virtual void enterEvent(QEvent* event);
119  //virtual void leaveEvent(QEvent* event);
120 
121 protected:
122  friend class EditorPartArea;
123 
124  // managed by EditorPartArea
125  void setActive(bool activate);
126 
127  virtual void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
128 
129  void updateDecorations();
130  void updateStateButtons(); // buttons for minimize, maximize, restore
131 
132 protected slots:
133 
134  void onMinimized();
135  void onMaximized();
136  void onRestored();
137  void onUndock();
138  void onDock();
139  void onOnTop(bool onTop);
140 
141 signals:
142 
143  void windowTitleChanged(EditorPartWindow* editor);
144 
145 private:
146 
148  EditorPartArea* mArea;
149 
151  QVBoxLayout* mLayout;
152 
154  EditorPartTitleBar* mTitleBar;
155 
156  QAction* mOnTopAction;
157 
159  QWidget* mWidget;
160 
162  QWidget* mEmptyContentWidget;
163 
165  QRect mRestoreGeometry;
166  bool mRestoreOnTop;
167 
168  bool mAutoHideDecorations;
169  bool mDecorationsShown;
170  bool mActivated;
171  bool mOnTop;
172 
173  enum WindowState {
174  Minimized,
175  Maximized,
176  Normal,
177  };
178 
180  WindowState mWindowState;
181 
182 
183  bool mDocked;
184 };
185 
187 
188 }
189 
190 #endif
This is a replacement for QMdiArea.
Definition: EditorPartArea.h:73
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
void undock()
Undocks the window from the EditorPartArea and makes it floating.
Definition: EditorPartWindow.h:83
bool isOnTop() const
Returns true, if the window stays on top of other windows.
Definition: EditorPartWindow.h:103
Definition: EditorPartWindow.h:63
Definition: EditorPartTitleBar.h:58
void setOnTop(bool onTop)
Makes the window stay on top of other windows.
Definition: EditorPartWindow.h:98
Gui export macro declaration.
bool isDocked() const
Returns true, if the window is docked in the EditorPartArea.
Definition: EditorPartWindow.h:93
#define MIRA_GUI_RCP_EXPORT
Definition: GuiRCPExports.h:61
void dock()
Docks the window back to the EditorPartArea.
Definition: EditorPartWindow.h:88