From 9c406b07172e31c20dfadbe4ab24fd2f04208c4e Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 12 Mar 2012 07:38:48 +0000 Subject: [PATCH] .reference: RectTracker now demostrates rounding too git-svn-id: svn://ultimatepp.org/upp/trunk@4687 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- reference/RectTracker/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/reference/RectTracker/main.cpp b/reference/RectTracker/main.cpp index fb3e12230..c7ca58464 100644 --- a/reference/RectTracker/main.cpp +++ b/reference/RectTracker/main.cpp @@ -5,6 +5,15 @@ using namespace Upp; struct MyApp : TopWindow { Rect rect; int hline, vline; + + typedef MyApp CLASSNAME; + + void Round(Rect& r) + { + int cx = r.GetWidth(); + r.left = r.left / 10 * 10; + r.right = r.left + cx; + } virtual void Paint(Draw& w) { @@ -20,6 +29,7 @@ struct MyApp : TopWindow { Size sz = GetSize(); if(keyflags & K_ALT) { tr.Dashed().Animation(); + tr.round = THISBACK(Round); rect = tr.Track(rect, ALIGN_CENTER, ALIGN_CENTER); } else @@ -33,7 +43,7 @@ struct MyApp : TopWindow { vline = tr.TrackVertLine(0, 0, sz.cy, vline); } else { - tr.Dashed().Animation(); + tr.Normal(); rect = tr.Track(rect, ALIGN_RIGHT, ALIGN_BOTTOM); } Refresh();