Gui Class Reference

#include <Gui.h>

Collaboration diagram for Gui:

Collaboration graph
[legend]

Public Member Functions

 Gui ()
 ~Gui ()
void set_colours ()
GdkColorget_bg_gdk_colour_p ()
GdkColorget_fg_gdk_colour_p ()
GdkColorget_rtb_message_gdk_colour_p ()
long int get_bg_rgb_colour ()
long int get_fg_rgb_colour ()
long int get_rtb_message_rgb_colour ()
bool is_arenawindow_up ()
ArenaWindowget_arenawindow_p ()
void open_arenawindow ()
void close_arenawindow ()
bool is_messagewindow_up ()
MessageWindowget_messagewindow_p ()
void open_messagewindow ()
void close_messagewindow ()
bool is_scorewindow_up ()
ScoreWindowget_scorewindow_p ()
void open_scorewindow ()
void close_scorewindow ()
bool is_statisticswindow_up ()
StatisticsWindowget_statisticswindow_p ()
void open_statisticswindow ()
void close_statisticswindow ()
bool is_starttournamentwindow_up ()
StartTournamentWindowget_starttournament_p ()
void open_starttournamentwindow ()
void close_starttournamentwindow ()

Static Public Member Functions

void kill_and_start_new_tournament (int result)

Private Attributes

long int bg_rgb_colour
long int fg_rgb_colour
long int rtb_message_rgb_colour
GdkColor bg_gdk_colour
GdkColor fg_gdk_colour
GdkColor rtb_message_gdk_colour
ArenaWindowarenawindow_p
MessageWindowmessagewindow_p
ScoreWindowscorewindow_p
StatisticsWindowstatisticswindow_p
StartTournamentWindowstarttournamentwindow_p

Constructor & Destructor Documentation

Gui::Gui  ) 
 

Definition at line 38 of file Gui.cc.

References arenawindow_p, messagewindow_p, scorewindow_p, starttournamentwindow_p, and statisticswindow_p.

00039 {
00040   arenawindow_p = NULL;
00041   messagewindow_p = NULL;
00042   scorewindow_p = NULL;
00043   statisticswindow_p = NULL;
00044   starttournamentwindow_p = NULL;
00045 }

Gui::~Gui  )  [inline]
 

Definition at line 39 of file Gui.h.

00039 {}


Member Function Documentation

void Gui::close_arenawindow  ) 
 

Definition at line 71 of file Gui.cc.

References arenawindow_p.

Referenced by ArenaRealTime::end_tournament(), ArenaBase::interrupt_tournament(), and ArenaReplay::parse_this_interval().

00072 {
00073   if( NULL != arenawindow_p )
00074     {
00075       delete arenawindow_p;
00076       arenawindow_p = NULL;
00077     }
00078 }

void Gui::close_messagewindow  ) 
 

Definition at line 92 of file Gui.cc.

References messagewindow_p.

Referenced by ArenaBase::interrupt_tournament().

00093 {
00094   if( NULL != messagewindow_p )
00095     {
00096       delete messagewindow_p;
00097       messagewindow_p = NULL;
00098     }
00099 }

void Gui::close_scorewindow  ) 
 

Definition at line 113 of file Gui.cc.

References scorewindow_p.

Referenced by ArenaBase::interrupt_tournament().

00114 {
00115   if( NULL != scorewindow_p )
00116     {
00117       delete scorewindow_p;
00118       scorewindow_p = NULL;
00119     }
00120 }

void Gui::close_starttournamentwindow  ) 
 

Definition at line 183 of file Gui.cc.

References starttournamentwindow_p.

Referenced by StartTournamentWindow::cancel_new_tournament(), StartTournamentWindow::delete_event_occured(), and StartTournamentWindow::start().

00184 {
00185   if( NULL != starttournamentwindow_p )
00186     {
00187       delete starttournamentwindow_p;
00188       starttournamentwindow_p = NULL;
00189     }
00190 }

void Gui::close_statisticswindow  ) 
 

Definition at line 134 of file Gui.cc.

References statisticswindow_p.

Referenced by StatisticsWindow::delete_event_occured(), and StatisticsWindow::exit().

00135 {
00136   if( NULL != statisticswindow_p )
00137     {
00138       delete statisticswindow_p;
00139       statisticswindow_p = NULL;
00140     }
00141 }

ArenaWindow* Gui::get_arenawindow_p  )  [inline]
 

Definition at line 53 of file Gui.h.

Referenced by ControlWindow::arena_window_toggle(), Shot::die(), Robot::die(), Extras::die(), Robot::draw_radar_and_cannon(), Arc::draw_shape(), InnerCircle::draw_shape(), Circle::draw_shape(), Line::draw_shape(), Robot::get_messages(), OptionsWindow::grab_windows(), ArenaReplay::parse_this_time_index(), ArenaRealTime::start_game(), ArenaReplay::step_forward(), ArenaReplay::timeout_function(), and ArenaRealTime::update().

00054     { return arenawindow_p; }

GdkColor* Gui::get_bg_gdk_colour_p  )  [inline]
 

Definition at line 43 of file Gui.h.

References GdkColor.

Referenced by StartTournamentWindow::add_all_selected(), StartTournamentWindow::add_clist(), StatisticsWindow::add_new_row(), ScoreWindow::add_robots(), ArenaWindow::ArenaWindow(), ArenaWindow::clear_area(), Shot::die(), Robot::die(), Extras::die(), Arc::draw_shape(), InnerCircle::draw_shape(), Circle::draw_shape(), Line::draw_shape(), MessageWindow::MessageWindow(), StartTournamentWindow::new_tournament(), ScoreWindow::ScoreWindow(), pixmap_t::set_pixmap(), StartTournamentWindow::StartTournamentWindow(), and StatisticsWindow::StatisticsWindow().

00043 { return &bg_gdk_colour; }

long int Gui::get_bg_rgb_colour  )  [inline]
 

Definition at line 47 of file Gui.h.

Referenced by MessageWindow::MessageWindow().

00047 { return bg_rgb_colour; }

GdkColor* Gui::get_fg_gdk_colour_p  )  [inline]
 

Definition at line 44 of file Gui.h.

References GdkColor.

Referenced by StartTournamentWindow::add_all_selected(), StartTournamentWindow::add_clist(), StatisticsWindow::add_new_row(), ScoreWindow::add_robots(), Robot::draw_radar_and_cannon(), MessageWindow::MessageWindow(), StartTournamentWindow::new_tournament(), ScoreWindow::ScoreWindow(), StartTournamentWindow::StartTournamentWindow(), and StatisticsWindow::StatisticsWindow().

00044 { return &fg_gdk_colour; }

long int Gui::get_fg_rgb_colour  )  [inline]
 

Definition at line 48 of file Gui.h.

00048 { return fg_rgb_colour; }

MessageWindow* Gui::get_messagewindow_p  )  [inline]
 

Definition at line 60 of file Gui.h.

Referenced by OptionsWindow::grab_windows(), ControlWindow::message_window_toggle(), ArenaReplay::parse_this_interval(), ArenaBase::print_message(), ArenaReplay::start_tournament(), ArenaRealTime::start_tournament(), and ArenaRealTime::update().

00061     { return messagewindow_p; }

GdkColor* Gui::get_rtb_message_gdk_colour_p  )  [inline]
 

Definition at line 45 of file Gui.h.

References GdkColor.

Referenced by MessageWindow::MessageWindow().

00045 { return &rtb_message_gdk_colour; }

long int Gui::get_rtb_message_rgb_colour  )  [inline]
 

Definition at line 49 of file Gui.h.

00049 { return rtb_message_rgb_colour; }

ScoreWindow* Gui::get_scorewindow_p  )  [inline]
 

Definition at line 67 of file Gui.h.

Referenced by Robot::display_score(), OptionsWindow::grab_windows(), ControlWindow::kill_robot(), ControlWindow::score_window_toggle(), MessageWindow::show_one_robot(), ArenaRealTime::start_game(), ArenaReplay::step_forward(), ArenaReplay::timeout_function(), and ArenaRealTime::timeout_function().

00068     { return scorewindow_p; }

StartTournamentWindow* Gui::get_starttournament_p  )  [inline]
 

Definition at line 81 of file Gui.h.

00082     { return starttournamentwindow_p; }

StatisticsWindow* Gui::get_statisticswindow_p  )  [inline]
 

Definition at line 74 of file Gui.h.

Referenced by OptionsWindow::grab_windows().

00075     { return statisticswindow_p; }

bool Gui::is_arenawindow_up  )  [inline]
 

Definition at line 51 of file Gui.h.

Referenced by ControlWindow::arena_window_toggle(), OptionsWindow::grab_windows(), ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament().

00052     { return ( arenawindow_p != NULL ); }

bool Gui::is_messagewindow_up  )  [inline]
 

Definition at line 58 of file Gui.h.

Referenced by OptionsWindow::grab_windows(), ControlWindow::message_window_toggle(), ArenaBase::print_message(), ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament().

00059     { return ( messagewindow_p != NULL ); }

bool Gui::is_scorewindow_up  )  [inline]
 

Definition at line 65 of file Gui.h.

Referenced by OptionsWindow::grab_windows(), ControlWindow::score_window_toggle(), ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament().

00066     { return ( scorewindow_p != NULL ); }

bool Gui::is_starttournamentwindow_up  )  [inline]
 

Definition at line 79 of file Gui.h.

00080     { return ( starttournamentwindow_p != NULL ); }

bool Gui::is_statisticswindow_up  )  [inline]
 

Definition at line 72 of file Gui.h.

Referenced by OptionsWindow::grab_windows().

00073     { return ( statisticswindow_p != NULL ); }

void Gui::kill_and_start_new_tournament int  result  )  [static]
 

Definition at line 173 of file Gui.cc.

References ArenaController::is_started(), open_starttournamentwindow(), the_arena, the_arena_controller, and the_gui.

Referenced by open_starttournamentwindow().

00174 {
00175   if( the_arena_controller.is_started() && result == 1 )
00176     {
00177       the_arena.interrupt_tournament();
00178       the_gui.open_starttournamentwindow();
00179     }
00180 }

Here is the call graph for this function:

void Gui::open_arenawindow  ) 
 

Definition at line 60 of file Gui.cc.

References arenawindow_p, Options::get_l(), OPTION_ARENA_WINDOW_POS_X, OPTION_ARENA_WINDOW_POS_Y, OPTION_ARENA_WINDOW_SIZE_X, OPTION_ARENA_WINDOW_SIZE_Y, and the_opts.

Referenced by ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament().

00061 {
00062   if( NULL == arenawindow_p )
00063     arenawindow_p = 
00064       new ArenaWindow( the_opts.get_l( OPTION_ARENA_WINDOW_SIZE_X ),
00065                        the_opts.get_l( OPTION_ARENA_WINDOW_SIZE_Y ),
00066                        the_opts.get_l( OPTION_ARENA_WINDOW_POS_X  ),
00067                        the_opts.get_l( OPTION_ARENA_WINDOW_POS_Y  ) );
00068 }

Here is the call graph for this function:

void Gui::open_messagewindow  ) 
 

Definition at line 81 of file Gui.cc.

References Options::get_l(), messagewindow_p, OPTION_MESSAGE_WINDOW_POS_X, OPTION_MESSAGE_WINDOW_POS_Y, OPTION_MESSAGE_WINDOW_SIZE_X, OPTION_MESSAGE_WINDOW_SIZE_Y, and the_opts.

Referenced by ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament().

00082 {
00083   if( NULL == messagewindow_p )
00084     messagewindow_p = 
00085       new MessageWindow( the_opts.get_l( OPTION_MESSAGE_WINDOW_SIZE_X ),
00086                          the_opts.get_l( OPTION_MESSAGE_WINDOW_SIZE_Y ),
00087                          the_opts.get_l( OPTION_MESSAGE_WINDOW_POS_X ),
00088                          the_opts.get_l( OPTION_MESSAGE_WINDOW_POS_Y ) );
00089 }

Here is the call graph for this function:

void Gui::open_scorewindow  ) 
 

Definition at line 102 of file Gui.cc.

References Options::get_l(), OPTION_SCORE_WINDOW_POS_X, OPTION_SCORE_WINDOW_POS_Y, OPTION_SCORE_WINDOW_SIZE_X, OPTION_SCORE_WINDOW_SIZE_Y, scorewindow_p, and the_opts.

Referenced by ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament().

00103 {
00104   if( NULL == scorewindow_p )
00105     scorewindow_p = 
00106       new ScoreWindow( the_opts.get_l( OPTION_SCORE_WINDOW_SIZE_X ),
00107                        the_opts.get_l( OPTION_SCORE_WINDOW_SIZE_Y ),
00108                        the_opts.get_l( OPTION_SCORE_WINDOW_POS_X ),
00109                        the_opts.get_l( OPTION_SCORE_WINDOW_POS_Y ) );
00110 }

Here is the call graph for this function:

void Gui::open_starttournamentwindow  ) 
 

Definition at line 144 of file Gui.cc.

References _, DialogFunction, List< T >::insert_last(), ArenaController::is_started(), kill_and_start_new_tournament(), NOT_STARTED, starttournamentwindow_p, the_arena, and the_arena_controller.

Referenced by kill_and_start_new_tournament(), and ControlWindow::new_tournament().

00145 {
00146   bool open = false;
00147   if( NULL == starttournamentwindow_p )
00148     {
00149       if( the_arena_controller.is_started() )
00150         if( the_arena.get_state() != NOT_STARTED &&
00151             the_arena.get_state() != FINISHED )
00152           {
00153             String info_text = _("This action will kill the current tournament.\n"
00154                                  "Do you want to do that?");
00155             List<String> string_list;
00156             string_list.insert_last( new String( "Yes" ) );
00157             string_list.insert_last( new String( "No"  ) );
00158             Dialog( info_text, string_list,
00159                     (DialogFunction) Gui::kill_and_start_new_tournament );
00160           }
00161         else
00162           open = true;
00163       else
00164         open = true;
00165     }
00166 
00167   if( open )
00168     starttournamentwindow_p = 
00169       new StartTournamentWindow( -1, -1, -1, -1 );
00170 }

Here is the call graph for this function:

void Gui::open_statisticswindow  ) 
 

Definition at line 123 of file Gui.cc.

References Options::get_l(), ArenaController::is_started(), OPTION_STATISTICS_WINDOW_SIZE_X, OPTION_STATISTICS_WINDOW_SIZE_Y, statisticswindow_p, the_arena, the_arena_controller, and the_opts.

Referenced by ControlWindow::statistics_clicked().

00124 {
00125   if( the_arena_controller.is_started() )
00126     if( NULL == statisticswindow_p && the_arena.get_state() != NOT_STARTED )
00127       statisticswindow_p = 
00128         new StatisticsWindow( the_opts.get_l( OPTION_STATISTICS_WINDOW_SIZE_X ),
00129                               the_opts.get_l( OPTION_STATISTICS_WINDOW_SIZE_Y ),
00130                               -1, -1 );
00131 }

Here is the call graph for this function:

void Gui::set_colours  ) 
 

Definition at line 48 of file Gui.cc.

References bg_gdk_colour, bg_rgb_colour, fg_gdk_colour, fg_rgb_colour, Options::get_l(), make_gdk_colour(), OPTION_BACKGROUND_COLOUR, OPTION_FOREGROUND_COLOUR, OPTION_RTB_MESSAGE_COLOUR, rtb_message_gdk_colour, rtb_message_rgb_colour, and the_opts.

Referenced by main(), and OptionsWindow::set_all_options().

00049 {  
00050   bg_rgb_colour = the_opts.get_l( OPTION_BACKGROUND_COLOUR );
00051   fg_rgb_colour = the_opts.get_l( OPTION_FOREGROUND_COLOUR );
00052   rtb_message_rgb_colour = the_opts.get_l( OPTION_RTB_MESSAGE_COLOUR );
00053 
00054   bg_gdk_colour = make_gdk_colour( bg_rgb_colour );
00055   fg_gdk_colour = make_gdk_colour( fg_rgb_colour );
00056   rtb_message_gdk_colour = make_gdk_colour( rtb_message_rgb_colour );
00057 }

Here is the call graph for this function:


Field Documentation

ArenaWindow* Gui::arenawindow_p [private]
 

Definition at line 97 of file Gui.h.

Referenced by close_arenawindow(), Gui(), and open_arenawindow().

GdkColor Gui::bg_gdk_colour [private]
 

Definition at line 93 of file Gui.h.

Referenced by set_colours().

long int Gui::bg_rgb_colour [private]
 

Definition at line 89 of file Gui.h.

Referenced by set_colours().

GdkColor Gui::fg_gdk_colour [private]
 

Definition at line 94 of file Gui.h.

Referenced by set_colours().

long int Gui::fg_rgb_colour [private]
 

Definition at line 90 of file Gui.h.

Referenced by set_colours().

MessageWindow* Gui::messagewindow_p [private]
 

Definition at line 98 of file Gui.h.

Referenced by close_messagewindow(), Gui(), and open_messagewindow().

GdkColor Gui::rtb_message_gdk_colour [private]
 

Definition at line 95 of file Gui.h.

Referenced by set_colours().

long int Gui::rtb_message_rgb_colour [private]
 

Definition at line 91 of file Gui.h.

Referenced by set_colours().

ScoreWindow* Gui::scorewindow_p [private]
 

Definition at line 99 of file Gui.h.

Referenced by close_scorewindow(), Gui(), and open_scorewindow().

StartTournamentWindow* Gui::starttournamentwindow_p [private]
 

Definition at line 101 of file Gui.h.

Referenced by close_starttournamentwindow(), Gui(), and open_starttournamentwindow().

StatisticsWindow* Gui::statisticswindow_p [private]
 

Definition at line 100 of file Gui.h.

Referenced by close_statisticswindow(), Gui(), and open_statisticswindow().


The documentation for this class was generated from the following files:
Generated on Fri Oct 15 15:49:56 2004 for Real Time Battle by  doxygen 1.3.9.1