include/gui/controlgrab.h

Go to the documentation of this file.
00001 #ifndef _VGUI_CONTROLGRAB_H
00002 #define _VGUI_CONTROLGRAB_H
00003 
00004 /* controlgrab.h */
00005 #include "controls.h"
00006 #include "gui/gui.h"
00007 
00008 namespace VGUI
00009 {
00010         class ControlSet
00011         {
00012         private:
00013                 string name;
00014                 CONTROL ctrl;
00015                 TEXTURE_HANDLE * tex, * tex_x;
00016 
00017         public:
00018                 ControlSet() { name = ""; tex = tex_x = NULL; }
00019                 ~ControlSet() { }
00020                 string GetName() { return name; }
00021                 void SetName( string new_name ) { name = new_name; }
00022                 CONTROL& GetControl() { return ctrl; }
00023                 void SetControl( CONTROL &new_ctrl ) { ctrl = new_ctrl; }
00024                 TEXTURE_HANDLE * GetTex() { return tex; }
00025                 void SetTex( TEXTURE_HANDLE * new_tex ) { tex = new_tex; }
00026                 TEXTURE_HANDLE * GetTexX() { return tex_x; }
00027                 void SetTexX( TEXTURE_HANDLE * new_tex_x ) { tex_x = new_tex_x; }
00028         };
00029 
00030 
00031         class ControlGrab : public Widget
00032         {
00033         private:
00034                 void BuildControlVectors();
00035 
00036                 TEXTURE_HANDLE add_tex, add_tex_sel;
00037                 TEXTURE_HANDLE key_tex, joy_axis_tex, joy_btn_tex, mouse_btn_tex, mouse_move_tex;
00038                 TEXTURE_HANDLE key_tex_x, joy_axis_tex_x, joy_btn_tex_x, mouse_btn_tex_x, mouse_move_tex_x;
00039                 bool l_down, r_down, mbtn_down, adding, pressed;
00040                 bool analog;
00041                 string setting;
00042                 float spacing;
00043                 vector<ControlSet> local_controls;
00044                 unsigned int selected_icon, pressed_icon, clicked_icon;
00045                 Uint32 add_start;
00046                 bool only_one;
00047 
00048         public:
00049                 ControlGrab();
00050                 ControlGrab( Widget *w );
00051                 ~ControlGrab();
00052 
00053                 void Draw();
00054                 void Draw( float opacity );
00055                 void Save();
00056                 bool MouseOver( float x, float y );
00057                 string MousePress( float x, float y );
00058                 string MouseRelease( float x, float y );
00059                 void ResetValue();
00060                 void IncValuePress();
00061                 void DecValuePress();
00062                 void IncValueRelease();
00063                 void DecValueRelease();
00064                 void Press();
00065                 void Release();
00066                 void GrabKey( SDLKey key );
00067                 void GrabMouseMovement( string direction );
00068                 void GrabMouseButton( int button_idx );
00069                 void GrabJoyButton( Uint8 joy_idx, Uint8 joy_btn );
00070                 void GrabJoyMove( Uint8 joy_idx, Uint8 joy_axis, bool joy_positive, float joy_value );
00071                 void SelectIcon( unsigned int new_selected_icon ) { selected_icon = new_selected_icon; }
00072 
00073                 string GetSetting() { return setting; }
00074                 float GetSpacing() { return spacing; }
00075                 bool GetAdding() { return adding; }
00076                 bool GetAnalog() { return analog; }
00077                 bool GetOnlyOne() { return only_one; }
00078                 void SetSetting( string new_setting ) { setting = new_setting; BuildControlVectors(); }
00079                 void SetSpacing( float new_spacing );
00080                 void SetAnalog( bool new_analog ) { analog = new_analog; }
00081                 void SetOnlyOne( bool new_only_one ) { only_one = new_only_one; }
00082         };
00083 }
00084 
00085 #endif // _VGUI_CONTROLGRAB_H

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