Image Component Library (ICL)
|
Utility class that implements draggable rects on the ChromaWidget surface. More...
#include <Dragger.h>
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 More... | |
bool | hit (const utils::Point32f &x) const |
returns whether a given relative position is inside the dragger More... | |
const utils::Rect32f & | rect () const |
returns the draggers relative rect More... | |
float | dim () const |
returns the current dim variable More... | |
const utils::Point32f & | pos () const |
returns the current center position More... | |
const Color & | col () const |
returns the current color More... | |
void | setColor (float r, float g, float b) |
sets the current color More... | |
void | setDim (float d) |
sets the current dim More... | |
void | setPos (const utils::Point32f &x) |
sets the current position (which is clipped to [0,1]) More... | |
void | move (const utils::Point32f &dist) |
moves the dragger by a given distance More... | |
void | drag (const utils::Point32f &x) |
makes this dragger "dragged" by the mouse More... | |
void | dragTo (const utils::Point32f &x) |
once dragged, this function will move the dragger More... | |
void | drop () |
drops this dragger, to it is no longer moved by the mouse More... | |
void | draw (ICLDrawWidget *w) const |
draws this dragger into the given ICLDrawWidget More... | |
bool | over () const |
returns whether the mouse is currently over this dragger More... | |
void | setOver (bool val=true) |
sets the internal "over"-variable to indicate, that the mouse is over the dragger More... | |
bool | dragged () const |
returns whether this dragger is currently dragged More... | |
Private Attributes | |
utils::Point32f | p |
float | d |
utils::Rect32f | r |
bool | dr |
Color | c |
bool | ov |
utils::Point32f | dragOffs |
Utility class that implements draggable rects on the ChromaWidget surface.
|
inline |
creates a new Dragger
p | initial position in relative coordinates [0,1] |
d | relative dimension in each direction (0.1 -> 10% of widget size) |
c | color of the dragger |
|
inline |
returns the current color
|
inline |
returns the current dim variable
|
inline |
makes this dragger "dragged" by the mouse
x | mouse grip point which is used to calculate the offset to the draggers center called "dragOffs" |
|
inline |
returns whether this dragger is currently dragged
|
inline |
once dragged, this function will move the dragger
The new position is clip( x+dragOffs, [0,1])
x | new position (result is clipped to [0,1] |
void icl::qt::Dragger::draw | ( | ICLDrawWidget * | w | ) | const |
draws this dragger into the given ICLDrawWidget
The ICLDrawWidget must be set up before using
w | drawing context |
|
inline |
drops this dragger, to it is no longer moved by the mouse
|
inline |
returns whether a given relative position is inside the dragger
|
inline |
moves the dragger by a given distance
The resulting position is clipped to [0,1]
dist | distance to move |
|
inline |
returns whether the mouse is currently over this dragger
|
inline |
returns the current center position
|
inline |
returns the draggers relative rect
|
inline |
sets the current color
r | red value |
g | green value |
b | blue value |
|
inline |
sets the current dim
d | new dim value (relative) |
|
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
|
inline |
sets the current position (which is clipped to [0,1])
x | new center position of the dragger |
|
private |
!< flag to indicate whether this dragger is currently dragged
|
private |
!< current center position (relative to the parent widgets size)
|
private |
!< current relative rect of this dragger (p.x-d,p.y-d,2*d,2*d)
|
private |
!< flag to indicate whether this mouse is currently over this dragger
|
private |
!< current color of this dragger
|
private |
|
private |
!< relative dimension of this dragger in each direction