#include <AgentsFrame.h>
Public Member Functions | |
| AgentsFrame (ConfigApplication &config) | |
| Default constructor. | |
| ~AgentsFrame () | |
| Destructor. | |
| void | StopSimulation () |
| Stops simulation (only if it's running). | |
Private Member Functions | |
| void | UpdateUI () |
| Enable or disable tools and menu entries according to the current state. | |
| void | CreateScene (ConfigProcessor &configProcessor) |
| Creates new scene (Canvas and Matrix) from config. | |
| void | CreateScene (Matrix::SizeType width, Matrix::SizeType height, const string &simulationName) |
| Creates new scene (Canvas and Matrix) according to the new simulation dialog data. | |
| void | RefreshSceneWindow () |
| Refreshes scene window after new simulation creation. | |
| void | SetSliderPositionAccToInterval (long interval) |
| Sets slider position according to the simulation (canvas) interval. | |
| void | SetStartingWindowSize (ConfigApplication &config) |
| Sets starting window size. | |
| void | CloseScene () |
| Closes screen (Canvas and Matrix). | |
| void | CreateMenu (ConfigApplication &config) |
| Creates application menu. | |
| void | CreateToolbar (bool show=true) |
| Creates application toolbar. | |
| void | CreateStatusbar (bool show=true) |
| Creates statusbar. | |
| void | CreatePalette (bool show=true) |
| Creates palette. | |
| void | CreateTimer () |
| Creates timer. | |
| void | CreateEmptyPanels () |
| Cretes empty panels. | |
| void | CreateInfoPanels (ConfigApplication &config) |
| Creates info panels (scrollbars, sliders, sizers, ...). | |
| void | SetSimulationNameToTitle (const string &simulationName) |
| Sets new application title containing simulation name. | |
| string | SimulationName2FileName (const string &simulationName) const |
| Returns transformed simulation name so it can be used as filename. | |
| virtual bool | ProcessEvent (wxEvent &event) |
| Processes an event, searching event tables and calling zero or more suitable event handler function(s). | |
| bool | IsToolbarShown () const |
| Returns true if the toolbar is shown. | |
| bool | IsStatusbarShown () const |
| Returns true if the statusbar is shown. | |
| bool | IsPaletteShown () const |
| Returns true if the object pallete window is shown. | |
| bool | IsSpeedSliderShown () const |
| Returns true if the toolbar is shown. | |
| ConfigApplication * | GetConfigApplication () const |
| Returns ConfigApplication (containing application configuration). | |
| void | LoadFromConfig (const ConfigApplication &config) |
| Loads application state (attributes etc.) from the selected config. | |
| bool | CheckSimulationToBeSaved () |
| Checks whether the current simulation should be saved and accordingly shows a 'save simulation' message. | |
| void | SetNotHoldingObject () |
| Sets scene holding object flag to false. | |
| void | ResizeSimulationWindow () |
| Resizes scene window according to the application window size. | |
| void | OnWindowClose (wxCloseEvent &event) |
| void | OnSize (wxSizeEvent &event) |
| void | OnExit (wxCommandEvent &event) |
| void | OnNewSimulation (wxCommandEvent &event) |
| void | OnOpenSimulation (wxCommandEvent &event) |
| void | OnCloseSimulation (wxCommandEvent &event) |
| void | OnSaveSimulation (wxCommandEvent &event) |
| void | OnZoomIn (wxCommandEvent &event) |
| void | OnZoomOut (wxCommandEvent &event) |
| void | OnObjectsPallete (wxCommandEvent &event) |
| void | OnMainToolbar (wxCommandEvent &event) |
| void | OnSpeedSlider (wxCommandEvent &event) |
| void | OnStatusBar (wxCommandEvent &event) |
| void | OnStartSimulation (wxCommandEvent &event) |
| void | OnStopSimulation (wxCommandEvent &event) |
| void | OnMakeStep (wxCommandEvent &event) |
| void | OnSimulationSettings (wxCommandEvent &event) |
| void | OnApplicationSettings (wxCommandEvent &event) |
| void | OnHelpContents (wxCommandEvent &event) |
| void | OnAbout (wxCommandEvent &event) |
| void | OnRecenter (wxCommandEvent &event) |
| void | OnTimer (wxTimerEvent &event) |
| void | OnSlider (wxScrollEvent &event) |
| void | OnRubber (wxCommandEvent &event) |
| void | OnMover (wxCommandEvent &event) |
Private Attributes | |
| wxPanel * | panel1 |
| 1st panel | |
| wxPanel * | panel2 |
| 2nd panel (speed slider) | |
| wxBoxSizer * | sizer1 |
| Canvas sizer. | |
| wxBoxSizer * | sizer2 |
| Speed slider sizer. | |
| wxBoxSizer * | sizer3 |
| Whole application frame sizer. | |
| Matrix * | matrix |
| Pointer to matrix object. | |
| Canvas * | canvas |
| Pointer to canvas object. | |
| wxStaticText * | sliderText |
| Slider text information. | |
| wxTimer * | timer |
| Game timer. | |
| wxSlider * | slider |
| Speed slider. | |
| bool | running |
| Are we running? | |
| string | paletteDirectoryPath |
| Palette configs directory. | |
| PaletteWindow * | paletteWindow |
| Palette window. | |
| string | helpFilePath |
| Help file path. | |
Static Private Attributes | |
| static const int | MINZOOM = 4 |
| Minimum zoom. | |
| static const int | MAXZOOM = 128 |
| Maximum zoom. | |
| static const int | TIMERCONST = 1000 |
| Timer divisive constant. | |
| static const int | SLIDER_DEFAULT = 5 |
| Default slider value. | |
| static const int | SLIDER_MIN = 1 |
| Minimal slider value. | |
| static const int | SLIDER_MAX = 10 |
| Maximal slider value. | |
| static const int | SIM_WIDTH_INC = -2 |
| Simulation window width increment. | |
| static const int | SIM_HEIGHT_INC = -145 |
| Simulation window height increment. | |
| static const int | SIM_TOOLBAR_HEIGHT_INC = 38 |
| Simulation window width increment (if toolbar is not shown). | |
| static const int | SIM_SPEEDSLIDER_HEIGHT_INC = 48 |
| Simulation window width increment (if speed slider is not shown). | |
| static const int | SIM_STATUSBAR_HEIGHT_INC = 25 |
| Simulation window width increment (if statusbar is not shown). | |
This is the main application frame which creates GUI for whole application
| GUI::AgentsFrame::AgentsFrame | ( | ConfigApplication & | config | ) |
Default constructor.
| config | Config that will initialize the application |
| GUI::AgentsFrame::~AgentsFrame | ( | ) |
Destructor.
| bool GUI::AgentsFrame::CheckSimulationToBeSaved | ( | ) | [private] |
Checks whether the current simulation should be saved and accordingly shows a 'save simulation' message.
| void GUI::AgentsFrame::CreateEmptyPanels | ( | ) | [private] |
Cretes empty panels.
This method must be called as first in the constructor.
| void GUI::AgentsFrame::CreateInfoPanels | ( | ConfigApplication & | config | ) | [private] |
Creates info panels (scrollbars, sliders, sizers, ...).
| config | Application config |
| void GUI::AgentsFrame::CreateMenu | ( | ConfigApplication & | config | ) | [private] |
Creates application menu.
| config | Application config |
| void GUI::AgentsFrame::CreatePalette | ( | bool | show = true |
) | [private] |
Creates palette.
| show | Should the palette be shown? |
| void GUI::AgentsFrame::CreateScene | ( | Matrix::SizeType | width, | |
| Matrix::SizeType | height, | |||
| const string & | simulationName | |||
| ) | [private] |
| void GUI::AgentsFrame::CreateScene | ( | ConfigProcessor & | configProcessor | ) | [private] |
| void GUI::AgentsFrame::CreateStatusbar | ( | bool | show = true |
) | [private] |
Creates statusbar.
| show | Should the statusbar be shown? |
| void GUI::AgentsFrame::CreateTimer | ( | ) | [private] |
Creates timer.
| void GUI::AgentsFrame::CreateToolbar | ( | bool | show = true |
) | [private] |
Creates application toolbar.
| show | Should the toolbar be shown? |
| ConfigApplication * GUI::AgentsFrame::GetConfigApplication | ( | ) | const [private] |
Returns ConfigApplication (containing application configuration).
Warning: Returned config is allocated on the heap and you have to delete it explicitly after you don't need it.
| bool GUI::AgentsFrame::IsPaletteShown | ( | ) | const [inline, private] |
Returns true if the object pallete window is shown.
| bool GUI::AgentsFrame::IsSpeedSliderShown | ( | ) | const [inline, private] |
Returns true if the toolbar is shown.
| bool GUI::AgentsFrame::IsStatusbarShown | ( | ) | const [inline, private] |
Returns true if the statusbar is shown.
| bool GUI::AgentsFrame::IsToolbarShown | ( | ) | const [inline, private] |
Returns true if the toolbar is shown.
| void GUI::AgentsFrame::LoadFromConfig | ( | const ConfigApplication & | config | ) | [private] |
Loads application state (attributes etc.) from the selected config.
| config | Application config |
| void GUI::AgentsFrame::OnAbout | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnApplicationSettings | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnCloseSimulation | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnExit | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnHelpContents | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnMainToolbar | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnMakeStep | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnMover | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnNewSimulation | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnObjectsPallete | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnOpenSimulation | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnRecenter | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnRubber | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnSaveSimulation | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnSimulationSettings | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnSize | ( | wxSizeEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnSlider | ( | wxScrollEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnSpeedSlider | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnStartSimulation | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnStatusBar | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnStopSimulation | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnTimer | ( | wxTimerEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnWindowClose | ( | wxCloseEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnZoomIn | ( | wxCommandEvent & | event | ) | [private] |
| void GUI::AgentsFrame::OnZoomOut | ( | wxCommandEvent & | event | ) | [private] |
| bool GUI::AgentsFrame::ProcessEvent | ( | wxEvent & | event | ) | [private, virtual] |
Processes an event, searching event tables and calling zero or more suitable event handler function(s).
| event | Event to process |
| void GUI::AgentsFrame::RefreshSceneWindow | ( | ) | [private] |
Refreshes scene window after new simulation creation.
This method must be called after each creation of a new simulation. It's called in CreateScene() functions.
| void GUI::AgentsFrame::ResizeSimulationWindow | ( | ) | [private] |
Resizes scene window according to the application window size.
| void GUI::AgentsFrame::SetNotHoldingObject | ( | ) | [inline, private] |
Sets scene holding object flag to false.
There may be various reasons, for example user clicks on the menu or on the toolbar etc.
| void GUI::AgentsFrame::SetSimulationNameToTitle | ( | const string & | simulationName | ) | [private] |
Sets new application title containing simulation name.
| simulationName | Name of the simulation |
| void GUI::AgentsFrame::SetSliderPositionAccToInterval | ( | long | interval | ) | [private] |
Sets slider position according to the simulation (canvas) interval.
| interval | Interval from which will the position be computed |
| void GUI::AgentsFrame::SetStartingWindowSize | ( | ConfigApplication & | config | ) | [private] |
Sets starting window size.
| config | Config containing window size |
| string GUI::AgentsFrame::SimulationName2FileName | ( | const string & | simulationName | ) | const [private] |
Returns transformed simulation name so it can be used as filename.
| simulationName | Name of the simulation |
| void GUI::AgentsFrame::StopSimulation | ( | ) |
Stops simulation (only if it's running).
If there is no simulation or the simulation is not running, does nothing.
| void GUI::AgentsFrame::UpdateUI | ( | ) | [private] |
Enable or disable tools and menu entries according to the current state.
Canvas* GUI::AgentsFrame::canvas [private] |
Pointer to canvas object.
string GUI::AgentsFrame::helpFilePath [private] |
Help file path.
Matrix* GUI::AgentsFrame::matrix [private] |
Pointer to matrix object.
const int GUI::AgentsFrame::MAXZOOM = 128 [static, private] |
Maximum zoom.
const int GUI::AgentsFrame::MINZOOM = 4 [static, private] |
Minimum zoom.
string GUI::AgentsFrame::paletteDirectoryPath [private] |
Palette configs directory.
PaletteWindow* GUI::AgentsFrame::paletteWindow [private] |
Palette window.
wxPanel* GUI::AgentsFrame::panel1 [private] |
1st panel
wxPanel* GUI::AgentsFrame::panel2 [private] |
2nd panel (speed slider)
bool GUI::AgentsFrame::running [private] |
Are we running?
const int GUI::AgentsFrame::SIM_HEIGHT_INC = -145 [static, private] |
Simulation window height increment.
const int GUI::AgentsFrame::SIM_SPEEDSLIDER_HEIGHT_INC = 48 [static, private] |
Simulation window width increment (if speed slider is not shown).
const int GUI::AgentsFrame::SIM_STATUSBAR_HEIGHT_INC = 25 [static, private] |
Simulation window width increment (if statusbar is not shown).
const int GUI::AgentsFrame::SIM_TOOLBAR_HEIGHT_INC = 38 [static, private] |
Simulation window width increment (if toolbar is not shown).
const int GUI::AgentsFrame::SIM_WIDTH_INC = -2 [static, private] |
Simulation window width increment.
wxBoxSizer* GUI::AgentsFrame::sizer1 [private] |
Canvas sizer.
wxBoxSizer* GUI::AgentsFrame::sizer2 [private] |
Speed slider sizer.
wxBoxSizer* GUI::AgentsFrame::sizer3 [private] |
Whole application frame sizer.
wxSlider* GUI::AgentsFrame::slider [private] |
Speed slider.
const int GUI::AgentsFrame::SLIDER_DEFAULT = 5 [static, private] |
Default slider value.
const int GUI::AgentsFrame::SLIDER_MAX = 10 [static, private] |
Maximal slider value.
const int GUI::AgentsFrame::SLIDER_MIN = 1 [static, private] |
Minimal slider value.
wxStaticText* GUI::AgentsFrame::sliderText [private] |
Slider text information.
wxTimer* GUI::AgentsFrame::timer [private] |
Game timer.
const int GUI::AgentsFrame::TIMERCONST = 1000 [static, private] |
Timer divisive constant.
1.4.7