Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
Antares::Map::Tool::Tool Class Referenceabstract

Visual component to make an action on the selected items. More...

#include <tool.h>

Inheritance diagram for Antares::Map::Tool::Tool:
Antares::Map::Tool::ConnectionCreator Antares::Map::Tool::Remover

Public Member Functions

Constructor & Destructor
 Tool (Manager &manager, const char *icon)
 Constructor.
 
virtual ~Tool ()
 Destructor.
 
Manager
Managermanager ()
 
const Managermanager () const
 
X-Coordinate
int x () const
 Get the X-Coordinate of the tool.
 
void x (const int v)
 Set the X-Coordinate of the tool.
 
Y-Coordinate
int y () const
 Get the Y-Coordinate of the tool.
 
void y (const int v)
 Set the Y-Coordinate of the tool.
 
Sizes
uint width () const
 Get the width of the tool.
 
uint height () const
 Get the height of the tool.
 
Icon
const wxBitmap * icon () const
 Get the icon of the tool, NULL if not available.
 
void icon (const char *filename)
 Set the icon representing the tool.
 
Life span
LifeSpan lifeSpan () const
 Get the lifespan of the tool.
 

Drawing

ManagerpManager
 The parent manager.
 
int pX
 The X-Coordinate.
 
int pY
 The Y-Coordinate.
 
int pWidth
 Width.
 
int pHeight
 Height.
 
wxBitmap * pIcon
 Icon.
 
bool contains (const int x, const int y) const
 Get if a point is insided the bounding box of the tool.
 
virtual void draw (DrawingContext &dc, const bool mouseDown, const wxPoint &position, const wxPoint &absolute) const
 Draw the tool.
 
virtual bool actionIsImmediate () const
 Get if the action triggered by the tool is immediate.
 
virtual bool onMouseUp (const int mx, const int my)=0
 Event: The user has clicked on the tool.
 

Detailed Description

Visual component to make an action on the selected items.

Constructor & Destructor Documentation

◆ Tool()

Antares::Map::Tool::Tool::Tool ( Manager & manager,
const char * icon )

Constructor.

Parameters
managerThe parent manager
iconThe icon representing this tool (16x16)

Member Function Documentation

◆ actionIsImmediate()

virtual bool Antares::Map::Tool::Tool::actionIsImmediate ( ) const
inlinevirtual

Get if the action triggered by the tool is immediate.

When the value is true, the action should be executed as soon as the user clicks on the tool. When equals to false, the action should be delayed until the next click.

Returns
True if the action triggered by the tool is immediate

Reimplemented in Antares::Map::Tool::ConnectionCreator.

◆ contains()

bool Antares::Map::Tool::Tool::contains ( const int x,
const int y ) const
inline

Get if a point is insided the bounding box of the tool.

Parameters
xThe X-Coordinate of the point
yThe Y-Coordinate of the point
Returns
True if the point is inside the bounding box, false otherwise

◆ draw()

void Antares::Map::Tool::Tool::draw ( DrawingContext & dc,
const bool mouseDown,
const wxPoint & position,
const wxPoint & absolute ) const
virtual

Draw the tool.

Parameters
dcA drawing context
mouseDownTrue if the mouse is down
position
absolute

Reimplemented in Antares::Map::Tool::ConnectionCreator, and Antares::Map::Tool::Remover.

◆ icon()

void Antares::Map::Tool::Tool::icon ( const char * filename)

Set the icon representing the tool.

The given filename is a relative filename in the resources folder.

Parameters
filenameA relative filename

◆ onMouseUp()

virtual bool Antares::Map::Tool::Tool::onMouseUp ( const int mx,
const int my )
pure virtual

Event: The user has clicked on the tool.

Returns
True to invalidate all tools (ex: some nodes have been removed, moved...)

Implemented in Antares::Map::Tool::ConnectionCreator, and Antares::Map::Tool::Remover.


The documentation for this class was generated from the following files: