00001 /************************************************************************ 00002 filename: CEGUIIScrolledItemListBase.h 00003 created: Sat Oct 29 2005 00004 author: Tomas Lindquist Olsen 00005 *************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2004 - 2009 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 _CEGUIScrolledItemListBase_h_ 00029 #define _CEGUIScrolledItemListBase_h_ 00030 00031 #include "CEGUIItemListBase.h" 00032 #include "CEGUIScrollbar.h" 00033 #include "CEGUIScrolledItemListBaseProperties.h" 00034 00035 #if defined(_MSC_VER) 00036 # pragma warning(push) 00037 # pragma warning(disable : 4251) 00038 #endif 00039 // begin CEGUI namespace 00040 namespace CEGUI 00041 { 00042 00047 class CEGUIEXPORT ScrolledItemListBase : public ItemListBase 00048 { 00049 public: 00050 static const String EventNamespace; 00051 00052 /************************************************************************ 00053 Constants 00054 *************************************************************************/ 00055 static const String VertScrollbarNameSuffix; 00056 static const String HorzScrollbarNameSuffix; 00057 static const String ContentPaneNameSuffix; 00058 00059 static const String EventVertScrollbarModeChanged; 00060 static const String EventHorzScrollbarModeChanged; 00061 00062 /************************************************************************ 00063 Accessors 00064 *************************************************************************/ 00069 bool isVertScrollbarAlwaysShown(void) const {return d_forceVScroll;} 00070 00075 bool isHorzScrollbarAlwaysShown(void) const {return d_forceHScroll;} 00076 00081 Scrollbar* getVertScrollbar() const; 00082 00087 Scrollbar* getHorzScrollbar() const; 00088 00089 /************************************************************************ 00090 Manipulators 00091 *************************************************************************/ 00096 void setShowVertScrollbar(bool mode); 00097 00102 void setShowHorzScrollbar(bool mode); 00103 00117 void ensureItemIsVisibleVert(const ItemEntry& item); 00118 00132 void ensureItemIsVisibleHorz(const ItemEntry& item); 00133 00134 /************************************************************************ 00135 Object Construction and Destruction 00136 *************************************************************************/ 00141 ScrolledItemListBase(const String& type, const String& name); 00142 00147 virtual ~ScrolledItemListBase(void); 00148 00149 // overridden from ItemListBase 00150 virtual void initialiseComponents(void); 00151 00152 protected: 00153 /************************************************************************ 00154 Implementation functions 00155 ************************************************************************/ 00166 virtual bool testClassName_impl(const String& class_name) const 00167 { 00168 if (class_name=="ScrolledItemListBase") 00169 { 00170 return true; 00171 } 00172 return ItemListBase::testClassName_impl(class_name); 00173 } 00174 00179 void configureScrollbars(const Size& doc_size); 00180 00181 /************************************************************************ 00182 New event handlers 00183 ************************************************************************/ 00184 virtual void onVertScrollbarModeChanged(WindowEventArgs& e); 00185 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e); 00186 00187 /************************************************************************ 00188 Overridden event handlers 00189 ************************************************************************/ 00190 virtual void onMouseWheel(MouseEventArgs& e); 00191 00192 /************************************************************************ 00193 Event subscribers 00194 ************************************************************************/ 00195 bool handle_VScroll(const EventArgs& e); 00196 bool handle_HScroll(const EventArgs& e); 00197 00198 /************************************************************************ 00199 Implementation data 00200 ************************************************************************/ 00201 bool d_forceVScroll; 00202 bool d_forceHScroll; 00203 00204 private: 00205 /************************************************************************ 00206 Static Properties for this class 00207 ************************************************************************/ 00208 static ScrolledItemListBaseProperties::ForceVertScrollbar d_forceVertScrollbarProperty; 00209 static ScrolledItemListBaseProperties::ForceHorzScrollbar d_forceHorzScrollbarProperty; 00210 00211 void addScrolledItemListBaseProperties(void); 00212 }; 00213 00214 } // end CEGUI namespace 00215 00216 #if defined(_MSC_VER) 00217 # pragma warning(pop) 00218 #endif 00219 00220 #endif // end of guard _CEGUIScrolledItemListBase_h_