00001 #ifndef _VGUI_PAGE_H
00002 #define _VGUI_PAGE_H
00003
00004
00005 #include <map>
00006 #include <string>
00007 #include <GL/gl.h>
00008 #include <SDL/SDL.h>
00009 #include "multiplay.h"
00010 #include "textures.h"
00011 #include "font.h"
00012 #include "gamestate.h"
00013 #include "settings.h"
00014 #include "configfile.h"
00015 #include "globals.h"
00016 #include "widget.h"
00017
00018 namespace VGUI
00019 {
00020 class Page
00021 {
00022 private:
00023 void Init();
00024 void DeInit();
00025 void ReleaseWidgets();
00026
00027 vector<Widget*> page_objects;
00028 vector<Page*> tabs;
00029 CONFIGFILE menu_file;
00030 TEXTURE_HANDLE background, tab_active, tab_inactive, tab_page_background;
00031 string path;
00032 string name, tab_text;
00033 unsigned int cur_obj, cancel_obj, default_obj, cur_tab;
00034 unsigned int num_widgets, num_tabs;
00035 unsigned int clicked_obj;
00036 bool is_dialog, l_pressed, r_pressed;
00037 bool has_changes;
00038
00039 public:
00040 Page();
00041 Page( string filename );
00042 ~Page();
00043 void Draw();
00044 void Draw( float opacity );
00045 void UpWidget();
00046 void DownWidget();
00047 void RightWidgetPress();
00048 void LeftWidgetPress();
00049 void RightWidgetRelease();
00050 void LeftWidgetRelease();
00051 void BackspacePress();
00052 void DeletePress();
00053 void BackspaceRelease();
00054 void DeleteRelease();
00055 void KeyPress();
00056 string KeyRelease();
00057 void Type( SDLKey key );
00058 void CancelPress();
00059 string CancelRelease();
00060 string ExecWidget();
00061 void SaveSettings();
00062 void ClearSettings();
00063 void SelectDefault() { page_objects[cur_obj]->SetSelected( false ); cur_obj = default_obj; page_objects[cur_obj]->SetSelected( true ); }
00064 void MouseSelect( float x, float y );
00065 bool MouseOver( float x, float y );
00066 string MousePressWidget( float x, float y );
00067 string MouseReleaseWidget( float x, float y );
00068 void StartGame();
00069 void ControlGrabKey( SDLKey key );
00070 void ControlGrabMouseMove( string direction );
00071 void ControlGrabMouseButton( int button_idx );
00072 void ControlGrabJoyButton( Uint8 joy_idx, Uint8 joy_btn );
00073 void ControlGrabJoyMove( Uint8 joy_idx, Uint8 joy_axis, bool joy_positive, float joy_value );
00074 bool HasChanges() { return has_changes; }
00075
00076 Widget* GetWidget( int idx ) { return page_objects[idx]; }
00077 bool GetDialog() { return is_dialog; }
00078 int GetNumWidgets() { return num_widgets; }
00079 string GetName() { return name; }
00080 string GetTabText() { return tab_text; }
00081 void SetDialog( bool new_dialog ) { is_dialog = new_dialog; }
00082 void SetName( string new_name ) { name = new_name; }
00083 };
00084 }
00085
00086 #endif // _VGUI_PAGE_H