mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
changed svn layout
git-svn-id: svn://ultimatepp.org/upp/trunk@281 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
commit
263ff5f895
2665 changed files with 642923 additions and 0 deletions
11
reference/RectTracker/RectTracker.upp
Normal file
11
reference/RectTracker/RectTracker.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Positioning loop example";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
52
reference/RectTracker/main.cpp
Normal file
52
reference/RectTracker/main.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct MyApp : TopWindow {
|
||||
Rect rect;
|
||||
int hline, vline;
|
||||
|
||||
virtual void Paint(Draw& w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
w.DrawRect(sz, SColorPaper());
|
||||
DrawFrame(w, rect, Black());
|
||||
w.DrawRect(0, hline, sz.cx, 1, SRed);
|
||||
w.DrawRect(vline, 0, 1, sz.cy, SBlue);
|
||||
}
|
||||
|
||||
virtual void LeftDown(Point p, dword keyflags) {
|
||||
RectTracker tr(*this);
|
||||
Size sz = GetSize();
|
||||
if(keyflags & K_ALT) {
|
||||
tr.Dashed().Animation();
|
||||
rect = tr.Track(rect, ALIGN_CENTER, ALIGN_CENTER);
|
||||
}
|
||||
else
|
||||
if(keyflags & K_SHIFT) {
|
||||
tr.Solid();
|
||||
hline = tr.TrackHorzLine(0, 0, sz.cx, hline);
|
||||
}
|
||||
else
|
||||
if(keyflags & K_CTRL) {
|
||||
tr.Solid();
|
||||
vline = tr.TrackVertLine(0, 0, sz.cy, vline);
|
||||
}
|
||||
else {
|
||||
tr.Dashed().Animation();
|
||||
rect = tr.Track(rect, ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
MyApp() {
|
||||
rect = RectC(100, 100, 100, 100);
|
||||
hline = 150;
|
||||
vline = 150;
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyApp().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue