00001 /************************************************************************ 00002 filename: CEGUIIScrolledItemListBase.h 00003 created: Sat Oct 29 2005 00004 author: Tomas Lindquist Olsen 00005 *************************************************************************/ 00006 /************************************************************************* 00007 Crazy Eddie's GUI System (http://www.cegui.org.uk) 00008 Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk) 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 *************************************************************************/ 00024 #ifndef _CEGUIScrolledItemListBase_h_ 00025 #define _CEGUIScrolledItemListBase_h_ 00026 00027 #include "elements/CEGUIItemListBase.h" 00028 #include "elements/CEGUIScrollbar.h" 00029 #include "elements/CEGUIScrolledItemListBaseProperties.h" 00030 00031 #if defined(_MSC_VER) 00032 # pragma warning(push) 00033 # pragma warning(disable : 4251) 00034 #endif 00035 // begin CEGUI namespace 00036 namespace CEGUI 00037 { 00038 00043 class CEGUIEXPORT ScrolledItemListBase : public ItemListBase 00044 { 00045 public: 00046 static const String EventNamespace; 00047 00048 /************************************************************************ 00049 Constants 00050 *************************************************************************/ 00051 static const String VertScrollbarNameSuffix; 00052 static const String HorzScrollbarNameSuffix; 00053 static const String ContentPaneNameSuffix; 00054 00055 static const String EventVertScrollbarModeChanged; 00056 static const String EventHorzScrollbarModeChanged; 00057 00058 /************************************************************************ 00059 Accessors 00060 *************************************************************************/ 00065 bool isVertScrollbarAlwaysShown(void) const {return d_forceVScroll;} 00066 00071 bool isHorzScrollbarAlwaysShown(void) const {return d_forceHScroll;} 00072 00077 Scrollbar* getVertScrollbar() const; 00078 00083 Scrollbar* getHorzScrollbar() const; 00084 00085 /************************************************************************ 00086 Manipulators 00087 *************************************************************************/ 00092 void setShowVertScrollbar(bool mode); 00093 00098 void setShowHorzScrollbar(bool mode); 00099 00113 void ensureItemIsVisibleVert(const ItemEntry& item); 00114 00128 void ensureItemIsVisibleHorz(const ItemEntry& item); 00129 00130 /************************************************************************ 00131 Object Construction and Destruction 00132 *************************************************************************/ 00137 ScrolledItemListBase(const String& type, const String& name); 00138 00143 virtual ~ScrolledItemListBase(void); 00144 00145 // overridden from ItemListBase 00146 virtual void initialiseComponents(void); 00147 00148 protected: 00149 /************************************************************************ 00150 Implementation functions 00151 ************************************************************************/ 00162 virtual bool testClassName_impl(const String& class_name) const 00163 { 00164 if (class_name=="ScrolledItemListBase") 00165 { 00166 return true; 00167 } 00168 return ItemListBase::testClassName_impl(class_name); 00169 } 00170 00175 void configureScrollbars(const Size& doc_size); 00176 00177 /************************************************************************ 00178 New event handlers 00179 ************************************************************************/ 00180 virtual void onVertScrollbarModeChanged(WindowEventArgs& e); 00181 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e); 00182 00183 /************************************************************************ 00184 Overridden event handlers 00185 ************************************************************************/ 00186 virtual void onMouseWheel(MouseEventArgs& e); 00187 00188 /************************************************************************ 00189 Event subscribers 00190 ************************************************************************/ 00191 bool handle_VScroll(const EventArgs& e); 00192 bool handle_HScroll(const EventArgs& e); 00193 00194 /************************************************************************ 00195 Implementation data 00196 ************************************************************************/ 00197 bool d_forceVScroll; 00198 bool d_forceHScroll; 00199 00200 private: 00201 /************************************************************************ 00202 Static Properties for this class 00203 ************************************************************************/ 00204 static ScrolledItemListBaseProperties::ForceVertScrollbar d_forceVertScrollbarProperty; 00205 static ScrolledItemListBaseProperties::ForceHorzScrollbar d_forceHorzScrollbarProperty; 00206 00207 void addScrolledItemListBaseProperties(void); 00208 }; 00209 00210 } // end CEGUI namespace 00211 00212 #if defined(_MSC_VER) 00213 # pragma warning(pop) 00214 #endif 00215 00216 #endif // end of guard _CEGUIScrolledItemListBase_h_