Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

gui.h

00001 #ifndef _GUI_H
00002 #define _GUI_H
00003 
00004 #include <ClanLib/core.h>
00005 #include <ClanLib/gui.h>
00006 #include <ClanLib/gl.h>
00007 #include <ClanLib/guistylesilver.h>
00008 #include <ClanLib/application.h>
00009 #include <ClanLib/display.h>
00010 
00011 #include "utils.h"
00012 #include "gamestate.h"
00013 
00014 class GUI;
00015 
00016 typedef void (GUI::*callback)();
00017 
00018 struct ButtonHandler { const char* name; callback handler; };
00019 struct MenuName { const char* name; State game_state; };
00020 
00021 class GUI {
00022 public:
00023 
00024     GUI( void );
00025 
00026     ~GUI( void );
00027 
00028     int add_resources( std::string resource_name );
00029 
00030     int initialize( GameState* gamestate );
00031 
00032     int register_signals( void );
00033 
00034     int render( void );
00035 
00036     CL_GraphicContext* get_gc( void );
00037 
00038     bool quit( void );
00039 
00040     // restore screen to normal resolution
00041     void finish( void ) { _window->set_windowed(); }
00042 
00043 private:
00044 
00045     void update_menus( void );
00046 
00047     void on_paint( void );
00048     void on_main_window_close( void );
00049     void on_gui_window_close( CL_SlotParent_v0 &parent_handler );
00050     void on_gui_window_move( int x, int y );
00051     void on_key_press( const CL_InputEvent &key );
00052     void on_mouse_down( const CL_InputEvent& event );
00053 
00054 
00055     void on_start_game( void );
00056     void on_select_level( void );
00057     void on_start_level( void );
00058     void on_help( void );
00059     void on_return_main_menu( void );
00060     void on_level_load( void );
00061     void on_help_ok( void );
00062     void on_quit( void );
00063     void on_change_options( void );
00064     void on_options( void );
00065     void on_options_ok( void );
00066     void on_control_options( void );
00067     void on_set_controls( void );
00068     void on_new_level( void );
00069     void on_esc_main_menu( void );
00070     void on_start_sim( void );
00071     void on_stop_sim( void );
00072     void on_reset_level( void );
00073     void on_next_level( void );
00074     void on_solution( void );
00075     void on_level_info( void );
00076     void on_save( void );
00077 
00078     void toggle_esc_dialog( void );
00079 
00080 
00081     CL_DisplayWindow* _window;
00082 
00083     CL_GUIManager* _gui_manager;
00084 
00085     CL_StyleManager_Silver* _style;
00086 
00087     CL_ComponentManager* _component_manager;
00088 
00089     CL_ResourceManager* _resource_manager;
00090 
00091 
00092     CL_Slot* _slot_button;
00093     CL_Slot* _slot_gui_window_close;
00094     CL_Slot* _slot_gui_window_move;
00095 
00096     CL_Rect* _window_rects;
00097 
00098     CL_Slot _slot_paint;
00099 
00100     CL_Slot _slot_quit;
00101 
00102     CL_Slot _slot_key_press;
00103 
00104     CL_Slot _slot_mouse_down;
00105 
00106 
00107     GameState* _gamestate;
00108 
00109     bool _quit;
00110 
00111     bool _window_moved, _ignore_move_signal;
00112 
00113     bool _show_esc_dialog;
00114 
00115 
00116     int _num_menus, _num_buttons;
00117 
00118 
00119     ButtonHandler* _button_handlers;
00120 
00121     MenuName* _menu_names;
00122 };
00123 
00124 #endif

Generated on Sat Mar 13 15:00:10 2004 by doxygen 1.3.5