#include <MessageWindow.h>
Collaboration diagram for MessageWindow:

Public Member Functions | |
| MessageWindow (const int default_width=-1, const int default_height=-1, const int default_x_pos=-1, const int default_y_pos=-1) | |
| ~MessageWindow () | |
| void | set_window_title () |
| void | add_message (const String &name_of_messager, const String &message) |
| void | freeze_clist () |
| void | thaw_clist () |
| void | set_viewed_robot (class Robot *robot_p) |
| void | set_window_shown (bool win_shown) |
| GtkWidget * | get_window_p () |
| bool | is_window_shown () |
| GtkWidget * | get_clist () |
Static Public Member Functions | |
| gboolean | hide_window (GtkWidget *widget, GdkEvent *event, class MessageWindow *messagewindow_p) |
| void | show_window (GtkWidget *widget, class MessageWindow *messagewindow_p) |
| void | clear_clist (GtkWidget *widget, class MessageWindow *messagewindow_p) |
| void | show_one_robot (GtkWidget *widget, class MessageWindow *messagewindow_p) |
| void | show_all (GtkWidget *widget, class MessageWindow *messagewindow_p) |
Private Attributes | |
| GtkWidget * | window_p |
| GtkWidget * | clist |
| Robot * | viewed_robot |
| GtkStyle * | rtb_message_row_style |
| GtkStyle * | robot_message_row_style |
| bool | window_shown |
|
||||||||||||||||||||
|
Definition at line 35 of file MessageWindow.cc. References _, clear_clist(), clist, controlwindow_p, Gui::get_bg_gdk_colour_p(), Gui::get_bg_rgb_colour(), Gui::get_fg_gdk_colour_p(), Gui::get_rtb_message_gdk_colour_p(), gpointer, GtkWidget, hide_window(), ControlWindow::is_messagewindow_checked(), make_gdk_colour(), robot_message_row_style, rtb_message_row_style, set_window_title(), show_all(), show_one_robot(), the_gui, viewed_robot, window_p, and window_shown. 00039 {
00040 // The window widget
00041
00042 viewed_robot = NULL;
00043
00044 window_p = gtk_window_new( GTK_WINDOW_TOPLEVEL );
00045 gtk_widget_set_name( window_p, "RTB Message" );
00046
00047 set_window_title();
00048
00049 gtk_container_border_width( GTK_CONTAINER( window_p ), 12 );
00050
00051 if( default_width != -1 && default_height != -1 )
00052 {
00053 gtk_window_set_default_size( GTK_WINDOW( window_p ),
00054 default_width, default_height );
00055 gtk_widget_set_usize( window_p , 300, 110 );
00056 }
00057
00058 if( default_x_pos != -1 && default_y_pos != -1 )
00059 gtk_widget_set_uposition( window_p, default_x_pos, default_y_pos );
00060
00061 gtk_signal_connect( GTK_OBJECT( window_p ), "delete_event",
00062 (GtkSignalFunc) MessageWindow::hide_window,
00063 (gpointer) this );
00064
00065 // Main box
00066
00067 GtkWidget* vbox = gtk_vbox_new( FALSE, 10 );
00068 gtk_container_add( GTK_CONTAINER( window_p ), vbox );
00069 gtk_widget_show( vbox );
00070
00071 // Buttons
00072
00073 GtkWidget* hbox = gtk_hbox_new( FALSE, 10 );
00074 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
00075 gtk_widget_show( hbox );
00076
00077 struct button_t { String label; GtkSignalFunc func; };
00078 struct button_t buttons[] = {
00079 { (String)_(" Clear all messages "),
00080 (GtkSignalFunc) MessageWindow::clear_clist },
00081 { (String)_(" Show only marked robot "),
00082 (GtkSignalFunc) MessageWindow::show_one_robot },
00083 { (String)_(" Show all "),
00084 (GtkSignalFunc) MessageWindow::show_all } };
00085 for(int i = 0;i < 3; i++)
00086 {
00087 GtkWidget* button =
00088 gtk_button_new_with_label( buttons[i].label.chars() );
00089 gtk_signal_connect( GTK_OBJECT( button ), "clicked",
00090 (GtkSignalFunc) buttons[i].func,
00091 (gpointer) this );
00092 gtk_box_pack_start( GTK_BOX( hbox ), button,
00093 TRUE, TRUE, 0 );
00094 gtk_widget_show( button );
00095 }
00096
00097 GtkObject* hadj = gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 1.0, 1.0 );
00098 GtkObject* vadj = gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 1.0, 1.0 );
00099 GtkWidget* scrolled_win =
00100 gtk_scrolled_window_new( GTK_ADJUSTMENT( hadj ),
00101 GTK_ADJUSTMENT( vadj ) );
00102 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ),
00103 GTK_POLICY_AUTOMATIC,
00104 GTK_POLICY_AUTOMATIC );
00105
00106 gtk_box_pack_start( GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0 );
00107 gtk_widget_show( scrolled_win );
00108
00109 char* titles[2] = { _(" Robot "), _(" Message ") };
00110 clist = gtk_clist_new_with_titles( 2, titles );
00111 gtk_clist_set_selection_mode( GTK_CLIST( clist ),
00112 GTK_SELECTION_BROWSE );
00113 gtk_clist_set_column_width( GTK_CLIST( clist ), 0, 130 );
00114 gtk_clist_set_column_width( GTK_CLIST( clist ), 1, 1000 );
00115 gtk_clist_set_column_justification( GTK_CLIST( clist ), 0,
00116 GTK_JUSTIFY_LEFT );
00117 gtk_clist_set_column_justification( GTK_CLIST( clist ), 1,
00118 GTK_JUSTIFY_LEFT );
00119 gtk_clist_column_titles_passive( GTK_CLIST( clist ) );
00120 gtk_clist_set_shadow_type( GTK_CLIST( clist ), GTK_SHADOW_IN );
00121 gtk_container_add( GTK_CONTAINER( scrolled_win ), clist );
00122
00123 GtkStyle* clist_style = gtk_rc_get_style(window_p);
00124 if( clist_style == NULL )
00125 clist_style = gtk_style_new();
00126 else
00127 clist_style = gtk_style_copy(clist_style);
00128 clist_style->base[GTK_STATE_NORMAL] = *(the_gui.get_bg_gdk_colour_p());
00129 clist_style->base[GTK_STATE_ACTIVE] = make_gdk_colour( 0xffffff );
00130 clist_style->bg[GTK_STATE_SELECTED] = make_gdk_colour( 0xf0d2b4 );
00131 clist_style->fg[GTK_STATE_SELECTED] = *(the_gui.get_fg_gdk_colour_p());
00132 gtk_widget_set_style( clist, clist_style );
00133 gtk_widget_show( clist );
00134
00135 rtb_message_row_style = gtk_rc_get_style(window_p);
00136 if( rtb_message_row_style == NULL )
00137 rtb_message_row_style = gtk_style_new();
00138 else
00139 rtb_message_row_style = gtk_style_copy(rtb_message_row_style);
00140 rtb_message_row_style->base[GTK_STATE_NORMAL] =
00141 make_gdk_colour( the_gui.get_bg_rgb_colour() );
00142 rtb_message_row_style->base[GTK_STATE_ACTIVE] = make_gdk_colour( 0xffffff );
00143 rtb_message_row_style->bg[GTK_STATE_SELECTED] = make_gdk_colour( 0xf0d2b4 );
00144 rtb_message_row_style->fg[GTK_STATE_NORMAL] =
00145 *( the_gui.get_rtb_message_gdk_colour_p() );
00146 rtb_message_row_style->fg[GTK_STATE_SELECTED] =
00147 *( the_gui.get_rtb_message_gdk_colour_p() );
00148
00149 robot_message_row_style = gtk_rc_get_style(window_p);
00150 if( robot_message_row_style == NULL )
00151 robot_message_row_style = gtk_style_new();
00152 else
00153 robot_message_row_style = gtk_style_copy(robot_message_row_style);
00154 robot_message_row_style->base[GTK_STATE_NORMAL] =
00155 make_gdk_colour( the_gui.get_bg_rgb_colour() );
00156 robot_message_row_style->base[GTK_STATE_ACTIVE] = make_gdk_colour( 0xffffff );
00157 robot_message_row_style->bg[GTK_STATE_SELECTED] = make_gdk_colour( 0xf0d2b4 );
00158 robot_message_row_style->fg[GTK_STATE_NORMAL] = *( the_gui.get_fg_gdk_colour_p() );
00159 robot_message_row_style->fg[GTK_STATE_SELECTED] = *( the_gui.get_fg_gdk_colour_p() );
00160
00161 if( window_shown = ( controlwindow_p->is_messagewindow_checked() ) )
00162 gtk_widget_show_now( window_p );
00163 }
|
Here is the call graph for this function:

|
|
Definition at line 165 of file MessageWindow.cc. References window_p. 00166 {
00167 gtk_widget_destroy( window_p );
00168 }
|
|
||||||||||||
|
Definition at line 183 of file MessageWindow.cc. References clist, Robot::get_robot_name(), String::non_const_chars(), robot_message_row_style, rtb_message_row_style, and viewed_robot. Referenced by ArenaBase::print_message(). 00185 {
00186 if( window_shown )
00187 {
00188 if( viewed_robot != NULL &&
00189 viewed_robot->get_robot_name() != name_of_messager &&
00190 name_of_messager != "RealTimeBattle" )
00191 return;
00192
00193 char* lst[2] = { name_of_messager.non_const_chars(),
00194 g_utf8_normalize (message.non_const_chars(), -1, G_NORMALIZE_ALL) };
00195
00196 int row = 0;
00197 row = gtk_clist_insert( GTK_CLIST( clist ), row, lst );
00198
00199
00200 if( name_of_messager == "RealTimeBattle" )
00201 gtk_clist_set_row_style( GTK_CLIST( clist ), row, rtb_message_row_style );
00202 else
00203 gtk_clist_set_row_style( GTK_CLIST( clist ), row, robot_message_row_style );
00204
00205 }
00206 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 265 of file MessageWindow.cc. Referenced by MessageWindow(), ArenaReplay::start_tournament(), and ArenaRealTime::start_tournament(). 00267 {
00268 gtk_clist_clear( GTK_CLIST( messagewindow_p->get_clist() ) );
00269 }
|
|
|
Definition at line 209 of file MessageWindow.cc. References clist. Referenced by ArenaReplay::parse_this_interval(), and ArenaRealTime::update(). 00210 {
00211 if( window_shown )
00212 gtk_clist_freeze( GTK_CLIST( clist ) );
00213 }
|
|
|
Definition at line 68 of file MessageWindow.h. References GtkWidget. 00068 { return clist; }
|
|
|
Definition at line 66 of file MessageWindow.h. References GtkWidget. Referenced by OptionsWindow::grab_windows(), and ControlWindow::message_window_toggle(). 00066 { return window_p; }
|
|
||||||||||||||||
|
Definition at line 236 of file MessageWindow.cc. References controlwindow_p, ControlWindow::get_show_message_menu_item(), GtkWidget, and ControlWindow::is_messagewindow_checked(). Referenced by MessageWindow(). 00238 {
00239 if( messagewindow_p->is_window_shown() )
00240 {
00241 gtk_widget_hide( messagewindow_p->get_window_p() );
00242 messagewindow_p->set_window_shown( false );
00243 if( controlwindow_p->is_messagewindow_checked() )
00244 {
00245 GtkWidget* menu_item = controlwindow_p->get_show_message_menu_item();
00246 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( menu_item ), FALSE );
00247 }
00248 }
00249 return true;
00250 }
|
Here is the call graph for this function:

|
|
Definition at line 67 of file MessageWindow.h. 00067 { return window_shown; }
|
|
|
Definition at line 223 of file MessageWindow.cc. References viewed_robot. 00224 {
00225 viewed_robot = robot_p;
00226 }
|
|
|
Definition at line 229 of file MessageWindow.cc. References window_shown. 00230 {
00231 window_shown = win_shown;
00232 }
|
|
|
Definition at line 171 of file MessageWindow.cc. References _, String::chars(), Robot::get_robot_name(), viewed_robot, and window_p. Referenced by MessageWindow(). 00172 {
00173 String title = (String)_("Messages");
00174 if( viewed_robot != NULL )
00175 title += " - " + viewed_robot->get_robot_name();
00176 else
00177 title += " - " + (String)_(" All ");
00178
00179 gtk_window_set_title( GTK_WINDOW( window_p ), title.chars() );
00180 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 281 of file MessageWindow.cc. References ControlWindow::set_window_title(). Referenced by MessageWindow(). 00283 {
00284 messagewindow_p->set_viewed_robot( NULL );
00285 messagewindow_p->set_window_title();
00286 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 272 of file MessageWindow.cc. References Gui::get_scorewindow_p(), ScoreWindow::get_selected_robot(), ControlWindow::set_window_title(), and the_gui. Referenced by MessageWindow(). 00274 {
00275 messagewindow_p->set_viewed_robot
00276 ( the_gui.get_scorewindow_p()->get_selected_robot() );
00277 messagewindow_p->set_window_title();
00278 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 253 of file MessageWindow.cc. 00255 {
00256 if( !messagewindow_p->is_window_shown() )
00257 {
00258 gtk_widget_show_now( messagewindow_p->get_window_p() );
00259 messagewindow_p->set_window_shown( true );
00260 }
00261 }
|
|
|
Definition at line 216 of file MessageWindow.cc. References clist. Referenced by ArenaReplay::parse_this_interval(), and ArenaRealTime::update(). 00217 {
00218 if( window_shown )
00219 gtk_clist_thaw( GTK_CLIST( clist ) );
00220 }
|
|
|
Definition at line 73 of file MessageWindow.h. Referenced by add_message(), freeze_clist(), MessageWindow(), and thaw_clist(). |
|
|
Definition at line 77 of file MessageWindow.h. Referenced by add_message(), and MessageWindow(). |
|
|
Definition at line 76 of file MessageWindow.h. Referenced by add_message(), and MessageWindow(). |
|
|
Definition at line 74 of file MessageWindow.h. Referenced by add_message(), MessageWindow(), set_viewed_robot(), and set_window_title(). |
|
|
Definition at line 72 of file MessageWindow.h. Referenced by MessageWindow(), set_window_title(), and ~MessageWindow(). |
|
|
Definition at line 79 of file MessageWindow.h. Referenced by MessageWindow(), and set_window_shown(). |
1.3.9.1