Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Protected Attributes
icl::qt::DragRectangleMouseHandler Class Reference

Special MouseHandler implementation that allows for dragging a Rectangle. More...

#include <DragRectangleMouseHandler.h>

Inheritance diagram for icl::qt::DragRectangleMouseHandler:
icl::qt::MouseHandler icl::utils::Lockable

List of all members.

Public Member Functions

 DragRectangleMouseHandler (int minDim=4)
 Default constructor with optionally given minimum dimension.
virtual void process (const MouseEvent &e)
 overwritten mouse-event handler function
void visualize (ICLDrawWidget &w)
 visualization method that can be used to visualized the MouseHandlers current state
bool hasRect () const
 returns wether a valid rectangle was defined
utils::Rect getRect () const
 returns the currrent rectangle
bool hasDraggedRect () const
 returns whether the user currently defines a rectangle (using a drag gesture)
utils::Rect getDragggedRect () const
 returns the currently dragged rectangle
void setMinDim (int minDim)
 sets the minimum rectangle size
int getMinDim () const
 returns the minimum rectangle size

Public Attributes

core::Color4D m_edge
 edge color for the defined rectangle
core::Color4D m_fill
 fill color for the defined rectangle
core::Color4D m_outer
 color that is used for everything outside the rectangle
core::Color4D m_edgeWhileDrag
 edge color for the dragged rectangle
core::Color4D m_fillWhileDrag
 fill color for the dragged rectangle
core::Color4D m_outerWhileDrag
 as m_outer, but for the dragged rectangle

Protected Attributes

utils::Point m_origin
 point where the drag gesture started
utils::Point m_curr
 current mouse-position while dragging
int m_minDim
 minimum rectangle size
utils::Rect m_rect
 last defined rectangle

Detailed Description

Special MouseHandler implementation that allows for dragging a Rectangle.

This mousehandler can be installed on an instance of ICLWidget. This widget then enables the user to use a mouse-based drag gesture to define a rectangle on top of the current image. The DragRectangleMouseHandler's visualize-method can be used to show the current result. The rectangle can be defined by holding the left mouse button. The right mouse button deletes the currently define rectangle. There are two Rectangles, that can be accessed from outside: the 'dragged-rect' is the rectangle, that is currently dragged. It can be accessed with hasDraggedRect and getDraggedRect. Once a rectangle is defined, it can be accessed with hasRect and hasDraggedRect.

Colors

For each of these two rectangles, three different colors can be set. The edge color of the rectangle, the fill color of the rectangle and the color that is used to fill everything else then the rectangle. Each of these colors can have an alpha component of zero; in this case, the component is not drawn. Since setting these colors is not crucial for threading, public access to the color memerber is granted.

Minimal Rectangle Dimension

In order to avoid to capture simple mouse-clicks, that lead to very small or even zero-sized rectangles, a minimum rectangle dimension can be given in the constructor. The minimum rectangle dimension is only used for the 'real' rectangle, not for the dragged one.


Constructor & Destructor Documentation

Default constructor with optionally given minimum dimension.

See also:
Minimal Rectangle Dimension

Member Function Documentation

returns the currently dragged rectangle

returns the minimum rectangle size

returns the currrent rectangle

returns whether the user currently defines a rectangle (using a drag gesture)

returns wether a valid rectangle was defined

virtual void icl::qt::DragRectangleMouseHandler::process ( const MouseEvent e) [virtual]

overwritten mouse-event handler function

Reimplemented from icl::qt::MouseHandler.

void icl::qt::DragRectangleMouseHandler::setMinDim ( int  minDim) [inline]

sets the minimum rectangle size

visualization method that can be used to visualized the MouseHandlers current state

This method needs an already locked instance of ICLDrawWidget


Member Data Documentation

current mouse-position while dragging

edge color for the defined rectangle

edge color for the dragged rectangle

fill color for the defined rectangle

fill color for the dragged rectangle

minimum rectangle size

point where the drag gesture started

color that is used for everything outside the rectangle

as m_outer, but for the dragged rectangle

last defined rectangle


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines