IntelliTool.h
Go to the documentation of this file.
#ifndef Intelli_Tool_H
#define Intelli_Tool_H
#include "IntelliHelper/IntelliColorPicker.h"
#include "IntelliHelper/IntelliToolsettings.h"
#include <vector>
//for unit testing
class UnitTest;
struct LayerObject;
class PaintingArea;
class IntelliTool {
friend UnitTest;
public:
enum class Tooltype {
CIRCLE,
FLOODFILL,
GRADIENT,
LINE,
PEN,
PLAIN,
POLYGON,
RECTANGLE,
NONE
};
private:
bool createToolLayer();
void mergeToolLayer();
void deleteToolLayer();
protected:
PaintingArea* Area;
Tooltype ActiveType;
IntelliColorPicker* colorPicker;
IntelliToolsettings* Toolsettings;
LayerObject* activeLayer;
LayerObject* Canvas;
bool isDrawing = false;
public:
IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
virtual ~IntelliTool() = 0;
virtual void onMouseRightPressed(int x, int y);
virtual void onMouseRightReleased(int x, int y);
virtual void onMouseLeftPressed(int x, int y);
virtual void onMouseLeftReleased(int x, int y);
virtual void onWheelScrolled(int value);
virtual void onMouseMoved(int x, int y);
Tooltype getTooltype() const;
bool getIsDrawing() const;
};
#endif
IntelliTool::Tooltype::PEN
@ PEN
IntelliTool::onMouseRightPressed
virtual void onMouseRightPressed(int x, int y)
A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on....
Definition: IntelliTool.cpp:19
IntelliTool::onMouseLeftReleased
virtual void onMouseLeftReleased(int x, int y)
A function managing the left click Released of a Mouse. Call this in child classes!
Definition: IntelliTool.cpp:37
IntelliTool::colorPicker
IntelliColorPicker * colorPicker
A pointer to the IntelliColorPicker of the PaintingArea to interact with, and get the colors.
Definition: IntelliTool.h:64
IntelliTool::onMouseLeftPressed
virtual void onMouseLeftPressed(int x, int y)
A function managing the left click Pressed of a Mouse. Resetting the current draw....
Definition: IntelliTool.cpp:30
IntelliTool::getIsDrawing
bool getIsDrawing() const
getIsDrawing returns if the tool is currently drawing
Definition: IntelliTool.cpp:105
IntelliTool::Toolsettings
IntelliToolsettings * Toolsettings
Toolsettings a refrence to the tool settings.
Definition: IntelliTool.h:69
IntelliTool::getTooltype
Tooltype getTooltype() const
getTooltype returns the tools type
Definition: IntelliTool.cpp:101
IntelliTool::Tooltype::FLOODFILL
@ FLOODFILL
IntelliToolsettings.h
IntelliTool::Tooltype::NONE
@ NONE
IntelliTool::Area
PaintingArea * Area
A pointer to the general PaintingArea to interact with.
Definition: IntelliTool.h:54
IntelliTool::Tooltype
Tooltype
The Tooltype enum categorising the toosl.
Definition: IntelliTool.h:23
PaintingArea
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:57
IntelliTool::isDrawing
bool isDrawing
A flag checking if the user is currently drawing or not.
Definition: IntelliTool.h:84
LayerObject
The LayerObject struct holds all the information needed to construct a layer.
Definition: PaintingArea.h:23
IntelliTool::onMouseRightReleased
virtual void onMouseRightReleased(int x, int y)
A function managing the right click Released of a Mouse. Merging the Canvas to Active....
Definition: IntelliTool.cpp:26
IntelliTool::activeLayer
LayerObject * activeLayer
A pointer to the underlying active Layer, do not work on this. This is used for data grabbing or prev...
Definition: IntelliTool.h:74
IntelliTool::Tooltype::PLAIN
@ PLAIN
IntelliColorPicker.h
IntelliTool::Tooltype::POLYGON
@ POLYGON
IntelliTool::Canvas
LayerObject * Canvas
A pointer to the drawing canvas of the tool, work on this.
Definition: IntelliTool.h:79
IntelliTool
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:17
IntelliTool::ActiveType
Tooltype ActiveType
ActiveType the type of the active tool.
Definition: IntelliTool.h:59
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:14
IntelliTool::IntelliTool
IntelliTool(PaintingArea *Area, IntelliColorPicker *colorPicker, IntelliToolsettings *Toolsettings)
A constructor setting the general Painting Area and colorPicker.
Definition: IntelliTool.cpp:5
IntelliTool::Tooltype::RECTANGLE
@ RECTANGLE
UnitTest
Definition: mainUnitTest.cpp:8
IntelliTool::Tooltype::LINE
@ LINE
IntelliTool::Tooltype::GRADIENT
@ GRADIENT
IntelliTool::onMouseMoved
virtual void onMouseMoved(int x, int y)
A function managing the mouse moved event. Call this in child classes!
Definition: IntelliTool.cpp:48
IntelliTool::onWheelScrolled
virtual void onWheelScrolled(int value)
A function managing the scroll event. A positive value means scrolling outwards. Call this in child c...
Definition: IntelliTool.cpp:53
IntelliToolsettings
The IntelliToolsettings class managing the settings of the tools, independent of an existing tool.
Definition: IntelliToolsettings.h:9
IntelliTool::~IntelliTool
virtual ~IntelliTool()=0
An abstract Destructor.
Definition: IntelliTool.cpp:15
IntelliTool::Tooltype::CIRCLE
@ CIRCLE