Inheritance diagram for ColorTool:
Public Methods | |
ColorTool () | |
void | add_feature (string name, string value) |
Tool overrides add_feature in order to be able to set its bitmap_name variable from the "image" key. | |
void | start () |
When the tool is first clicked, it sets the color of all currently-selected objects by using Drawing's Selection class, and the provided iteration functions. | |
int | mouseClick (const Position &pos) |
When the tool is clicked, it figures out which object was clicked and sets the color of that object. | |
void | stop () |
called when another tool is selected | |
Private Attributes | |
color | the_color |
The color that this tool sets. | |
Static Private Attributes | |
ColorTool::Factory | factory |
A single instance of ColorTool is only able to set a single predetermined color. Normally, multiple instances of ColorTool would be created, one for each color that should appear in the tool window. The color for each instance is set with the "color" feature in add_feature.
|
00019 : Tool("unknown-color.bmp") {} |
|
Tool overrides add_feature in order to be able to set its bitmap_name variable from the "image" key.
Reimplemented from Tool.
00021 { 00022 if (name == "color") { 00023 if (!Utilities::from_string(value,the_color)) { 00024 throw unknown_feature("unknown color name"); 00025 } 00026 add_feature("image",value + "-button.bmp"); 00027 } else { 00028 Tool::add_feature(name,value); 00029 } 00030 } |
|
When the tool is clicked, it figures out which object was clicked and sets the color of that object.
Implements Tool.
00048 { 00049 DrawElement* de = drawing->get_contents()->find_hit(pos); 00050 if (de) { 00051 de->set_color(the_color); 00052 return 1; 00053 } else { 00054 return 0; 00055 } 00056 } |
|
When the tool is first clicked, it sets the color of all currently-selected objects by using Drawing's Selection class, and the provided iteration functions.
Implements Tool.
00036 { 00037 for (Drawing::Selection i = drawing->begin_selection(); 00038 i != drawing->end_selection(); 00039 ++i) { 00040 (*i)->set_color(the_color); 00041 } 00042 drawing->set_current_color(the_color); 00043 } |
|
called when another tool is selected
Implements Tool.
00058 {} |
|
|
|
The color that this tool sets.
|