Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

MutateTool Class Reference

A Tool subclass that allows the user to "mutate" an object. More...

Inheritance diagram for MutateTool:

Tool Object List of all members.

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.

DrawElementselected
 If the tool has a selection, this stores the selected object.


Static Private Attributes

MutateTool::Factory factory

Detailed Description

A Tool subclass that allows the user to "mutate" an object.

The precise meaning of "mutate" depends on the type of object.


Constructor & Destructor Documentation

MutateTool::MutateTool   [inline]
 

00010 : Tool("mutate-button.bmp"), hasSelection(false), selected(0) {}


Member Function Documentation

int MutateTool::mouseClick const Position &    pos [inline, virtual]
 

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   }

void MutateTool::start   [inline, virtual]
 

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   }

void MutateTool::stop   [inline, virtual]
 

The selection is cleared when the tool is deselected.

Implements Tool.

00045               {
00046     selected = 0;
00047   }


Member Data Documentation

MutateTool::Factory MutateTool::factory [static, private]
 

bool MutateTool::hasSelection [private]
 

Set to true if this tool currently has a selection.

DrawElement* MutateTool::selected [private]
 

If the tool has a selection, this stores the selected object.


The documentation for this class was generated from the following file:
Generated on Fri Nov 8 10:52:30 2002 for Draw by doxygen1.2.17