AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzUITextBox.h
Go to the documentation of this file.
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_TEXTBOX_H_)
00015 #define _CCZ_UI_TEXTBOX_H_
00016 
00017 #include "CzUIBase.h"
00018 #include "CzUILabel.h"
00019 
00020 //
00021 //
00022 //
00023 //
00024 // CzUITextBox - An image based actor that acts as a text box
00025 //
00026 //
00027 //
00028 //
00029 class CzUITextBox : public CzUILabel
00030 {
00031 public:
00032 
00033     // Properties
00034 protected:
00035     CzString                Prompt;                             // Prompt to show to the user when asked for text input
00036     CzString                TargetVariable;                     // Name of the variable that will be updated with the value entered
00037     CzInput::eInputTypeHint TypeHint;                           // Hint to which type of data user should enter
00038 public:
00039     void                    setPrompt(const char* prompt)               { Prompt = prompt; }
00040     CzString&               getPrompt()                                 { return Prompt; }
00041     void                    setTargetVariable(const char* name)         { TargetVariable = name; }
00042     CzString&               getTargetVariable()                         { return TargetVariable; }
00043     void                    setTypeHint(CzInput::eInputTypeHint hint)   { TypeHint = hint; }
00044     CzInput::eInputTypeHint getTypeHint() const                         { return TypeHint; }
00045     bool                    setProperty(unsigned int property_name, const CzXomlProperty& data, bool delta);
00046     bool                    setProperty(unsigned int property_name, const CzString& data, bool delta);
00047     bool                    getProperty(unsigned int property_name, CzXomlProperty& prop);
00048     // Properties end
00049 protected:
00050     bool                    UpdateBinding(unsigned int property_name, CzXomlVariable* var);
00051 public:
00052     CzUITextBox();
00053 
00054     // Event handlers
00055     virtual void            NotifyTapped(int index, int x, int y, bool allow_bubble);
00056     virtual void            NotifyTextChanged();
00057 
00058     // Implementation of IzXomlClass interface
00059     int                     LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node);
00060 
00061     // Implementation of IzAnimTarget interface
00062     bool                    UpdateFromAnimation(CzAnimInstance *animation);
00063 
00064     // Internal (used by XOML system to setup and cleanup the XOML class properties system
00065 protected:
00066     static CzXomlClassDef*  UITextBoxClassDef;                              // XOML class definition
00067 public:
00068     static void             InitClass();
00069     static void             ReleaseClass();
00070     static bool             _setPrompt(IzXomlResource* target, const CzXomlProperty& prop, bool add);
00071     static CzXomlProperty   _getPrompt(IzXomlResource* target);
00072     static bool             _setVariable(IzXomlResource* target, const CzXomlProperty& prop, bool add);
00073     static CzXomlProperty   _getVariable(IzXomlResource* target);
00074     static bool             _setTypeHint(IzXomlResource* target, const CzXomlProperty& prop, bool add);
00075     static CzXomlProperty   _getTypeHint(IzXomlResource* target);
00076     static bool             _setOnTextChanged(IzXomlResource* target, const CzXomlProperty& prop, bool add);
00077 };
00078 
00079 //
00080 //  CzUITextBoxCreator - Creates an instance of text box actor object
00081 //
00082 class CzUITextBoxCreator : public IzXomlClassCreator
00083 {
00084 public:
00085     CzUITextBoxCreator()
00086     {
00087         setClassName("textbox");
00088     }
00089     IzXomlResource* CreateInstance(IzXomlResource* parent)  { return new CzUITextBox(); }
00090 };
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 #endif  // _CCZ_UI_TEXTBOX_H_