AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
00001 // 00002 // 00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine 00004 // 00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk 00006 // 00007 // For updates, tutorials and more details check out www.appeasymobile.com 00008 // 00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin. 00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support 00011 // 00012 // 00013 00014 #if !defined(_CZ_XOML_BINDINGS_H_) 00015 #define _CZ_XOML_BINDINGS_H_ 00016 00017 #include "CzXoml.h" 00018 #include "CzXomlVariables.h" 00019 00020 // 00021 // 00022 // 00023 // 00024 // CzXomlBinding - Represents a bindable property and variable 00025 // 00026 // 00027 // 00028 // 00029 struct CzXomlBinding 00030 { 00031 unsigned int Property; ///< Target property name as a string hash that is updatd with the variables value 00032 #if defined(_DEBUG) 00033 CzString _Property; ///< Target property name that is updated with the variables value (only available in debug builds) 00034 #endif // _DEBUG 00035 CzXomlVariable* Variable; ///< Variable that contains the value that is bound to the target property 00036 CzXomlVariableInt* IndexVar; ///< Cached index variable 00037 CzString VIndex; ///< Index variable (if not empty then this will be taken as a variable that holds the index) 00038 int Index; ///< Index into array of binding variables 00039 00040 CzXomlBinding() : Index(-1), IndexVar(NULL) {} 00041 }; 00042 00043 // 00044 // 00045 // 00046 // 00047 // CzXomlBindings - Manages a collection of XOML bindings. If an object contains a bindings manager then it should traverse the bindings list 00048 // and update the specified properties within the object with the vaukes located in the paired variables 00049 // 00050 // 00051 // 00052 // 00053 class CzXomlBindings : public IzXomlResource 00054 { 00055 public: 00056 // Public access to iteration 00057 typedef CzList<CzXomlBinding*>::iterator _Iterator; 00058 _Iterator begin() { return Bindings.begin(); } 00059 _Iterator end() { return Bindings.end(); } 00060 00061 protected: 00062 // Properties 00063 CzList<CzXomlBinding*> Bindings; // A collection of bindings 00064 public: 00065 void addBinding(CzXomlBinding* binding); 00066 void addBinding(const CzString& propetty_name, CzXomlVariable* variable); 00067 void clearBindings(); 00068 // Properties end 00069 00070 public: 00071 CzXomlBindings() : IzXomlResource() { setClassType("bindings"); } 00072 virtual ~CzXomlBindings() { clearBindings(); } 00073 00074 // Implementation of IzXomlClass interface 00075 int LoadFromXoml(IzXomlResource* parebt, bool load_children, CzXmlNode* node); 00076 }; 00077 00078 // 00079 // CzXomlBindingsCreator - Creates an instance of a bingings manager object 00080 // 00081 class CzXomlBindingsCreator : public IzXomlClassCreator 00082 { 00083 public: 00084 CzXomlBindingsCreator() 00085 { 00086 setClassName("bindings"); 00087 } 00088 IzXomlResource* CreateInstance(IzXomlResource* parent) { return new CzXomlBindings(); } 00089 }; 00090 00091 00092 00093 00094 00095 #endif // _CZ_XOML_BINDINGS_H_