![]() |
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(_CCZ_UI_STACKPANEL_H_) 00015 #define _CCZ_UI_STACKPANEL_H_ 00016 00017 #include "CzUIPanel.h" 00018 00019 // 00020 // 00021 // 00022 // 00023 // CzUIStackPanel - An image based game actor that acts as a stack panel, allowing other actors to be stacked inside it 00024 // 00025 // 00026 // 00027 // 00028 class CzUIStackPanel : public CzUIPanel 00029 { 00030 // Properties 00031 protected: 00032 eCzOrientation Orientation; ///< Stacking orientation 00033 eCzAlignH AlignH; ///< Horizontal alignment of contained actors 00034 eCzAlignV AlignV; ///< Vertical alignment of contained actors 00035 public: 00036 void setOrientation(eCzOrientation o) { Orientation = o; ResizeToContent(); } 00037 eCzOrientation getOrientation() const { return Orientation; } 00038 void setAlignH(eCzAlignH align) { AlignH = align; setLayoutDirty(true); } 00039 eCzAlignH getAlignH() const { return AlignH; } 00040 void setAlignV(eCzAlignV align) { AlignV = align; setLayoutDirty(true); } 00041 eCzAlignV getAlignV() const { return AlignV; } 00042 bool setProperty(unsigned int property_name, const CzXomlProperty& data, bool delta); 00043 bool setProperty(unsigned int property_name, const CzString& data, bool delta); 00044 bool getProperty(unsigned int property_name, CzXomlProperty& prop); 00045 // Properties end 00046 protected: 00047 bool UpdateLayout(); // Updates the layout of the child items 00048 bool UpdateBinding(unsigned int property_name, CzXomlVariable* var); 00049 public: 00050 CzUIStackPanel() : CzUIPanel(), Orientation(Orientation_Horizontal), AlignH(AlignH_Centre), AlignV(AlignV_Middle) { setActualClassType("stackpanel"); } 00051 virtual ~CzUIStackPanel(); 00052 00053 // Implementation of IzXomlClass interface 00054 int LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node); 00055 00056 void ResizeToContent(); 00057 00058 // Implementation of IzAnimTarget interface 00059 bool UpdateFromAnimation(CzAnimInstance *animation); 00060 00061 // Internal (used by XOML system to setup and cleanup the XOML class properties system 00062 protected: 00063 static CzXomlClassDef* UIStackPanelClassDef; // XOML class definition 00064 public: 00065 static void InitClass(); 00066 static void ReleaseClass(); 00067 00068 static bool _setOrientation(IzXomlResource* target, const CzXomlProperty& prop, bool add); 00069 static CzXomlProperty _getOrientation(IzXomlResource* target); 00070 static bool _setAlignH(IzXomlResource* target, const CzXomlProperty& prop, bool add); 00071 static bool _setAlignV(IzXomlResource* target, const CzXomlProperty& prop, bool add); 00072 }; 00073 00074 // 00075 // CzUIStackPanelCreator - Creates an instance of a stack panel actor object 00076 // 00077 class CzUIStackPanelCreator : public IzXomlClassCreator 00078 { 00079 public: 00080 CzUIStackPanelCreator() 00081 { 00082 setClassName("stackpanel"); 00083 } 00084 IzXomlResource* CreateInstance(IzXomlResource* parent) { return new CzUIStackPanel(); } 00085 }; 00086 00087 00088 #endif // _CCZ_UI_STACKPANEL_H_