AaronCameron.net
Because you all make me very, very tired.
Not a Member? - Login or Create an Account
Wednesday the 23rd of May 2012 @ 09:57am
Front Page Journal Projects Your Profile About
[]

LibN2L-4 Library Code Reference

Classes
Compounds
Files
Members
Method Index
Full Reference

cGuiSButton.h

Go to the documentation of this file.
00001 /************************************************************************
00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library
00003 Copyright (C) 2002  Aaron Cameron
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation; either
00008 version 2.1 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 
00019 A copy of the GNU Lesser General Public License has been provided with
00020 this library in the file 'COPYING'.
00021 
00022 Contact information for the author of this library has been provided
00023 with this library in the file 'AUTHOR'.
00024 ************************************************************************/
00025 #ifndef _n2l4_cGuiSButton_H
00026 #define _n2l4_cGuiSButton_H
00027 
00028 #include "n2l/n2l.h"
00029 
00030 #include "gui/types.h"
00031 #include "gui/cGuiInteractive.h"
00032 
00033 #include "gui/cGuiFill.h"
00034 #include "gui/cGuiTextStyle.h"
00035 
00036 namespace n2l
00037 {
00038     class cDynVar;
00039     class cVfsNodeInterface;
00040 
00041     /**************************************************************************/
00046     class cGuiSButton : public cGuiInteractive
00047     {
00048     public:
00049         typedef enum {
00050             Type_Push,
00051             Type_Toggle,
00052 
00053             Type_NumTypes
00054         } tType;
00055 
00056         cGuiSButton();
00057         cGuiSButton( const cVfsNodeInterface &iNode );
00058         cGuiSButton( const cDynVar &iDef );
00059 
00060         virtual ~cGuiSButton();
00061 
00062         virtual void load( const cVfsNodeInterface &iNode );
00063         virtual void load( const cDynVar &iDef );
00064 
00065         virtual void draw() const;
00066 
00067         virtual void fill( const cGuiFill &iFill );
00068         virtual const cGuiFill &fill() const;
00069 
00070         virtual void label( const tString & iLabel );
00071         virtual const tString &label() const;
00072 
00073         virtual void textStyle( const cGuiTextStyle &iStyle );
00074         virtual const cGuiTextStyle &textStyle() const;
00075 
00076         virtual void type( const tType iType );
00077         virtual const tType type() const;
00078 
00079         virtual void toggledOn( const tBool iToggled );
00080         virtual const tBool toggledOn() const;
00081 
00082         virtual void enabled( const tBool iEnabled );
00083         virtual const tBool enabled() const;
00084 
00085         virtual void setAccel( const tKey &iKey, const tKeyMods &iMods );
00086         virtual void clearAccel();
00087 
00088         virtual void prop( const tString &iName, const cDynVar &iVal,
00089             const tString &iInnerKey = "" );
00090         virtual const cDynVar prop( const tString &iName,
00091             const tString &iInnerKey = "" ) const;
00092 
00093         virtual const cAutoPtr<cGuiElement> clone() const;
00094 
00095         friend class cGuiSButtonSelectBox;
00096 
00097     protected:
00098         tString mLabel;
00099 
00100         cGuiFill mFill;
00101         cGuiTextStyle mTextStyle;
00102 
00103         tType mType;
00104         tBool mToggledOn;
00105         tBool mEnabled;
00106 
00109         tBool mUseAccel;
00110         tKey mKey;
00111         tKeyMods mKeyMod;
00112 
00113         virtual void cloneInto(
00114             const cAutoPtr<cGuiSButton> &ioElement ) const;
00115 
00116         virtual void addExtraClickedData( tActionData & oData );
00117         virtual void addExtraOverData( tActionData &oData );
00118         virtual void addExtraOutData( tActionData &oData );
00119         virtual void addExtraPressedData( tActionData &oData );
00120         virtual void addExtraReleasedData( tActionData &oData );
00121         virtual void addExtraDisabledData( tActionData &oData );
00122 
00123     private:
00124 #       ifdef N2L_PASSIVE_GUI_REG
00125             static tBool smRegistered;
00126 #       endif
00127 
00128         void boundCheckType( const tType iType ) const;
00129 
00133         void reset();
00134 
00135         // Callbacks
00136         static void clickedCallback( cGuiElement *const i_ioElement,
00137             const tGuiActionType iType, const tActionData &iData );
00138 
00139         static void keystrokeCallback( cGuiElement *const i_ioElement,
00140             const tGuiActionType iType, const tActionData &iData );
00141 
00142     }; // class
00143 
00144 } // namespace n2l
00145 
00146 #endif
©2012 Aaron Cameron