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

Utility class that implements draggable rects on the ChromaWidget surface. More...

#include <Dragger.h>

List of all members.

Classes

struct  Color
 Utility class which helps to convert rgb to RG-Chroma and back. More...

Public Member Functions

 Dragger (const utils::Point32f &p=utils::Point32f::null, float d=0.02, const Color &c=Color(255, 0, 0))
 creates a new Dragger
bool hit (const utils::Point32f &x) const
 returns whether a given relative position is inside the dragger
const utils::Rect32frect () const
 returns the draggers relative rect
float dim () const
 returns the current dim variable
const utils::Point32fpos () const
 returns the current center position
const Colorcol () const
 returns the current color
void setColor (float r, float g, float b)
 sets the current color
void setDim (float d)
 sets the current dim
void setPos (const utils::Point32f &x)
 sets the current position (which is clipped to [0,1])
void move (const utils::Point32f &dist)
 moves the dragger by a given distance
void drag (const utils::Point32f &x)
 makes this dragger "dragged" by the mouse
void dragTo (const utils::Point32f &x)
 once dragged, this function will move the dragger
void drop ()
 drops this dragger, to it is no longer moved by the mouse
void draw (ICLDrawWidget *w) const
 draws this dragger into the given ICLDrawWidget
bool over () const
 returns whether the mouse is currently over this dragger
void setOver (bool val=true)
 sets the internal "over"-variable to indicate, that the mouse is over the dragger
bool dragged () const
 returns whether this dragger is currently dragged

Private Attributes

utils::Point32f p
float d
utils::Rect32f r
bool dr
Color c
bool ov
utils::Point32f dragOffs

Detailed Description

Utility class that implements draggable rects on the ChromaWidget surface.


Constructor & Destructor Documentation

icl::qt::Dragger::Dragger ( const utils::Point32f p = utils::Point32f::null,
float  d = 0.02,
const Color c = Color(255,0,0) 
) [inline]

creates a new Dragger

Parameters:
pinitial position in relative coordinates [0,1]
drelative dimension in each direction (0.1 -> 10% of widget size)
ccolor of the dragger

Member Function Documentation

const Color& icl::qt::Dragger::col ( ) const [inline]

returns the current color

float icl::qt::Dragger::dim ( ) const [inline]

returns the current dim variable

void icl::qt::Dragger::drag ( const utils::Point32f x) [inline]

makes this dragger "dragged" by the mouse

Parameters:
xmouse grip point which is used to calculate the offset to the draggers center called "dragOffs"
bool icl::qt::Dragger::dragged ( ) const [inline]

returns whether this dragger is currently dragged

void icl::qt::Dragger::dragTo ( const utils::Point32f x) [inline]

once dragged, this function will move the dragger

The new position is clip( x+dragOffs, [0,1])

Parameters:
xnew position (result is clipped to [0,1]

draws this dragger into the given ICLDrawWidget

The ICLDrawWidget must be set up before using

          w->setImage( chromaSpaceImage );
          w->lock();
          w->reset();
          w->rel(); // !!
          
          MyDragger.draw(w);
          
          w->unlock();
          w->update();
Parameters:
wdrawing context
void icl::qt::Dragger::drop ( ) [inline]

drops this dragger, to it is no longer moved by the mouse

bool icl::qt::Dragger::hit ( const utils::Point32f x) const [inline]

returns whether a given relative position is inside the dragger

void icl::qt::Dragger::move ( const utils::Point32f dist) [inline]

moves the dragger by a given distance

The resulting position is clipped to [0,1]

Parameters:
distdistance to move
bool icl::qt::Dragger::over ( ) const [inline]

returns whether the mouse is currently over this dragger

const utils::Point32f& icl::qt::Dragger::pos ( ) const [inline]

returns the current center position

const utils::Rect32f& icl::qt::Dragger::rect ( ) const [inline]

returns the draggers relative rect

void icl::qt::Dragger::setColor ( float  r,
float  g,
float  b 
) [inline]

sets the current color

Parameters:
rred value
ggreen value
bblue value
void icl::qt::Dragger::setDim ( float  d) [inline]

sets the current dim

Parameters:
dnew dim value (relative)
void icl::qt::Dragger::setOver ( bool  val = true) [inline]

sets the internal "over"-variable to indicate, that the mouse is over the dragger

The "over"-variable is used in the draw(..)-function for a nice mouse-over effect

void icl::qt::Dragger::setPos ( const utils::Point32f x) [inline]

sets the current position (which is clipped to [0,1])

Parameters:
xnew center position of the dragger

Member Data Documentation

!< flag to indicate whether this dragger is currently dragged

float icl::qt::Dragger::d [private]

!< current center position (relative to the parent widgets size)

bool icl::qt::Dragger::dr [private]

!< current relative rect of this dragger (p.x-d,p.y-d,2*d,2*d)

!< flag to indicate whether this mouse is currently over this dragger

bool icl::qt::Dragger::ov [private]

!< current color of this dragger

!< relative dimension of this dragger in each direction


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