AaronCameron.net
I care not for your petty politics.
Not a Member? - Login or Create an Account
Sunday the 20th of May 2012 @ 04:27pm
Front Page Journal Projects Your Profile About
[]

LibN2L-4 Library Code Reference

Classes
Compounds
Files
Members
Method Index
Full Reference

cGuiACSetVar.h

Go to the documentation of this file.
00001 #ifndef _n2l4_cGuiACSetVar_h
00002 #define _n2l4_cGuiACSetVar_h
00003 
00004 #include "n2l/n2l.h"
00005 #include "n2l/gui.h"
00006 #include "n2l/dynVars.h"
00007 
00008 /******************************************************************************/
00009 namespace n2l
00010 {
00011     template <typename TType>
00012     class cGuiACSetVar : public cGuiACInt
00013     {
00014     public:
00015         /**********************************************************************/
00016         cGuiACSetVar( const cAutoPtr<TType> &i_ioVar,
00017             const TType &iValue, const tBool iCheckEnabled = true ) :
00018             mVar( i_ioVar ),
00019             mValue( iValue ),
00020             mCheckEnabled( iCheckEnabled )
00021         {}
00022 
00023         /**********************************************************************/
00024         virtual ~cGuiACSetVar() {}
00025 
00026         /**********************************************************************/
00027         virtual void execute( cGuiElement *const i_ioElement,
00028             const tGuiActionType iType, const cDynVar &iData )
00029         {
00030             if (mCheckEnabled && iData.keyExists("enabled") &&
00031                 !tBool(iData["enabled"])) return;
00032             *mVar = mValue;
00033         }
00034 
00035         virtual const cAutoPtr<cGuiACInt> clone() const
00036         {
00037             cAutoPtr<cGuiACSetVar<TType> > tmp = new cGuiACSetVar<TType>;
00038             cloneInto( tmp );
00039             return tmp;
00040         }
00041 
00042     protected:
00043         virtual void cloneInto(
00044             const cAutoPtr<cGuiACSetVar<TType> > &ioElement ) const
00045         {
00046             ioElement->mVar = mVar;
00047             ioElement->mValue = mValue;
00048             ioElement->mCheckEnabled = mCheckEnabled;
00049         }
00050 
00051     private:
00052         cAutoPtr<TType> mVar;
00053         TType mValue;
00054         tBool mCheckEnabled;
00055 
00056         cGuiACSetVar() {}
00057     };
00058 
00059 }
00060 
00061 #endif
©2012 Aaron Cameron