Crazy Eddie's GUI System  0.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
TplWindowRendererProperty.h
1 /***********************************************************************
2  filename: TplWindowRendererProperty.h
3  created: 27/08/2011
4  author: Hans Mackowiak
5 
6  purpose:
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _TplWindowRendererProperty_h_
31 #define _TplWindowRendererProperty_h_
32 
33 #include "CEGUI/TplProperty.h"
34 
35 // Start of CEGUI namespace section
36 namespace CEGUI
37 {
38 
39 template<class C, typename T>
41 {
42 public:
44  const String& name, const String& help, const String& origin,
45  typename TplProperty<C, T>::Setter setter,
46  typename TplProperty<C, T>::GetterFunctor getter,
47  typename TplProperty<C, T>::Helper::pass_type defaultValue = T(),
48  bool writesXML = true) :
49 
50  TplProperty<C, T>(name, help, origin,
51  setter, getter,
52  defaultValue, writesXML)
53  {}
54 
55  virtual Property* clone() const
56  {
57  return CEGUI_NEW_AO TplWindowRendererProperty<C, T>(*this);
58  }
59 
60 protected:
64  {
65  C* instance = static_cast<C*>(
66  static_cast<const Window*>(receiver)->getWindowRenderer());
67 
68  CEGUI_CALL_MEMBER_FN(*instance, this->d_setter)(value);
69  }
70 
73  getNative_impl(const PropertyReceiver* receiver) const
74  {
75  const C* instance = static_cast<const C*>(
76  static_cast<const Window*>(receiver)->getWindowRenderer());
77 
78  return this->d_getter(instance);
79  }
80 };
81 
91 #define CEGUI_DEFINE_WINDOW_RENDERER_PROPERTY(class_type, property_native_type, name, help, setter, getter, default_value)\
92 {\
93  static ::CEGUI::TplWindowRendererProperty<class_type, property_native_type> sProperty(\
94  name, help, TypeName, setter, getter, default_value);\
95  \
96  this->registerProperty(&sProperty);\
97 }
98 
99 
111 #define CEGUI_DEFINE_WINDOW_RENDERER_PROPERTY_NO_XML(class_type, property_native_type, name, help, setter, getter, default_value)\
112 {\
113  static ::CEGUI::TplWindowRendererProperty<class_type, property_native_type> sProperty(\
114  name, help, TypeName, setter, getter, default_value, false);\
115  \
116  this->registerProperty(&sProperty,true);\
117 }
118 } // End of CEGUI namespace section
119 
120 #endif // end of guard _TplWindowRendererProperty_h_