#include <toolcont.h>
Public Methods | |
void | OnMouseEvent (wxMouseEvent &event) |
called on mouse events | |
void | OnChar (wxKeyEvent &event) |
called on key events | |
void | OnKeyDown (wxKeyEvent &event) |
called on keydown events | |
void | OnKeyUp (wxKeyEvent &event) |
called on keyup events | |
ToolSet | GetActiveType () |
what is the type of the active tool | |
BaseTool * | GetActiveTool () |
what tool is active at the moment | |
bool | PopTool () |
get the tool that was put on the stack | |
bool | PushTool () |
push active tool on the stack | |
bool | StartTool (ToolSet a_tool, bool onlyonce) |
bool | EndTool (bool now=false) |
sets a flag to stop the actove tool | |
bool | StopTool () |
end a tool and restore a tool from the stack. | |
bool | StopTool (bool settoolinfo) |
end a tool and restore a tool from the stack. | |
void | CalculateCurrent () |
calculate the mouse position | |
int | NumberOfTools () |
how much tools are on the stack | |
bool | Undo () |
undo for active tool | |
bool | Begin () |
called for every action inside a tool | |
bool | End () |
called for every action inside a tool | |
Protected Attributes | |
bool | _toolactive |
active tools or not | |
DL_List< void * > * | _tool_stack |
stack containing all tools that were started | |
BaseTool * | _tool |
the active tool | |
long | _currentX |
mouse x in windows coordinates | |
long | _currentY |
mouse y in windows coordinates | |
double | _realcurrentX |
mouse x in world coordinates | |
double | _realcurrentY |
mouse y in world coordinates |
All mouse and key events on the canvas/client window are redirected to this class. Depending on the tool that is active, those events are redirected to the right tool. A stack of tools is maintained in order to allow drawing and zooming at the same time. Shortcuts to start tools/certain commands are also handled here. Undo while a tool is in action (busy drawing), is handled by the tool itself. The toolcontroller will receive the undo command, and redirects it to the active tool. The default tool will always be the ZOOMIN_TOOL. If the stack becomes empty, this tool will be started again.
|
start a new tool If only once is true, only one action will be performed after that the tool will be ended, and the last pushed tool will be restored. |