SimulationView Class Reference

Presentation layer for the simulation. More...

#include <simulationView.hpp>

Collaboration diagram for SimulationView:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SimulationView (wxWindow *parent, wxWindowID id)
 Constructor.
virtual ~SimulationView ()
 Destructor.
void setGrid (Grid newGrid, bool changed)
 Sets the grid to display.
void setInfo (wxString info)
 Appends a text line to the information box.
void setBlankLine ()
 Appends a blank line in the information box.
void setFinished (bool finished)
 Member accessor.
void setSimulation (Simulation *simulation)
 Sets the simulation.
void setNextRow (bool enable)
 Enables/disables the next row button.
void setResults (bool enable)
 Enables/disables the results button.
void enableSimulation (bool enabled)
 Enabled/disables the simulation controls.
void stopSimulation ()
 Stops the simulation.

Private Member Functions

void initControls ()
 Control initialization.
void initSizers ()
 Sizer (layout) initialization.
void OnPlayPause (wxCommandEvent &event)
 Play/Pause button click event.
void OnStep (wxCommandEvent &event)
 Step button click event.
void OnNext (wxCommandEvent &event)
 Next row button click event.
void OnResults (wxCommandEvent &event)
 Results button click event.
void OnTimer (wxTimerEvent &event)
 Timer tick event.
void OnSlider (wxCommandEvent &event)
 Timer slider change event.
void OnForward (wxCommandEvent &event)
 Forward button change event.

Private Attributes

wxBitmap * bitmapPlay
wxBitmap * bitmapPause
wxBitmap * bitmapStep
wxBitmap * bitmapForward
wxBitmapButton * buttonPlayPause
wxBitmapButton * buttonStep
wxBitmapButton * buttonForward
wxButton * buttonNextRow
wxButton * buttonResults
wxStaticText * labelTimer
LayoutCanvascanvas
wxTextCtrl * textInfo
wxSlider * slider
int timerInterval
 Timer interval in ms.
Simulationsimulation
 Simulation.
wxTimer chrono
 Timer.
bool playing
 Is the simulation playing?
bool finished
 Is the simulation finished?

Detailed Description

Presentation layer for the simulation.

This is the view for the simulation. It shows the space being simulated and information about the simulation. It allows the user to play, pause and execute individual steps on the simulation, and also to control the timer of the automated simulation.

Author:
Bernat Rāfales Mulet <the_bell@users.sourceforge.net>
Version:
Revision
1.7

Definition at line 41 of file simulationView.hpp.


Constructor & Destructor Documentation

SimulationView::SimulationView wxWindow *  parent,
wxWindowID  id
 

Constructor.

Parameters:
parent the parent window.
id the window identifier.

Definition at line 60 of file simulationView.cpp.

SimulationView::~SimulationView  )  [virtual]
 

Destructor.

Definition at line 76 of file simulationView.cpp.


Member Function Documentation

void SimulationView::enableSimulation bool  enabled  ) 
 

Enabled/disables the simulation controls.

Parameters:
enabled if true, the controls are enabled, otherwise are disabled.

Definition at line 337 of file simulationView.cpp.

References bitmapPlay, buttonForward, buttonPlayPause, buttonStep, chrono, and playing.

Referenced by Simulation::nextRow(), Simulation::simulateAll(), and Simulation::updateView().

void SimulationView::initControls  )  [private]
 

Control initialization.

Definition at line 82 of file simulationView.cpp.

References bitmapForward, bitmapPause, bitmapPlay, bitmapStep, buttonForward, buttonNextRow, buttonPlayPause, buttonResults, buttonStep, canvas, ID_BUTTON_FORWARD, ID_BUTTON_NEXT, ID_BUTTON_PLAYPAUSE, ID_BUTTON_RESULTS, ID_BUTTON_STEP, ID_SLIDER, labelTimer, slider, and textInfo.

void SimulationView::initSizers  )  [private]
 

Sizer (layout) initialization.

Definition at line 106 of file simulationView.cpp.

References buttonForward, buttonNextRow, buttonPlayPause, buttonResults, buttonStep, canvas, labelTimer, slider, and textInfo.

void SimulationView::OnForward wxCommandEvent &  event  )  [private]
 

Forward button change event.

Parameters:
event the event.

Definition at line 381 of file simulationView.cpp.

References Simulation::simulateAll(), and simulation.

Here is the call graph for this function:

void SimulationView::OnNext wxCommandEvent &  event  )  [private]
 

Next row button click event.

Parameters:
event the event.

Definition at line 317 of file simulationView.cpp.

References Simulation::nextRow(), and simulation.

Here is the call graph for this function:

void SimulationView::OnPlayPause wxCommandEvent &  event  )  [private]
 

Play/Pause button click event.

Parameters:
event the event.

Definition at line 191 of file simulationView.cpp.

References bitmapPause, bitmapPlay, buttonPlayPause, chrono, playing, and timerInterval.

void SimulationView::OnResults wxCommandEvent &  event  )  [private]
 

Results button click event.

Parameters:
event the event.

Definition at line 327 of file simulationView.cpp.

References Simulation::results(), and simulation.

Here is the call graph for this function:

void SimulationView::OnSlider wxCommandEvent &  event  )  [private]
 

Timer slider change event.

Parameters:
event the event.

Definition at line 364 of file simulationView.cpp.

References chrono, labelTimer, playing, slider, and timerInterval.

void SimulationView::OnStep wxCommandEvent &  event  )  [private]
 

Step button click event.

Parameters:
event the event.

Definition at line 213 of file simulationView.cpp.

References Simulation::nextStep(), playing, and simulation.

Here is the call graph for this function:

void SimulationView::OnTimer wxTimerEvent &  event  )  [private]
 

Timer tick event.

In here the simulation step is taken if the automated simulation is on.

Parameters:
event the event.

Definition at line 266 of file simulationView.cpp.

References Simulation::nextStep(), playing, and simulation.

Here is the call graph for this function:

void SimulationView::setBlankLine  ) 
 

Appends a blank line in the information box.

Definition at line 245 of file simulationView.cpp.

References textInfo.

void SimulationView::setFinished bool  finished  ) 
 

Member accessor.

Parameters:
finished the finished simulation status.

Definition at line 255 of file simulationView.cpp.

void SimulationView::setGrid Grid  newGrid,
bool  changed
 

Sets the grid to display.

Parameters:
newGrid the grid to be displayed.
changed if true, the cell transitions are disabled.

Definition at line 227 of file simulationView.cpp.

References canvas, and LayoutCanvas::setGrid().

Referenced by Simulation::nextStep(), Simulation::resetSimulation(), and Simulation::Simulation().

Here is the call graph for this function:

void SimulationView::setInfo wxString  info  ) 
 

Appends a text line to the information box.

Parameters:
info the message to display.

Definition at line 238 of file simulationView.cpp.

References textInfo.

Referenced by Simulation::nextStep(), setNextRow(), and setResults().

void SimulationView::setNextRow bool  enable  ) 
 

Enables/disables the next row button.

Parameters:
enable if true, the button is enabled, otherwise is disabled.

Definition at line 289 of file simulationView.cpp.

References buttonNextRow, and setInfo().

Referenced by Simulation::nextRow(), Simulation::simulateAll(), and Simulation::updateView().

Here is the call graph for this function:

void SimulationView::setResults bool  enable  ) 
 

Enables/disables the results button.

Parameters:
enable if true, the button is enabled, otherwise is disabled.

Definition at line 303 of file simulationView.cpp.

References buttonResults, and setInfo().

Referenced by Simulation::nextRow(), Simulation::simulateAll(), and Simulation::updateView().

Here is the call graph for this function:

void SimulationView::setSimulation Simulation simulation  ) 
 

Sets the simulation.

Parameters:
simulation the simulation.

Definition at line 279 of file simulationView.cpp.

References simulation.

void SimulationView::stopSimulation  ) 
 

Stops the simulation.

Definition at line 354 of file simulationView.cpp.

References playing.

Referenced by Simulation::resetSimulation().


Member Data Documentation

wxBitmap* SimulationView::bitmapForward [private]
 

Definition at line 70 of file simulationView.hpp.

Referenced by initControls().

wxBitmap* SimulationView::bitmapPause [private]
 

Definition at line 68 of file simulationView.hpp.

Referenced by initControls(), and OnPlayPause().

wxBitmap* SimulationView::bitmapPlay [private]
 

Definition at line 67 of file simulationView.hpp.

Referenced by enableSimulation(), initControls(), and OnPlayPause().

wxBitmap* SimulationView::bitmapStep [private]
 

Definition at line 69 of file simulationView.hpp.

Referenced by initControls().

wxBitmapButton* SimulationView::buttonForward [private]
 

Definition at line 73 of file simulationView.hpp.

Referenced by enableSimulation(), initControls(), and initSizers().

wxButton* SimulationView::buttonNextRow [private]
 

Definition at line 74 of file simulationView.hpp.

Referenced by initControls(), initSizers(), and setNextRow().

wxBitmapButton* SimulationView::buttonPlayPause [private]
 

Definition at line 71 of file simulationView.hpp.

Referenced by enableSimulation(), initControls(), initSizers(), and OnPlayPause().

wxButton* SimulationView::buttonResults [private]
 

Definition at line 75 of file simulationView.hpp.

Referenced by initControls(), initSizers(), and setResults().

wxBitmapButton* SimulationView::buttonStep [private]
 

Definition at line 72 of file simulationView.hpp.

Referenced by enableSimulation(), initControls(), and initSizers().

LayoutCanvas* SimulationView::canvas [private]
 

Definition at line 77 of file simulationView.hpp.

Referenced by initControls(), initSizers(), and setGrid().

wxTimer SimulationView::chrono [private]
 

Timer.

Definition at line 85 of file simulationView.hpp.

Referenced by enableSimulation(), OnPlayPause(), and OnSlider().

bool SimulationView::finished [private]
 

Is the simulation finished?

Definition at line 89 of file simulationView.hpp.

wxStaticText* SimulationView::labelTimer [private]
 

Definition at line 76 of file simulationView.hpp.

Referenced by initControls(), initSizers(), and OnSlider().

bool SimulationView::playing [private]
 

Is the simulation playing?

Definition at line 87 of file simulationView.hpp.

Referenced by enableSimulation(), OnPlayPause(), OnSlider(), OnStep(), OnTimer(), and stopSimulation().

Simulation* SimulationView::simulation [private]
 

Simulation.

Definition at line 83 of file simulationView.hpp.

Referenced by OnForward(), OnNext(), OnResults(), OnStep(), OnTimer(), and setSimulation().

wxSlider* SimulationView::slider [private]
 

Definition at line 79 of file simulationView.hpp.

Referenced by initControls(), initSizers(), and OnSlider().

wxTextCtrl* SimulationView::textInfo [private]
 

Definition at line 78 of file simulationView.hpp.

Referenced by initControls(), initSizers(), setBlankLine(), and setInfo().

int SimulationView::timerInterval [private]
 

Timer interval in ms.

Definition at line 81 of file simulationView.hpp.

Referenced by OnPlayPause(), and OnSlider().


The documentation for this class was generated from the following files:
Generated on Sat Sep 2 00:00:59 2006 for NanoComp by  doxygen 1.4.6