Inheritance diagram for MutateTool:
Public Methods | |
MutateTool () | |
void | start () |
When this tool is clicked, it clears the drawing's selection, and indicates that it has no selection by setting hasSelection to false and selected to 0. | |
int | mouseClick (const Position &pos) |
When the user clicks in the canvas, the action taken depends on whether there is a selection. | |
void | stop () |
The selection is cleared when the tool is deselected. | |
Private Attributes | |
bool | hasSelection |
Set to true if this tool currently has a selection. | |
DrawElement * | selected |
If the tool has a selection, this stores the selected object. | |
Static Private Attributes | |
MutateTool::Factory | factory |
The precise meaning of "mutate" depends on the type of object.
|
00010 : Tool("mutate-button.bmp"), hasSelection(false), selected(0) {} |
|
When the user clicks in the canvas, the action taken depends on whether there is a selection. If there is, the selected object is mutated with the mutate member function, then the selection is cleared. Otherwise, the selection is set to the object at the location of the click. Implements Tool.
00029 { 00030 if (hasSelection) { 00031 int ret = selected->mutate(pos); 00032 drawing->clear_selection(); 00033 hasSelection = false; 00034 return ret; 00035 } else if (DrawElement* e = drawing->get_contents()->find_hit(pos)) { 00036 selected = e; 00037 drawing->add_selection(e); 00038 hasSelection = true; 00039 return 1; 00040 } 00041 return 0; 00042 } |
|
When this tool is clicked, it clears the drawing's selection, and indicates that it has no selection by setting hasSelection to false and selected to 0.
Implements Tool.
00016 { 00017 drawing->clear_selection(); 00018 hasSelection = false; 00019 selected = 0; 00020 } |
|
The selection is cleared when the tool is deselected.
Implements Tool.
00045 { 00046 selected = 0; 00047 } |
|
|
|
Set to true if this tool currently has a selection.
|
|
If the tool has a selection, this stores the selected object.
|