#include <Canvas.h>
Public Types | |
MOUSE_NOACTION | |
MOUSE_INSERTING | |
MOUSE_ERASING | |
enum | MouseStatus { MOUSE_NOACTION, MOUSE_INSERTING, MOUSE_ERASING } |
What is the user doing? More... | |
Public Member Functions | |
Canvas (wxWindow *parent, Matrix *m, const ConfigCanvas &config, const wxSize &winSize=wxDefaultSize, bool interact=true, bool isSimulationSaved=false) | |
Constructor. | |
~Canvas () | |
Destructor. | |
void | Redraw () |
Redraws the scene. | |
int | GetCellSize () const |
Returns current cell size. | |
void | SetCellSize (int cs) |
Sets new cell size. | |
void | Recenter (wxInt32 i, wxInt32 j) |
Recenter scene. | |
void | SetCurrentObjectConfig (Object::Config *coc) |
Sets current object config. | |
void | SetMouseStatus (MouseStatus ms) |
Sets mouse status (cursor). | |
ConfigCanvas * | GetConfigCanvas () const |
Returns ConfigCanvas (containing canvas configuration). | |
void | LoadFromConfig (const ConfigCanvas &config, bool fullLoad=true) |
Loads simulation state (attributes etc.) from the selected config. | |
long | GetInterval () const |
Returns current interval (mean time between two simulation steps). | |
void | SetInterval (long newInterval) |
Sets new interval (mean time between two simulation steps). | |
bool | IsSimulationSaved () const |
Returns current simulation state (whether it was saved or not). | |
void | SetSimulationSavedStatus (bool newStatus) |
Sets new simulation state (whether it was saved or not). | |
string | GetSimulationName () const |
Returns the name of the current simulation. | |
void | SetSavedSimulationFileName (string newSimulationSavedFileName) |
Sets new simulation saved file name. | |
string | GetSavedSimulationFileName () const |
Returns name of the saved simulation file. | |
void | SetInteractive (bool si) |
Sets if it is possible to work with the scene. | |
void | SetNotHoldingObject () |
Sets holding object flag to false (no object is currently in holding). | |
virtual bool | ProcessEvent (wxEvent &event) |
Processes an event, searching event tables and calling zero or more suitable event handler function(s). | |
Private Member Functions | |
void | OnPaint (wxPaintEvent &event) |
void | OnMouseMotion (wxMouseEvent &event) |
void | OnMouseLeftDown (wxMouseEvent &event) |
void | OnMouseRightDown (wxMouseEvent &event) |
void | OnMouseMiddleDown (wxMouseEvent &event) |
void | OnSize (wxSizeEvent &event) |
void | OnScroll (wxScrollWinEvent &event) |
wxInt32 | XToCell (wxCoord x) const |
Conversion between cell and screen coordinates. | |
wxInt32 | YToCell (wxCoord y) const |
Conversion between cell and screen coordinates. | |
wxCoord | CellToX (wxInt32 i) const |
Conversion between cell and screen coordinates. | |
wxCoord | CellToY (wxInt32 j) const |
Conversion between cell and screen coordinates. | |
Private Attributes | |
Matrix * | matrix |
Pointer to matrix = source of our information. | |
int | cellsize |
Current cell size, in pixels. | |
bool | interactive |
Is canvas interactive? | |
long | interval |
Whats the time interval between alarm. | |
MouseStatus | status |
What is the user doing. | |
wxInt32 | viewportX |
First visible cell (x coord). | |
wxInt32 | viewportY |
First visible cell (y coord). | |
wxInt32 | viewportW |
Number of visible cells (w). | |
wxInt32 | viewportH |
Number of visible cells (h). | |
int | thumbX |
Horizontal scrollbar thumb position. | |
int | thumbY |
Vertical scrollbar thumb position. | |
wxInt32 | mi |
Last mouse position. | |
wxInt32 | mj |
Object::Config * | CurrentObjectConfig |
Current config. | |
MouseStatus | mouseStatus |
Mouse status. | |
bool | simulationWasSaved |
Was the simulation saved? | |
string | simulationName |
Name of the simulation. | |
string | savedSimulationFileName |
Name of the saved simulation file (empty if the simulation was not saved or loaded). | |
Classes | |
class | HoldingObject |
Keeps info about current holding object (when moving objects on the scene). More... |
Object of this class will hold all information needed to draw the whole matrix on the screen (current size etc.). It also allows user to work with Matrix (add/delete objects in the Matrix).
GUI::Canvas::Canvas | ( | wxWindow * | parent, | |
Matrix * | m, | |||
const ConfigCanvas & | config, | |||
const wxSize & | winSize = wxDefaultSize , |
|||
bool | interact = true , |
|||
bool | isSimulationSaved = false | |||
) |
Constructor.
parent | Parent of this window | |
m | Our essential source of information - matrix | |
config | Configuration of the Canvas | |
winSize | Size of the window | |
interact | Mode in which we start this object | |
isSimulationSaved | Is simulation saved when creating the scene? |
GUI::Canvas::~Canvas | ( | ) |
Destructor.
wxCoord GUI::Canvas::CellToX | ( | wxInt32 | i | ) | const [inline, private] |
Conversion between cell and screen coordinates.
wxCoord GUI::Canvas::CellToY | ( | wxInt32 | j | ) | const [inline, private] |
Conversion between cell and screen coordinates.
int GUI::Canvas::GetCellSize | ( | ) | const [inline] |
Returns current cell size.
ConfigCanvas * GUI::Canvas::GetConfigCanvas | ( | ) | const |
Returns ConfigCanvas (containing canvas configuration).
Warning: Returned config is allocated on the heap and you have to delete it explicitly after you don't need it.
long GUI::Canvas::GetInterval | ( | ) | const [inline] |
Returns current interval (mean time between two simulation steps).
string GUI::Canvas::GetSavedSimulationFileName | ( | ) | const [inline] |
Returns name of the saved simulation file.
Returns empty string if the simulation has not been saved yet.
string GUI::Canvas::GetSimulationName | ( | ) | const [inline] |
Returns the name of the current simulation.
bool GUI::Canvas::IsSimulationSaved | ( | ) | const [inline] |
Returns current simulation state (whether it was saved or not).
void GUI::Canvas::LoadFromConfig | ( | const ConfigCanvas & | config, | |
bool | fullLoad = true | |||
) |
Loads simulation state (attributes etc.) from the selected config.
config | Canvas config | |
fullLoad | Should canvas load all data from the config, or only some? |
void GUI::Canvas::OnMouseLeftDown | ( | wxMouseEvent & | event | ) | [private] |
void GUI::Canvas::OnMouseMiddleDown | ( | wxMouseEvent & | event | ) | [private] |
void GUI::Canvas::OnMouseMotion | ( | wxMouseEvent & | event | ) | [private] |
void GUI::Canvas::OnMouseRightDown | ( | wxMouseEvent & | event | ) | [private] |
void GUI::Canvas::OnPaint | ( | wxPaintEvent & | event | ) | [private] |
void GUI::Canvas::OnScroll | ( | wxScrollWinEvent & | event | ) | [private] |
void GUI::Canvas::OnSize | ( | wxSizeEvent & | event | ) | [private] |
bool GUI::Canvas::ProcessEvent | ( | wxEvent & | event | ) | [virtual] |
Processes an event, searching event tables and calling zero or more suitable event handler function(s).
event | Event to process |
void GUI::Canvas::Recenter | ( | wxInt32 | i, | |
wxInt32 | j | |||
) |
Recenter scene.
i | Width of the scene (width of the matrix) | |
j | Height of the scene (height of the matrix) |
void GUI::Canvas::Redraw | ( | ) |
Redraws the scene.
void GUI::Canvas::SetCellSize | ( | int | cs | ) |
Sets new cell size.
cs | Cell size that has to be put |
void GUI::Canvas::SetCurrentObjectConfig | ( | Object::Config * | coc | ) | [inline] |
Sets current object config.
coc | Current object config |
void GUI::Canvas::SetInteractive | ( | bool | si | ) | [inline] |
Sets if it is possible to work with the scene.
si | Set interactive (true/false) |
void GUI::Canvas::SetInterval | ( | long | newInterval | ) | [inline] |
Sets new interval (mean time between two simulation steps).
newInterval | New interval value |
void GUI::Canvas::SetMouseStatus | ( | MouseStatus | ms | ) |
Sets mouse status (cursor).
ms | Mouse status that has to be set |
void GUI::Canvas::SetNotHoldingObject | ( | ) | [inline] |
Sets holding object flag to false (no object is currently in holding).
There may be various reasons, for example user clicks on the menu or on the toolbar etc.
void GUI::Canvas::SetSavedSimulationFileName | ( | string | newSimulationSavedFileName | ) | [inline] |
Sets new simulation saved file name.
newSimulationSavedFileName | New simulation file name to be set |
void GUI::Canvas::SetSimulationSavedStatus | ( | bool | newStatus | ) | [inline] |
Sets new simulation state (whether it was saved or not).
newStatus | New status that should be set |
wxInt32 GUI::Canvas::XToCell | ( | wxCoord | x | ) | const [inline, private] |
Conversion between cell and screen coordinates.
wxInt32 GUI::Canvas::YToCell | ( | wxCoord | y | ) | const [inline, private] |
Conversion between cell and screen coordinates.
int GUI::Canvas::cellsize [private] |
Current cell size, in pixels.
Object::Config* GUI::Canvas::CurrentObjectConfig [private] |
Current config.
bool GUI::Canvas::interactive [private] |
Is canvas interactive?
long GUI::Canvas::interval [private] |
Whats the time interval between alarm.
Matrix* GUI::Canvas::matrix [private] |
Pointer to matrix = source of our information.
wxInt32 GUI::Canvas::mi [private] |
Last mouse position.
wxInt32 GUI::Canvas::mj [private] |
MouseStatus GUI::Canvas::mouseStatus [private] |
Mouse status.
string GUI::Canvas::savedSimulationFileName [private] |
Name of the saved simulation file (empty if the simulation was not saved or loaded).
string GUI::Canvas::simulationName [private] |
Name of the simulation.
bool GUI::Canvas::simulationWasSaved [private] |
Was the simulation saved?
MouseStatus GUI::Canvas::status [private] |
What is the user doing.
int GUI::Canvas::thumbX [private] |
Horizontal scrollbar thumb position.
int GUI::Canvas::thumbY [private] |
Vertical scrollbar thumb position.
wxInt32 GUI::Canvas::viewportH [private] |
Number of visible cells (h).
wxInt32 GUI::Canvas::viewportW [private] |
Number of visible cells (w).
wxInt32 GUI::Canvas::viewportX [private] |
First visible cell (x coord).
wxInt32 GUI::Canvas::viewportY [private] |
First visible cell (y coord).