Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

RectTracker

 

class RectTracker : public LocalLoop

RectTracker is a class that represent repositioning modal loop. It can reposition and/or resize rectangle or line as single modal operation.

 

 

Public Member List

 

Callback1<Rectsync

This callback is called each time the dimensions change.

 


 

Callback1<Rect&round

If present, this callback is used to alter coordinates of rectangle after they are determined from mouse position, before other processing. Can be used e.g. to implement "snap to grid" operations. This is more recent alternative to defining rounding object and method Round.

 


 

RectTracker& SetCursorImage(const Image& m)

Sets the mouse cursor appearance during the loop.

 


 

RectTracker& MinSize(Size sz)

Sets the minimal size of rectangle.

 


 

RectTracker& MaxSize(Size sz)

Sets the maximal size of rectangle.

 


 

RectTracker& MaxRect(const Rect& mr)

Sets the bounding rectangle which the resulting rectangle cannot exceed.

 


 

RectTracker& Clip(const Rect& c)

Sets the clipping rectangle.

 


 

RectTracker& Width(int n)

Sets the width of tracking rectangle shape lines.

 


 

RectTracker& SetColor(Color c)

Sets the color of tracking rectangle (if on white background).

 


 

RectTracker& Pattern(int p)

Sets the pattern used to drive lines. p can be one of

 

DRAWDRAGRECT_SOLID

solid line

DRAWDRAGRECT_NORMAL

line of alternating single dots - default

DRAWDRAGRECT_DASHED

line of alternating 4 pixel segments

 


 

RectTracker& Dashed()

Same as Pattern(DRAWDRAGRECT_DASH).

 


 

RectTracker& Solid()

Same as Pattern(DRAWDRAGRECT_SOLID).

 


 

RectTracker& Normal()

Same as Pattern(DRAWDRAGRECT_NORMAL).

 


 

RectTracker& Animation(int step_ms = 40)

Activates pattern animation.

 


 

RectTracker& KeepRatio(bool b)

Forces rectangle to keep the original ratio.

 


 

RectTracker& Round(Rounder& r)

Sets the rounding object. This is somewhat obsoleted by round callback.

 


 

Rect Get()

Returns the current tracking rectangle.

 


 

Rect Track(const Rect& r, int tx = ALIGN_RIGHT, int ty = ALIGN_BOTTOM)

Performs the modal rectangle tracking loop. tx and ty specify which edge or corner of rectangle is being changed:

 

tx

ty

Changed

ALIGN_LEFT

ALIGN_TOP

Top-left corner.

ALIGN_LEFT

ALIGN_CENTER

Left edge.

ALIGN_LEFT

ALIGN_BOTTOM

Bottom-left corner.

ALIGN_CENTER

ALIGN_TOP

Top edge.

ALIGN_CENTER

ALIGN_CENTER

Rectangle is moved.

ALIGN_CENTER

ALIGN_BOTTOM

Bottom edge.

ALIGN_RIGHT

ALIGN_TOP

Top-right corner.

ALIGN_RIGHT

ALIGN_CENTER

Right edge.

ALIGN_RIGHT

ALIGN_BOTTOM

Bottom-right corner.

 

Returns a new rectangle.

 


 

int TrackHorzLine(int x0, int y0, int cx, int line)

Performs tracking look of horizontal line. x0, y0 is base point, cx the width of line, line the current position. Returns the new position.

 


 

int TrackVertLine(int x0, int y0, int cy, int line)

Performs tracking look of vertical line. x0, y0 is base point, cy the height of line, line the current position. Returns the new position.

 


 

RectTracker(Ctrl& master)

Constructs RectTracker, the view area of master is used for drawing and coordinate system.

 

 

Last edit by cxl on 03/12/2012. Do you want to contribute?. T++