Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 31/3/2005 00003 author: Tomas Lindquist Olsen (based on code by Paul D Turner) 00004 00005 purpose: Interface to base class for ItemEntry widget 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 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 _CEGUIItemEntry_h_ 00030 #define _CEGUIItemEntry_h_ 00031 00032 #include "../Base.h" 00033 #include "../Window.h" 00034 00035 #if defined(_MSC_VER) 00036 # pragma warning(push) 00037 # pragma warning(disable : 4251) 00038 #endif 00039 00040 // Start of CEGUI namespace section 00041 namespace CEGUI 00042 { 00043 00048 class CEGUIEXPORT ItemEntryWindowRenderer : public WindowRenderer 00049 { 00050 public: 00055 ItemEntryWindowRenderer(const String& name); 00056 00065 virtual Sizef getItemPixelSize(void) const = 0; 00066 }; 00067 00076 class CEGUIEXPORT ItemEntry : public Window 00077 { 00078 public: 00079 /************************************************************************* 00080 Constants 00081 *************************************************************************/ 00082 static const String WidgetTypeName; 00083 00088 static const String EventSelectionChanged; 00089 00090 /************************************************************************* 00091 Accessors 00092 *************************************************************************/ 00101 Sizef getItemPixelSize(void) const; 00102 00108 ItemListBase* getOwnerList(void) const {return d_ownerList;} 00109 00114 bool isSelected(void) const {return d_selected;} 00115 00120 bool isSelectable(void) const {return d_selectable;} 00121 00122 /************************************************************************* 00123 Set methods 00124 *************************************************************************/ 00134 void setSelected(bool setting) {setSelected_impl(setting, true);} 00135 00140 void select(void) {setSelected_impl(true, true);} 00141 00146 void deselect(void) {setSelected_impl(false, true);} 00147 00153 void setSelected_impl(bool state, bool notify); 00154 00168 void setSelectable(bool setting); 00169 00170 /************************************************************************* 00171 Construction and Destruction 00172 *************************************************************************/ 00177 ItemEntry(const String& type, const String& name); 00178 00183 virtual ~ItemEntry(void) {} 00184 00185 protected: 00186 /************************************************************************* 00187 Abstract Implementation Functions 00188 *************************************************************************/ 00197 //virtual Size getItemPixelSize_impl(void) const = 0; 00198 00199 /************************************************************************* 00200 Implementation Functions 00201 *************************************************************************/ 00202 // validate window renderer 00203 virtual bool validateWindowRenderer(const WindowRenderer* renderer) const; 00204 00205 /************************************************************************* 00206 New Event Handlers 00207 *************************************************************************/ 00212 virtual void onSelectionChanged(WindowEventArgs& e); 00213 00214 /************************************************************************* 00215 Overridden Event Handlers 00216 *************************************************************************/ 00217 virtual void onMouseClicked(MouseEventArgs& e); 00218 00219 /************************************************************************* 00220 Implementation Data 00221 *************************************************************************/ 00222 00224 ItemListBase* d_ownerList; 00225 00227 bool d_selected; 00228 00230 bool d_selectable; 00231 00232 // make the ItemListBase a friend 00233 friend class ItemListBase; 00234 00235 private: 00236 00237 void addItemEntryProperties(void); 00238 }; 00239 00240 } // End of CEGUI namespace section 00241 00242 #if defined(_MSC_VER) 00243 # pragma warning(pop) 00244 #endif 00245 00246 #endif // end of guard _CEGUIItemEntry_h_