initial commit, lordsawar source, slightly modified
[lordsawar] / src / gui / splash-window.h
1 //  Copyright (C) 2007 Ole Laursen
2 //  Copyright (C) 2007, 2008, 2009 Ben Asselstine
3 //
4 //  This program is free software; you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation; either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU Library General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program; if not, write to the Free Software
16 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
17 //  02110-1301, USA.
18
19 #ifndef GUI_SPLASH_WINDOW_H
20 #define GUI_SPLASH_WINDOW_H
21
22 #include <memory>
23 #include <gtkmm.h>
24 #include <sigc++/trackable.h>
25 #include <sigc++/signal.h>
26
27 #include "game-parameters.h"
28
29
30 #include "decorated.h"
31 /** The opening window of the game
32   * 
33   * This is the first window to pop up, where the user selects whether to start
34   * a new game, load an old one...
35   *
36   * The splash screen is also responsible for launching dialogs in response to
37   * the menu choices.
38   */
39 class SplashWindow: public Decorated
40 {
41  public:
42     SplashWindow();
43     ~SplashWindow();
44         
45     void show();
46     void hide();
47         
48     Gtk::Window *get_window() {return window;}
49
50     sigc::signal<void, std::string, unsigned short, std::string> new_remote_network_game_requested;
51     sigc::signal<void, GameParameters, int, std::string > new_hosted_network_game_requested;
52     sigc::signal<void, GameParameters> new_pbm_game_requested;
53     sigc::signal<void, GameParameters> new_game_requested;
54     sigc::signal<void, std::string> load_requested;
55     sigc::signal<void> quit_requested;
56
57  private:
58     Gtk::Window* window;
59     Gtk::Button *crash_button;
60     Gtk::Button *load_game_button;
61     Gtk::Button *load_scenario_button;
62     Gtk::Button *quit_button;
63     Gtk::Button *new_network_game_button;
64     Gtk::Button *new_pbm_game_button;
65     Gtk::Button *preferences_button;
66     Gtk::VBox *button_box; //crash button box
67             
68     bool on_delete_event(GdkEventAny *e);
69     void on_window_closed();
70   
71     std::string network_game_nickname;
72     
73     void on_new_network_game_clicked();
74     void on_new_pbm_game_clicked();
75     void on_load_game_clicked();
76     void on_load_scenario_clicked();
77     void on_preferences_clicked();
78     void on_quit_clicked();
79     void on_rescue_crashed_game_clicked();
80         
81     void on_game_started(GameParameters g);
82     void on_network_game_created(GameParameters g);
83     void on_pbm_game_created(GameParameters g);
84     void on_network_game_selected(std::string ip, unsigned short port);
85
86 #if 0
87     //! Separate network input thread
88     static void *networkThread(void *arg);
89
90     //! Callback for arrival of network data
91     bool networkInput();
92
93     //! Network data processing
94     void networkData();
95 #endif
96         
97  public:
98     //void on_sdl_surface_changed();
99 };
100
101 #endif