From 6ef24bc50df05300d206c5e1e74fe36a3d357915 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 27 Sep 2018 08:38:14 +0000 Subject: [PATCH] .upptst git-svn-id: svn://ultimatepp.org/upp/trunk@12309 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- upptst/CharMetrics/main.cpp | 2 +- upptst/ImageViewDraw/ImageViewDraw.upp | 9 +++++ upptst/ImageViewDraw/main.cpp | 33 +++++++++++++++++ upptst/MultiButton/MultiButton.upp | 9 +++++ upptst/MultiButton/main.cpp | 49 ++++++++++++++++++++++++++ upptst/PromptImage/PromptImage.upp | 9 +++++ upptst/PromptImage/main.cpp | 11 ++++++ 7 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 upptst/ImageViewDraw/ImageViewDraw.upp create mode 100644 upptst/ImageViewDraw/main.cpp create mode 100644 upptst/MultiButton/MultiButton.upp create mode 100644 upptst/MultiButton/main.cpp create mode 100644 upptst/PromptImage/PromptImage.upp create mode 100644 upptst/PromptImage/main.cpp diff --git a/upptst/CharMetrics/main.cpp b/upptst/CharMetrics/main.cpp index c58a9ea64..706323aeb 100644 --- a/upptst/CharMetrics/main.cpp +++ b/upptst/CharMetrics/main.cpp @@ -22,7 +22,7 @@ struct MyApp : TopWindow { int width = fnt[ch]; w.DrawRect(x, y, width - 1, fnt.GetAscent(), Color(255, 255, 200)); w.DrawRect(x, y + fnt.GetAscent(), width - 1, fnt.GetDescent(), Color(255, 200, 255)); - w.DrawRect(x + width - 1, y, 1, fnt.GetHeight(), Black()); + w.DrawRect(x + width - 1, y, 1, fnt.GetCy(), Black()); w.DrawText(x, y, WString(ch, 1), fnt); x += width; } diff --git a/upptst/ImageViewDraw/ImageViewDraw.upp b/upptst/ImageViewDraw/ImageViewDraw.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/ImageViewDraw/ImageViewDraw.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/ImageViewDraw/main.cpp b/upptst/ImageViewDraw/main.cpp new file mode 100644 index 000000000..a6acc5f2d --- /dev/null +++ b/upptst/ImageViewDraw/main.cpp @@ -0,0 +1,33 @@ +#include + +using namespace Upp; + +Image img; + +struct MyApp : TopWindow +{ + void Paint(Draw& w) override { + w.DrawRect(GetSize(), LtGray()); + w.DrawImage(0, 0, img); + w.DrawRect(DPI(400) - DPI(5), DPI(40) - DPI(5), DPI(210), DPI(90), Red()); + } + + void LeftDown(Point, dword) override { + static int ii; + ViewDraw iw(this); + iw.DrawRect(DPI(400), DPI(40), DPI(200), DPI(80), LtBlue()); + iw.DrawText(DPI(400), DPI(40), AsString(ii++), Arial(DPI(80))); + } +}; + +GUI_APP_MAIN +{ + Size isz(DPI(200), DPI(200)); + ImageDraw iw(isz); + iw.DrawRect(isz, White()); + iw.DrawText(10, 10, "Hello world"); + iw.DrawImage(10, 50, CtrlImg::exclamation()); + img = iw; + + MyApp().Run(); +} diff --git a/upptst/MultiButton/MultiButton.upp b/upptst/MultiButton/MultiButton.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/MultiButton/MultiButton.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/MultiButton/main.cpp b/upptst/MultiButton/main.cpp new file mode 100644 index 000000000..5a1797ae1 --- /dev/null +++ b/upptst/MultiButton/main.cpp @@ -0,0 +1,49 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + + TopWindow win; + + int y = 0; + auto add = [&](Ctrl& c) { + y += 25; + win.Add(c.TopPos(y, Zx(16)).LeftPos(10, Zx(100))); + }; + + DropList a, b, c; + + a.Add(1); + add(a); + + + b.Add(1); + b.AddButton().Left().SetLabel("1"); + add(b); + + c.Add(1); + c.AddButton().Left().SetLabel("1"); + c.AddButton().Left().SetLabel("2"); + c.AddButton().SetLabel("3"); + add(c); + + WithDropChoice aa, bb, cc; + + aa.AddList(1); + add(aa); + + + bb.AddList(1); + bb.AddButton().Left().SetLabel("1"); + add(bb); + + cc.AddList(1); + cc.AddButton().Left().SetLabel("1"); + cc.AddButton().Left().SetLabel("2"); + cc.AddButton().SetLabel("3"); + add(cc); + + win.Run(); +} diff --git a/upptst/PromptImage/PromptImage.upp b/upptst/PromptImage/PromptImage.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/PromptImage/PromptImage.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/PromptImage/main.cpp b/upptst/PromptImage/main.cpp new file mode 100644 index 000000000..14151dc28 --- /dev/null +++ b/upptst/PromptImage/main.cpp @@ -0,0 +1,11 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + Exclamation("Exclamation"); + PromptOK("PromptOK"); + PromptOKCancel("PromptOKCancel"); + ErrorOK("ErrorOK"); +}