Inheritance diagram for CutTool:
Public Methods | |
CutTool () | |
void | start () |
When the tool is first selected, it removes all currently-selected objects from the canvas by using Drawing's Selection class and the provided iteration functions. | |
int | mouseClick (const Position &pos) |
When the mouse is clicked, it figures out which object was clicked and removes it from the canvas. | |
void | stop () |
called when another tool is selected | |
Static Public Attributes | |
CutTool::Factory | factory |
|
00009 : Tool("cut-button.bmp") {} |
|
When the mouse is clicked, it figures out which object was clicked and removes it from the canvas.
Implements Tool.
00035 { 00036 if (DrawElement* e = drawing->get_contents()->find_hit(pos)) { 00037 drawing->get_contents()->remove_element(e); 00038 delete e; 00039 return 1; 00040 } 00041 return 0; 00042 } |
|
When the tool is first selected, it removes all currently-selected objects from the canvas by using Drawing's Selection class and the provided iteration functions. A list of all selected objects is built, and then they are all removed at once; otherwise the iterator would become invalid. Implements Tool.
00017 { 00018 Drawing::Selection begin = drawing->begin_selection(), 00019 end = drawing->end_selection(); 00020 vector<DrawElement*> elems; 00021 for (Drawing::Selection i = begin; i != end; ++i) { 00022 elems.push_back(*i); 00023 } 00024 for (vector<DrawElement*>::iterator i = elems.begin(); 00025 i != elems.end(); ++i) { 00026 drawing->remove_selection(*i); 00027 drawing->get_contents()->remove_element(*i); 00028 delete (*i); 00029 } 00030 } |
|
called when another tool is selected
Implements Tool.
00044 {} |
|
|