include/gui/toggle.h

Go to the documentation of this file.
00001 #ifndef _VGUI_TOGGLE_H
00002 #define _VGUI_TOGGLE_H
00003 
00004 /* toggle.h */
00005 #include "gui.h"
00006 
00007 namespace VGUI
00008 {
00009         class Toggle : public Widget
00010         {
00011         private:
00012                 TEXTURE_HANDLE on_up, on_down, off_up, off_down;
00013                 bool value, default_value;
00014                 string setting;
00015                 string true_txt;
00016                 string false_txt;
00017                 float tex_width, tex_height, spacing;
00018                 bool down;
00019 
00020         public:
00021                 Toggle();
00022                 Toggle( Widget* w );
00023                 ~Toggle();
00024                 void Draw();
00025                 void Draw( float opacity );
00026                 void Save();
00027                 bool MouseOver( float x, float y );
00028                 string MousePress( float x, float y );
00029                 string MouseRelease( float x, float y );
00030                 void Press();
00031                 void Release();
00032                 void ResetValue();
00033 
00034                 bool GetValue() { return value; }
00035                 bool GetDefaultValue() { return default_value; }
00036                 string GetTrueText() { return true_txt; }
00037                 string GetFalseText() { return false_txt; }
00038                 float GetSpacing() { return spacing; }
00039                 void SetValue( bool new_value ) { value = new_value; }
00040                 void SetDefaultValue( bool new_value ) { default_value = new_value; }
00041                 void SetTrueText( string txt ) { true_txt = txt; }
00042                 void SetFalseText( string txt ) { false_txt = txt; }
00043                 void SetSetting( string new_setting ) { setting = new_setting; }
00044                 void SetSpacing( float new_spacing );
00045                 void TogValue() { value = !value; }
00046         };
00047 }
00048 
00049 
00050 #endif // _VGUI_TOGGLE_H

Generated on Thu Oct 19 04:05:47 2006 by  doxygen 1.4.6