Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 29/7/2010 00003 author: Martin Preisler 00004 00005 purpose: Defines abstract base class for layout containers 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUILayoutContainer_h_ 00030 #define _CEGUILayoutContainer_h_ 00031 00032 #include "../Window.h" 00033 00034 #include <map> 00035 00036 #if defined(_MSC_VER) 00037 # pragma warning(push) 00038 # pragma warning(disable : 4251) 00039 #endif 00040 00041 // Start of CEGUI namespace section 00042 namespace CEGUI 00043 { 00044 00053 class CEGUIEXPORT LayoutContainer : public Window 00054 { 00055 public: 00056 /************************************************************************* 00057 Event name constants 00058 *************************************************************************/ 00060 static const String EventNamespace; 00061 00072 LayoutContainer(const String& type, const String& name); 00073 00078 virtual ~LayoutContainer(void); 00079 00084 void markNeedsLayouting(); 00085 00090 bool needsLayouting() const; 00091 00096 virtual void layout() = 0; 00097 00103 virtual void layoutIfNecessary(); 00104 00106 virtual void update(float elapsed); 00107 00108 virtual const CachedRectf& getClientChildContentArea() const; 00109 00110 virtual void notifyScreenAreaChanged(bool recursive); 00111 00112 protected: 00114 virtual Rectf getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const; 00115 00116 Rectf getClientChildContentArea_impl(bool skipAllPixelAlignment) const; 00117 00118 size_t getIdxOfChild(Window* wnd) const; 00119 00121 virtual void addChild_impl(Element* element); 00123 virtual void removeChild_impl(Element* element); 00124 00125 /************************************************************************* 00126 Event trigger methods 00127 *************************************************************************/ 00137 virtual bool handleChildSized(const EventArgs& e); 00138 00148 virtual bool handleChildMarginChanged(const EventArgs& e); 00149 00159 virtual bool handleChildAdded(const EventArgs& e); 00160 00170 virtual bool handleChildRemoved(const EventArgs& e); 00171 00176 virtual UVector2 getOffsetForWindow(Window* window) const; 00177 00182 virtual UVector2 getBoundingSizeForWindow(Window* window) const; 00183 00184 // overridden from parent class 00185 void onParentSized(ElementEventArgs& e); 00186 00187 /************************************************************************* 00188 Implementation Data 00189 *************************************************************************/ 00190 // if true, we will relayout before rendering of this window starts 00191 bool d_needsLayouting; 00192 00193 typedef std::multimap<Window*, Event::Connection> ConnectionTracker; 00195 ConnectionTracker d_eventConnections; 00196 00197 CachedRectf d_clientChildContentArea; 00198 }; 00199 00200 } // End of CEGUI namespace section 00201 00202 #if defined(_MSC_VER) 00203 # pragma warning(pop) 00204 #endif 00205 00206 #endif // end of guard _CEGUILayoutContainer_h_ 00207