Crazy Eddie's GUI System  0.8.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
LayoutContainer.h
1 /***********************************************************************
2  filename: CEGUILayoutContainer.h
3  created: 29/7/2010
4  author: Martin Preisler
5 
6  purpose: Defines abstract base class for layout containers
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUILayoutContainer_h_
31 #define _CEGUILayoutContainer_h_
32 
33 #include "../Window.h"
34 
35 #include <map>
36 
37 #if defined(_MSC_VER)
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
40 #endif
41 
42 // Start of CEGUI namespace section
43 namespace CEGUI
44 {
45 
54 class CEGUIEXPORT LayoutContainer : public Window
55 {
56 public:
57  /*************************************************************************
58  Event name constants
59  *************************************************************************/
61  static const String EventNamespace;
62 
73  LayoutContainer(const String& type, const String& name);
74 
79  virtual ~LayoutContainer(void);
80 
85  void markNeedsLayouting();
86 
91  bool needsLayouting() const;
92 
97  virtual void layout() = 0;
98 
104  virtual void layoutIfNecessary();
105 
107  virtual void update(float elapsed);
108 
109  virtual const CachedRectf& getClientChildContentArea() const;
110 
111  virtual void notifyScreenAreaChanged(bool recursive);
112 
113 protected:
115  virtual Rectf getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const;
116 
117  Rectf getClientChildContentArea_impl(bool skipAllPixelAlignment) const;
118 
119  size_t getIdxOfChild(Window* wnd) const;
120 
122  virtual void addChild_impl(Element* element);
124  virtual void removeChild_impl(Element* element);
125 
126  /*************************************************************************
127  Event trigger methods
128  *************************************************************************/
138  virtual bool handleChildSized(const EventArgs& e);
139 
149  virtual bool handleChildMarginChanged(const EventArgs& e);
150 
160  virtual bool handleChildAdded(const EventArgs& e);
161 
171  virtual bool handleChildRemoved(const EventArgs& e);
172 
177  virtual UVector2 getOffsetForWindow(Window* window) const;
178 
183  virtual UVector2 getBoundingSizeForWindow(Window* window) const;
184 
185  // overridden from parent class
186  void onParentSized(ElementEventArgs& e);
187 
188  /*************************************************************************
189  Implementation Data
190  *************************************************************************/
191  // if true, we will relayout before rendering of this window starts
192  bool d_needsLayouting;
193 
194  typedef std::multimap<Window*, Event::Connection> ConnectionTracker;
196  ConnectionTracker d_eventConnections;
197 
198  CachedRectf d_clientChildContentArea;
199 };
200 
201 } // End of CEGUI namespace section
202 
203 #if defined(_MSC_VER)
204 # pragma warning(pop)
205 #endif
206 
207 #endif // end of guard _CEGUILayoutContainer_h_
208