WindowManager.h
1 /* Copyright (C) 2015 Marc Boris Duerner
2 
3  This library is free software; you can redistribute it and/or
4  modify it under the terms of the GNU Lesser General Public
5  License as published by the Free Software Foundation; either
6  version 2.1 of the License, or (at your option) any later version.
7 
8  As a special exception, you may use this file as part of a free
9  software library without restriction. Specifically, if other files
10  instantiate templates or use macros or inline functions from this
11  file, or you compile this file and link it with other files to
12  produce an executable, this file does not by itself cause the
13  resulting executable to be covered by the GNU General Public
14  License. This exception does not however invalidate any other
15  reasons why the executable file might be covered by the GNU Library
16  General Public License.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26  02110-1301 USA
27 */
28 
29 #ifndef PT_FORMS_WINDOWMANAGER_H
30 #define PT_FORMS_WINDOWMANAGER_H
31 
32 #include <Pt/Forms/Widget.h>
33 #include <Pt/Forms/Window.h>
34 #include <Pt/Gfx/Size.h>
35 
36 namespace Pt {
37 
38 namespace Forms {
39 
40 class Window;
41 class WindowFrame;
42 
43 class WindowManager : public Widget
44 {
45  friend class Window;
46 
47  public:
48  typedef Widget Base;
49 
50  public:
51  WindowManager();
52 
53  virtual ~WindowManager();
54 
55  void relayout();
56 
57  Pt::Signal<Window&>& surfaceChanged()
58  {
59  return _surfaceChanged;
60  }
61 
62  // TODO:
63 
64  //void addWindow(Window& w)
65  //{
66  // w.setParent(*this);
67  //}
68 
69  //void removeWindow(Window& w)
70  //{
71  // if(w.windowManager() == this)
72  // w.unparent();
73  //}
74 
75  //std::vector<Pt::Forms::Window*>& windows()
76  //{
77  // return _windows;
78  //}
79 
80  //Pt::Signal<Window&>& windowAdded()
81  //{
82  // return _windowAdded;
83  //}
84 
85  //Pt::Signal<Window&>& windowRemoved()
86  //{
87  // return _windowRemoved;
88  //}
89 
90  protected:
91  virtual void onConnect(Screen& screen);
92 
93  virtual void onDisconnect();
94 
95 
96  virtual void onRequestRelayout();
97 
98  protected:
99  virtual void onProcessPaintEvent(const PaintEvent& ev);
100 
101  virtual void onPaintEvent(const PaintEvent& ev);
102 
103  protected:
104  virtual WindowFrame* onAttach(Window& w) = 0;
105 
106  virtual void onDetach(WindowFrame& w) = 0;
107 
108  virtual void onInit(WindowFrame& w) = 0;
109 
110  virtual void onRelease(WindowFrame& w) = 0;
111 
112  //virtual void onAutoCenter(WindowFrame& w, bool enable) = 0;
113 
114  private:
115  Pt::Signal<Window&> _surfaceChanged;
116 
117  //std::vector<Pt::Forms::Window*> _windows;
118  //Pt::Signal<Window&> _windowAdded;
119  //Pt::Signal<Window&> _windowRemoved;
120 };
121 
122 } // namespace
123 
124 } // namespace
125 
126 #endif
Multicast Signal to call multiple slots.
Definition: Signal.h:109