ArenaWindow Class Reference

#include <ArenaWindow.h>

Collaboration diagram for ArenaWindow:

Collaboration graph
[legend]

Public Member Functions

 ArenaWindow (const int default_width=-1, const int default_height=-1, const int default_x_pos=-1, const int default_y_pos=-1)
 ~ArenaWindow ()
void set_window_title ()
int boundary2pixel_x (const double x)
int boundary2pixel_y (const double y)
void clear_area ()
void draw_everything ()
void draw_moving_objects (const bool clear_objects_first)
void drawing_area_scale_changed (const bool change_da_value=false)
void draw_circle (const Vector2D &center, const double radius, GdkColor &colour, const bool filled)
void draw_arc (const Vector2D &center, const double inner_radius, const double outer_radius, const double angle1, const double angle2, GdkColor &colour)
void draw_line (const Vector2D &start, const Vector2D &direction, const double length, const double thickness, GdkColor &colour)
void draw_line (const Vector2D &start, const Vector2D &direction, const double length, GdkColor &colour)
void draw_rectangle (const Vector2D &start, const Vector2D &end, GdkColor &colour, const bool filled)
GtkWidgetget_drawing_area ()
GtkWidgetget_scrolled_window ()
GtkWidgetget_window_p ()
bool is_window_shown ()
void set_window_shown (bool win_shown)
int get_zoom ()
void set_zoom (int z)
double get_drawing_area_scale ()

Static Public Member Functions

gboolean hide_window (GtkWidget *widget, GdkEvent *event, class ArenaWindow *arenawindow_p)
void show_window (GtkWidget *widget, class ArenaWindow *arenawindow_p)
void no_zoom (GtkWidget *widget, class ArenaWindow *arenawindow_p)
void zoom_in (GtkWidget *widget, class ArenaWindow *arenawindow_p)
void zoom_out (GtkWidget *widget, class ArenaWindow *arenawindow_p)
gint redraw (GtkWidget *widget, GdkEventExpose *event, class ArenaWindow *arenawindow_p)
gint keyboard_handler (GtkWidget *widget, GdkEventKey *event, class ArenaWindow *arenawindow_p)

Private Attributes

GtkWidgetwindow_p
GtkWidgetscrolled_window
GtkWidgetdrawing_area
Vector2D scrolled_window_size
int zoom
double drawing_area_scale
bool window_shown

Constructor & Destructor Documentation

ArenaWindow::ArenaWindow const int  default_width = -1,
const int  default_height = -1,
const int  default_x_pos = -1,
const int  default_y_pos = -1
 

Definition at line 41 of file ArenaWindow.cc.

References _, controlwindow_p, drawing_area, Gui::get_bg_gdk_colour_p(), gpointer, GtkWidget, hide_window(), ControlWindow::is_arenawindow_checked(), keyboard_handler(), no_zoom(), redraw(), scrolled_window, set_window_title(), the_gui, window_p, window_shown, zoom, zoom_in(), and zoom_out().

00045 {
00046   // The window widget
00047   window_p = gtk_window_new( GTK_WINDOW_TOPLEVEL );
00048   gtk_widget_set_name( window_p, "RTB Arena" );
00049 
00050   set_window_title();
00051 
00052   gtk_container_border_width( GTK_CONTAINER( window_p ), 12 );
00053 
00054   if( default_width != -1 && default_height != -1 )
00055     {
00056       gtk_window_set_default_size( GTK_WINDOW( window_p ),
00057                                    default_width, default_height );
00058       gtk_widget_set_usize( window_p , 185, 120 );
00059     }
00060   if( default_x_pos != -1 && default_y_pos != -1 )
00061     gtk_widget_set_uposition( window_p, default_x_pos, default_y_pos );
00062 
00063   gtk_signal_connect( GTK_OBJECT( window_p ), "delete_event",
00064                       (GtkSignalFunc) ArenaWindow::hide_window,
00065                       (gpointer) this );
00066 
00067   // Main box
00068 
00069   GtkWidget* vbox = gtk_vbox_new( FALSE, 10 );
00070   gtk_container_add( GTK_CONTAINER( window_p ), vbox );
00071   gtk_widget_show( vbox );
00072   
00073   // Zoom buttons
00074 
00075   struct button_t { String label; GtkSignalFunc func; };
00076 
00077   struct button_t buttons[] = {
00078     { (String)_(" No Zoom ") + (String)"[0] ",
00079       (GtkSignalFunc) ArenaWindow::no_zoom  },
00080     { (String)_(" Zoom In ") + (String)"[+] ",
00081       (GtkSignalFunc) ArenaWindow::zoom_in  },
00082     { (String)_(" Zoom Out ") + (String)"[-] ",
00083       (GtkSignalFunc) ArenaWindow::zoom_out } };
00084 
00085   GtkWidget* button_table = gtk_table_new( 1, 3, TRUE );
00086   gtk_box_pack_start( GTK_BOX( vbox ), button_table, FALSE, FALSE, 0 );
00087 
00088   for( int i=0; i < 3; i++ )
00089     {
00090       GtkWidget* button =
00091         gtk_button_new_with_label( buttons[i].label.chars() );
00092       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
00093                           buttons[i].func, (gpointer) this );
00094       gtk_table_attach_defaults( GTK_TABLE( button_table ),
00095                                  button, i, i+1, 0, 1 );
00096       gtk_widget_show( button );
00097     }
00098 
00099   gtk_table_set_col_spacings( GTK_TABLE( button_table ), 5 );
00100   gtk_widget_show( button_table );
00101 
00102   // Scrolled Window
00103 
00104   scrolled_window = gtk_scrolled_window_new( NULL, NULL );
00105   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_window ),
00106                                   GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS );
00107   gtk_container_add( GTK_CONTAINER( vbox ), scrolled_window );
00108   gtk_widget_show( scrolled_window );
00109 
00110   // Drawing Area
00111 
00112   drawing_area = gtk_drawing_area_new();
00113   gtk_drawing_area_size( GTK_DRAWING_AREA( drawing_area ),
00114                          default_width - 48, default_height - 80 );
00115   gtk_signal_connect( GTK_OBJECT( drawing_area ), "expose_event",
00116                       (GtkSignalFunc) ArenaWindow::redraw, (gpointer) this );
00117 
00118   gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK );
00119 
00120   gtk_scrolled_window_add_with_viewport
00121     ( GTK_SCROLLED_WINDOW( scrolled_window ), drawing_area );
00122   gtk_widget_show( drawing_area );
00123 
00124   window_shown = controlwindow_p->is_arenawindow_checked();
00125 
00126   zoom = 1;
00127 
00128   gtk_signal_connect( GTK_OBJECT( window_p ), "key_press_event",
00129                       (GtkSignalFunc) ArenaWindow::keyboard_handler, this );
00130 
00131   gtk_widget_show_now( window_p );
00132 
00133   gdk_window_set_background( drawing_area->window,
00134                              the_gui.get_bg_gdk_colour_p() );
00135   gdk_window_clear( drawing_area->window );
00136 
00137   if( !window_shown )
00138     gtk_widget_hide( window_p );
00139   
00140 }

Here is the call graph for this function:

ArenaWindow::~ArenaWindow  ) 
 

Definition at line 142 of file ArenaWindow.cc.

References window_p.

00143 {
00144   gtk_widget_destroy( window_p );
00145 }


Member Function Documentation

int ArenaWindow::boundary2pixel_x const double  x  )  [inline]
 

Definition at line 128 of file ArenaWindow.h.

References drawing_area_scale, and the_arena.

Referenced by draw_arc(), draw_circle(), draw_line(), and draw_rectangle().

00129 {
00130   return (int)( ( x - the_arena.get_boundary()[0][0] ) * 
00131                 drawing_area_scale + 0.5 );
00132 }

int ArenaWindow::boundary2pixel_y const double  y  )  [inline]
 

Definition at line 135 of file ArenaWindow.h.

References drawing_area_scale, and the_arena.

Referenced by draw_arc(), draw_circle(), draw_line(), and draw_rectangle().

00136 {
00137   return (int)( ( the_arena.get_boundary()[1][1] - y ) * 
00138                 drawing_area_scale + 0.5 );
00139 }

void ArenaWindow::clear_area  ) 
 

Definition at line 192 of file ArenaWindow.cc.

References drawing_area, Gui::get_bg_gdk_colour_p(), and the_gui.

Referenced by draw_everything(), and ArenaRealTime::start_game().

00193 {
00194   if( window_shown )
00195     {
00196       GdkGC * colour_gc;
00197 
00198       colour_gc = gdk_gc_new( drawing_area->window );
00199       gdk_gc_set_foreground( colour_gc, the_gui.get_bg_gdk_colour_p() );
00200 
00201       gdk_draw_rectangle( drawing_area->window,
00202                           colour_gc,
00203                           true,
00204                           0, 0, drawing_area->allocation.width,
00205                           drawing_area->allocation.height );
00206 
00207       gdk_gc_destroy( colour_gc );
00208     }
00209 }

Here is the call graph for this function:

void ArenaWindow::draw_arc const Vector2D center,
const double  inner_radius,
const double  outer_radius,
const double  angle1,
const double  angle2,
GdkColor colour
 

Definition at line 315 of file ArenaWindow.cc.

References boundary2pixel_x(), boundary2pixel_y(), drawing_area, drawing_area_scale, and gint.

Referenced by Arc::draw_shape().

00319 {
00320   if( window_shown )
00321     {  
00322       const double rad2GDK = ((double)GDK_360_DEGREES) / ( 2.0 * M_PI );
00323       
00324       gint a1 = (gint)( ( angle1 < 0.0 ? angle1 + 2 * M_PI : angle1 ) 
00325                         * rad2GDK + 0.5 );
00326       
00327       double angle_diff = angle2 - angle1;
00328       gint a2 = (gint)( ( angle_diff < 0.0 ? angle_diff + 2 * M_PI : angle_diff ) 
00329                         * rad2GDK + 0.5 );
00330     
00331     
00332       GdkGC * colour_gc;
00333 
00334       colour_gc = gdk_gc_new( drawing_area->window );
00335       gdk_gc_set_foreground( colour_gc, &colour );
00336 
00337       int line_width = (int)((outer_radius - inner_radius) * drawing_area_scale + 0.5);
00338       gdk_gc_set_line_attributes (colour_gc,
00339                                   line_width,
00340                                   GDK_LINE_SOLID,
00341                                   GDK_CAP_NOT_LAST,
00342                                   GDK_JOIN_MITER);
00343 
00344       double r = 0.5 * ( outer_radius + inner_radius );
00345       int box_size = (int)( r*2.0*drawing_area_scale + 0.5 );
00346       if( box_size >= 2.0 )
00347         {
00348           gdk_draw_arc( drawing_area->window,
00349                         colour_gc,
00350                         false,
00351                         boundary2pixel_x( center[0] - r ),
00352                         boundary2pixel_y( center[1] + r ),
00353                         box_size, box_size,
00354                         a1, a2 );
00355         }
00356       else
00357         {
00358           gdk_draw_point( drawing_area->window,
00359                           colour_gc,
00360                           boundary2pixel_x( center[0] ), 
00361                           boundary2pixel_y( center[1] ) );
00362         }
00363       gdk_gc_destroy( colour_gc );
00364     }
00365 }

Here is the call graph for this function:

void ArenaWindow::draw_circle const Vector2D center,
const double  radius,
GdkColor colour,
const bool  filled
 

Definition at line 282 of file ArenaWindow.cc.

References boundary2pixel_x(), boundary2pixel_y(), drawing_area, and GDK_360_DEGREES.

Referenced by Circle::draw_shape().

00284 {
00285   if( window_shown )
00286     {
00287       GdkGC * colour_gc;
00288 
00289       colour_gc = gdk_gc_new( drawing_area->window );
00290       gdk_gc_set_foreground( colour_gc, &colour );
00291 
00292       double r;
00293       if( ( r = radius * drawing_area_scale ) > 1.0 )
00294         {
00295           gdk_draw_arc( drawing_area->window,
00296                         colour_gc,
00297                         filled,
00298                         boundary2pixel_x( center[0]-radius ),
00299                         boundary2pixel_y( center[1]+radius ),
00300                         (int)(r*2.0 + 0.5), (int)(r*2.0 + 0.5),
00301                         0, GDK_360_DEGREES );
00302         }
00303       else
00304         {
00305           gdk_draw_point( drawing_area->window,
00306                           colour_gc,
00307                           boundary2pixel_x( center[0] ), 
00308                           boundary2pixel_y( center[1] ) );
00309         }
00310       gdk_gc_destroy( colour_gc );
00311     }
00312 }

Here is the call graph for this function:

void ArenaWindow::draw_everything  ) 
 

Definition at line 212 of file ArenaWindow.cc.

References clear_area(), draw_moving_objects(), drawing_area_scale_changed(), List< T >::first(), MINE, ListIterator< T >::ok(), scrolled_window, scrolled_window_size, and the_arena.

Referenced by drawing_area_scale_changed(), and ArenaReplay::timeout_function().

00213 {
00214   if( window_shown )
00215     {
00216       clear_area();
00217 
00218       if( ( scrolled_window->allocation.width - 24 != scrolled_window_size[0]) ||
00219           ( scrolled_window->allocation.height - 24 !=  scrolled_window_size[1]) )
00220         {
00221           drawing_area_scale_changed();
00222           return;
00223         }
00224       
00225       List<Shape>* object_lists;
00226 
00227       object_lists = the_arena.get_object_lists();
00228       ListIterator<Shape> li;
00229 
00230       // Must begin with innercircles (they are destructive)
00231       for( int obj_type=WALL; obj_type < LAST_OBJECT_TYPE ; obj_type++) 
00232         {
00233           for( object_lists[obj_type].first(li); li.ok(); li++ )
00234             {
00235               if( !( ( obj_type == MINE || obj_type == COOKIE ) &&
00236                      !( (Extras*)li() )->is_alive() ) )
00237                 {
00238                   li()->draw_shape( false );
00239                 }
00240             }
00241         }
00242 
00243       draw_moving_objects( false );
00244     }
00245 }

Here is the call graph for this function:

void ArenaWindow::draw_line const Vector2D start,
const Vector2D direction,
const double  length,
GdkColor colour
 

Definition at line 427 of file ArenaWindow.cc.

References boundary2pixel_x(), boundary2pixel_y(), drawing_area, and length().

00429 {
00430   if( window_shown )
00431     {
00432       GdkGC * colour_gc;  
00433       colour_gc = gdk_gc_new( drawing_area->window );
00434       gdk_gc_set_foreground( colour_gc, &colour );
00435 
00436       Vector2D end_point = start + length * direction;
00437 
00438       gdk_draw_line( drawing_area->window, colour_gc,
00439                      boundary2pixel_x( start[0] ), 
00440                      boundary2pixel_y( start[1] ), 
00441                      boundary2pixel_x( end_point[0] ), 
00442                      boundary2pixel_y( end_point[1] ) );
00443 
00444       gdk_gc_destroy( colour_gc );
00445     }
00446 }

Here is the call graph for this function:

void ArenaWindow::draw_line const Vector2D start,
const Vector2D direction,
const double  length,
const double  thickness,
GdkColor colour
 

Definition at line 394 of file ArenaWindow.cc.

References boundary2pixel_x(), boundary2pixel_y(), drawing_area, rotate90(), and unit().

Referenced by Line::draw_shape().

00397 {
00398   if( window_shown )
00399     {
00400       GdkGC * colour_gc;
00401       GdkPoint g_points[4];
00402       Vector2D vector_points[4];
00403 
00404       colour_gc = gdk_gc_new( drawing_area->window );
00405       gdk_gc_set_foreground( colour_gc, &colour );
00406 
00407       Vector2D line_thick = unit( direction );
00408       line_thick = rotate90( line_thick );
00409       line_thick *= thickness;
00410       vector_points[0] = start + line_thick;
00411       vector_points[1] = start - line_thick;
00412       vector_points[2] = start - line_thick + direction * length;
00413       vector_points[3] = start + line_thick + direction * length;
00414 
00415       for(int i=0;i<4;i++)
00416         {
00417           g_points[i].x = boundary2pixel_x( vector_points[i][0] );
00418           g_points[i].y = boundary2pixel_y( vector_points[i][1] );
00419         }
00420       gdk_draw_polygon( drawing_area->window, colour_gc, true, g_points, 4 );
00421 
00422       gdk_gc_destroy( colour_gc );
00423     }
00424 }

Here is the call graph for this function:

void ArenaWindow::draw_moving_objects const bool  clear_objects_first  ) 
 

Definition at line 248 of file ArenaWindow.cc.

References Robot::draw_radar_and_cannon(), Circle::draw_shape(), drawing_area_scale_changed(), List< T >::first(), Robot::is_alive(), ListIterator< T >::ok(), scrolled_window, scrolled_window_size, and the_arena.

Referenced by draw_everything(), ArenaReplay::parse_this_time_index(), ArenaReplay::step_forward(), and ArenaRealTime::update().

00249 {
00250   if( window_shown )
00251     {
00252       List<Shape>* object_lists = the_arena.get_object_lists();
00253       Robot* robotp;
00254 
00255       if( ( scrolled_window->allocation.width - 24 != scrolled_window_size[0]) ||
00256           ( scrolled_window->allocation.height - 24 !=  scrolled_window_size[1]) )
00257         {
00258           drawing_area_scale_changed();
00259           return;
00260         }
00261 
00262       ListIterator<Shape> li;
00263       for( object_lists[SHOT].first(li); li.ok(); li++ )
00264         if( ((Shot*)li())->is_alive() )
00265           ((Shot*)li())->draw_shape( clear_objects_first );
00266 
00267       ListIterator<Shape> li2;
00268       for( object_lists[ROBOT].first(li2); li2.ok(); li2++ )
00269         {
00270           robotp = (Robot*)li2();
00271 
00272           if( robotp->is_alive() )
00273             {
00274               robotp->draw_shape( clear_objects_first );
00275               robotp->draw_radar_and_cannon();
00276             }
00277         }
00278     }
00279 }

Here is the call graph for this function:

void ArenaWindow::draw_rectangle const Vector2D start,
const Vector2D end,
GdkColor colour,
const bool  filled
 

Definition at line 369 of file ArenaWindow.cc.

References boundary2pixel_x(), boundary2pixel_y(), and drawing_area.

00373 {
00374   if( window_shown )
00375     {
00376       GdkGC * colour_gc;
00377 
00378       colour_gc = gdk_gc_new( drawing_area->window );
00379       gdk_gc_set_foreground( colour_gc, &colour );
00380 
00381       gdk_draw_rectangle( drawing_area->window,
00382                           colour_gc,
00383                           filled,
00384                           boundary2pixel_x( start[0] ),
00385                           boundary2pixel_y( end[1] ),
00386                           boundary2pixel_x( end[0] - start[0] ),
00387                           boundary2pixel_y( end[1] - start[1] ) );
00388 
00389       gdk_gc_destroy( colour_gc );
00390     }
00391 }

Here is the call graph for this function:

void ArenaWindow::drawing_area_scale_changed const bool  change_da_value = false  ) 
 

Definition at line 449 of file ArenaWindow.cc.

References draw_everything(), drawing_area, drawing_area_scale, GtkAdjustment, scrolled_window, scrolled_window_size, and the_arena.

Referenced by draw_everything(), draw_moving_objects(), ArenaRealTime::start_game(), and ArenaReplay::timeout_function().

00450 {
00451   if( window_shown )
00452     {
00453       int width = scrolled_window->allocation.width - 24;
00454       int height = scrolled_window->allocation.height - 24;
00455       scrolled_window_size = Vector2D( (double)width,
00456                                        (double)height );
00457       double w = (double)( width * zoom );
00458       double h = (double)( height * zoom );
00459       double bw = the_arena.get_boundary()[1][0] -
00460         the_arena.get_boundary()[0][0];
00461       double bh = the_arena.get_boundary()[1][1] -
00462         the_arena.get_boundary()[0][1];
00463       if( w / bw >= h / bh )
00464         {
00465           drawing_area_scale = h / bh;
00466           w = drawing_area_scale * bw;
00467         }
00468       else
00469         {
00470           drawing_area_scale = w / bw;
00471           h = drawing_area_scale * bh;
00472         }
00473 
00474       gtk_widget_set_usize( drawing_area, (int)w, (int)h );
00475       if( change_da_value )
00476         {
00477           GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment
00478             ( (GtkScrolledWindow*) scrolled_window );
00479           gtk_adjustment_set_value( hadj,
00480                                     ( ( hadj->value + hadj->page_size / 2 ) /
00481                                       ( hadj->upper - hadj->lower ) ) *
00482                                     (int)w - hadj->page_size / 2 );
00483           GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment
00484             ( (GtkScrolledWindow*) scrolled_window );
00485           gtk_adjustment_set_value( vadj,
00486                                     ( ( vadj->value + vadj->page_size / 2 ) /
00487                                       ( vadj->upper - vadj->lower ) ) *
00488                                     (int)h - vadj->page_size / 2 );
00489         }
00490       else
00491         draw_everything();
00492     }
00493 }

Here is the call graph for this function:

GtkWidget* ArenaWindow::get_drawing_area  )  [inline]
 

Definition at line 103 of file ArenaWindow.h.

References GtkWidget.

00103 { return drawing_area; }

double ArenaWindow::get_drawing_area_scale  )  [inline]
 

Definition at line 110 of file ArenaWindow.h.

Referenced by Robot::draw_radar_and_cannon().

00110 { return drawing_area_scale; }

GtkWidget* ArenaWindow::get_scrolled_window  )  [inline]
 

Definition at line 104 of file ArenaWindow.h.

References GtkWidget.

00104 { return scrolled_window; }

GtkWidget* ArenaWindow::get_window_p  )  [inline]
 

Definition at line 105 of file ArenaWindow.h.

References GtkWidget.

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

00105 { return window_p; }

int ArenaWindow::get_zoom  )  [inline]
 

Definition at line 108 of file ArenaWindow.h.

00108 { return zoom; }

gboolean ArenaWindow::hide_window GtkWidget widget,
GdkEvent event,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 163 of file ArenaWindow.cc.

References controlwindow_p, ControlWindow::get_show_arena_menu_item(), GtkWidget, and ControlWindow::is_arenawindow_checked().

Referenced by ArenaWindow().

00165 {
00166   if( arenawindow_p->is_window_shown() )
00167     {
00168       gtk_widget_hide( arenawindow_p->get_window_p() );
00169       arenawindow_p->set_window_shown( false );
00170       if( controlwindow_p->is_arenawindow_checked() )
00171         {
00172           GtkWidget* menu_item = controlwindow_p->get_show_arena_menu_item();
00173           gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( menu_item ), FALSE );
00174         }
00175     }
00176         return true;
00177 }

Here is the call graph for this function:

bool ArenaWindow::is_window_shown  )  [inline]
 

Definition at line 106 of file ArenaWindow.h.

00106 { return window_shown; }

gint ArenaWindow::keyboard_handler GtkWidget widget,
GdkEventKey event,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 525 of file ArenaWindow.cc.

References no_zoom(), zoom_in(), and zoom_out().

Referenced by ArenaWindow().

00527 {
00528   switch (event->keyval)
00529     {
00530     case GDK_plus:
00531     case GDK_KP_Add:
00532       zoom_in( NULL, arenawindow_p );
00533       break;
00534 
00535     case GDK_minus:
00536     case GDK_KP_Subtract:
00537       zoom_out( NULL, arenawindow_p );
00538       break;
00539 
00540     case GDK_0:
00541     case GDK_KP_0:
00542     case GDK_KP_Insert:
00543       no_zoom( NULL, arenawindow_p );
00544       break;
00545 
00546     default:
00547       return FALSE;
00548     }
00549       
00550   gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
00551   return FALSE;
00552 }

Here is the call graph for this function:

void ArenaWindow::no_zoom GtkWidget widget,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 497 of file ArenaWindow.cc.

Referenced by ArenaWindow(), and keyboard_handler().

00498 {
00499   arenawindow_p->set_zoom( 1 );
00500   arenawindow_p->drawing_area_scale_changed();
00501 }

gint ArenaWindow::redraw GtkWidget widget,
GdkEventExpose event,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 555 of file ArenaWindow.cc.

References ArenaController::is_started(), and the_arena_controller.

Referenced by ArenaWindow().

00557 {
00558   if( the_arena_controller.is_started() )
00559     arenawindow_p->draw_everything();
00560   return FALSE;
00561 }

Here is the call graph for this function:

void ArenaWindow::set_window_shown bool  win_shown  ) 
 

Definition at line 156 of file ArenaWindow.cc.

References window_shown.

00157 {
00158   window_shown = win_shown;
00159 }

void ArenaWindow::set_window_title  ) 
 

Definition at line 148 of file ArenaWindow.cc.

References _, String::chars(), the_arena, and window_p.

Referenced by ArenaWindow(), and ArenaRealTime::start_game().

00149 {
00150   String title = (String)_("Arena") + "   " +
00151     the_arena.get_current_arena_filename();
00152   gtk_window_set_title( GTK_WINDOW( window_p ), title.chars() );
00153 }

Here is the call graph for this function:

void ArenaWindow::set_zoom int  z  )  [inline]
 

Definition at line 109 of file ArenaWindow.h.

00109 { zoom = z; }

void ArenaWindow::show_window GtkWidget widget,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 180 of file ArenaWindow.cc.

00182 {
00183   if( !arenawindow_p->is_window_shown() )
00184     {
00185       gtk_widget_show( arenawindow_p->get_window_p() );
00186       arenawindow_p->set_window_shown( true );
00187       arenawindow_p->draw_everything();
00188     }
00189 }

void ArenaWindow::zoom_in GtkWidget widget,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 505 of file ArenaWindow.cc.

Referenced by ArenaWindow(), and keyboard_handler().

00506 {
00507   int z = arenawindow_p->get_zoom();
00508   z++;
00509   arenawindow_p->set_zoom( z );
00510   arenawindow_p->drawing_area_scale_changed( true );
00511 }

void ArenaWindow::zoom_out GtkWidget widget,
class ArenaWindow arenawindow_p
[static]
 

Definition at line 515 of file ArenaWindow.cc.

Referenced by ArenaWindow(), and keyboard_handler().

00516 {
00517   int z = arenawindow_p->get_zoom();
00518   if( z > 1 )
00519     z--;
00520   arenawindow_p->set_zoom( z );
00521   arenawindow_p->drawing_area_scale_changed( true );
00522 }


Field Documentation

GtkWidget* ArenaWindow::drawing_area [private]
 

Definition at line 116 of file ArenaWindow.h.

Referenced by ArenaWindow(), clear_area(), draw_arc(), draw_circle(), draw_line(), draw_rectangle(), and drawing_area_scale_changed().

double ArenaWindow::drawing_area_scale [private]
 

Definition at line 120 of file ArenaWindow.h.

Referenced by boundary2pixel_x(), boundary2pixel_y(), draw_arc(), and drawing_area_scale_changed().

GtkWidget* ArenaWindow::scrolled_window [private]
 

Definition at line 115 of file ArenaWindow.h.

Referenced by ArenaWindow(), draw_everything(), draw_moving_objects(), and drawing_area_scale_changed().

Vector2D ArenaWindow::scrolled_window_size [private]
 

Definition at line 118 of file ArenaWindow.h.

Referenced by draw_everything(), draw_moving_objects(), and drawing_area_scale_changed().

GtkWidget* ArenaWindow::window_p [private]
 

Definition at line 114 of file ArenaWindow.h.

Referenced by ArenaWindow(), set_window_title(), and ~ArenaWindow().

bool ArenaWindow::window_shown [private]
 

Definition at line 122 of file ArenaWindow.h.

Referenced by ArenaWindow(), and set_window_shown().

int ArenaWindow::zoom [private]
 

Definition at line 119 of file ArenaWindow.h.

Referenced by ArenaWindow().


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