00001 /*********************************************************************** 00002 filename: CEGUIScrolledContainer.h 00003 created: 1/3/2005 00004 author: Paul D Turner 00005 *************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00008 * 00009 * Permission is hereby granted, free of charge, to any person obtaining 00010 * a copy of this software and associated documentation files (the 00011 * "Software"), to deal in the Software without restriction, including 00012 * without limitation the rights to use, copy, modify, merge, publish, 00013 * distribute, sublicense, and/or sell copies of the Software, and to 00014 * permit persons to whom the Software is furnished to do so, subject to 00015 * the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00023 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00024 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00025 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00026 * OTHER DEALINGS IN THE SOFTWARE. 00027 ***************************************************************************/ 00028 #ifndef _CEGUIScrolledContainer_h_ 00029 #define _CEGUIScrolledContainer_h_ 00030 00031 #include "CEGUIWindow.h" 00032 #include "CEGUIWindowFactory.h" 00033 #include "elements/CEGUIScrolledContainerProperties.h" 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 { 00049 class CEGUIEXPORT ScrolledContainer : public Window 00050 { 00051 public: 00052 /************************************************************************* 00053 Constants 00054 *************************************************************************/ 00055 static const String WidgetTypeName; 00056 static const String EventNamespace; 00057 static const String EventContentChanged; 00058 static const String EventAutoSizeSettingChanged; 00059 00060 /************************************************************************* 00061 Object construction and destruction 00062 *************************************************************************/ 00067 ScrolledContainer(const String& type, const String& name); 00068 00073 ~ScrolledContainer(void); 00074 00075 /************************************************************************* 00076 Public interface methods 00077 *************************************************************************/ 00086 bool isContentPaneAutoSized(void) const; 00087 00099 void setContentPaneAutoSized(bool setting); 00100 00109 const Rect& getContentArea(void) const; 00110 00126 void setContentArea(const Rect& area); 00127 00137 Rect getChildExtentsArea(void) const; 00138 00139 // Overridden from Window. 00140 Rect getUnclippedInnerRect_impl(void) const; 00141 00142 protected: 00143 /************************************************************************* 00144 Implementation methods 00145 *************************************************************************/ 00156 virtual bool testClassName_impl(const String& class_name) const 00157 { 00158 if (class_name=="ScrolledContainer") return true; 00159 return Window::testClassName_impl(class_name); 00160 } 00161 00162 /************************************************************************* 00163 Implementation of abstract methods from Window 00164 *************************************************************************/ 00165 void drawSelf(float z) {}; 00166 00167 /************************************************************************* 00168 Event trigger methods. 00169 *************************************************************************/ 00180 virtual void onContentChanged(WindowEventArgs& e); 00181 00193 virtual void onAutoSizeSettingChanged(WindowEventArgs& e); 00194 00195 /************************************************************************* 00196 Event callbacks 00197 *************************************************************************/ 00202 bool handleChildSized(const EventArgs& e); 00203 00208 bool handleChildMoved(const EventArgs& e); 00209 00210 /************************************************************************* 00211 Overridden from Window. 00212 *************************************************************************/ 00213 void onChildAdded(WindowEventArgs& e); 00214 void onChildRemoved(WindowEventArgs& e); 00215 void onParentSized(WindowEventArgs& e); 00216 00217 /************************************************************************* 00218 Data fields 00219 *************************************************************************/ 00220 typedef std::multimap<Window*, Event::Connection> ConnectionTracker; 00221 ConnectionTracker d_eventConnections; 00222 Rect d_contentArea; 00223 bool d_autosizePane; 00224 00225 private: 00226 /************************************************************************* 00227 Static Properties for this class 00228 *************************************************************************/ 00229 static ScrolledContainerProperties::ContentPaneAutoSized d_autoSizedProperty; 00230 static ScrolledContainerProperties::ContentArea d_contentAreaProperty; 00231 static ScrolledContainerProperties::ChildExtentsArea d_childExtentsAreaProperty; 00232 00233 /************************************************************************* 00234 Private methods 00235 *************************************************************************/ 00236 void addScrolledContainerProperties(void); 00237 }; 00238 00239 } // End of CEGUI namespace section 00240 00241 00242 #if defined(_MSC_VER) 00243 # pragma warning(pop) 00244 #endif 00245 00246 #endif // end of guard _CEGUIScrolledContainer_h_