Debian Codegraph @

src/Gui/DockWindow.h

raw
1 /***************************************************************************
2 * Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23
24 #ifndef GUI_DOCKWINDOW_H
25 #define GUI_DOCKWINDOW_H
26
27 #include <Gui/View.h>
28 #include <QWidget>
29
30
31 namespace Gui
32 {
33 class MDIView;
34 class Application;
35
36 /** Base class of all dockable windows belonging to a document
37 * there are two ways of belonging to a document. The
38 * first way is to a fixed one. The second way is to always
39 * belong to the active document, that means switching every time
40 * the active document is changing. It also means that the view
41 * belongs sometimes to no document at all!
42 * @see TreeView
43 * @see Gui::Document
44 * @see Application
45 * @author Jürgen Riegel
46 */
47 class GuiExport DockWindow: public QWidget, public BaseView
48 {
49 Q_OBJECT
50
51 public:
52 /** View constructor
53 * Attach the view to the given document. If the document is 0
54 * the view will attach to the active document. Be aware there isn't
55 * always an active document available!
56 */
57 explicit DockWindow(Gui::Document* pcDocument = nullptr, QWidget* parent = nullptr);
58 /** View destructor
59 * Detach the view from the document, if attached.
60 */
61 ~DockWindow() override;
62
63 /** @name methods to override
64 */
65 //@{
66 /// get called when the document is updated
67 void onUpdate() override
68 {}
69 /// returns the name of the view (important for messages)
70 const char* getName() const override
71 {
72 return "DockWindow";
73 }
74 /// Message handler
75 bool onMsg(const char*, const char**) override
76 {
77 return false;
78 }
79 /// Message handler test
80 bool onHasMsg(const char*) const override
81 {
82 return false;
83 }
84 /// overwrite when checking on close state
85 bool canClose() override
86 {
87 return true;
88 }
89 //@}
90
91 Q_SIGNALS:
92 /// sends a message to the document
93 void sendCloseView(Gui::MDIView* theView);
94 };
95
96 } // namespace Gui
97
98 #endif // GUI_DOCKWINDOW_H