Inheritance diagram for CircleTool:
Public Methods | |
CircleTool () | |
void | start () |
midDraw is set to false, indicating that we're not in the middle of creating a circle. | |
int | mouseClick (const Position &pos) |
If we're in the middle of creating a circle, then firstPosition is used with pos to create a new circle in the drawing. | |
void | stop () |
called when another tool is selected | |
Private Attributes | |
bool | midDraw |
Indicates if the user is in the middle of creating a circle. | |
Position | first |
Holds the position of the user's first click while we wait for the second. | |
Static Private Attributes | |
CircleTool::Factory | factory |
|
|
|
If we're in the middle of creating a circle, then firstPosition is used with pos to create a new circle in the drawing. Otherwise, we store the position of the click and set midDraw to true to wait for the next click. Implements Tool.
00024 { 00025 if (midDraw) { 00026 float size = abs(pos-first); 00027 DrawElement* de = new Circle(first,drawing->current_color(),size); 00028 drawing->get_contents()->add_element(de); 00029 drawing->clear_selection(); 00030 drawing->add_selection(de); 00031 midDraw = false; 00032 } else { 00033 first = pos; 00034 midDraw = true; 00035 } 00036 return 1; 00037 } |
|
midDraw is set to false, indicating that we're not in the middle of creating a circle.
Implements Tool.
00014 { 00015 midDraw = false; 00016 } |
|
called when another tool is selected
Implements Tool.
00039 {} |
|
|
|
Holds the position of the user's first click while we wait for the second.
|
|
Indicates if the user is in the middle of creating a circle.
|