Several examples fixed to compile and work in new draw

git-svn-id: svn://ultimatepp.org/upp/trunk@1386 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-07-08 18:44:19 +00:00
parent bacf2dc0ec
commit b87ec0e8ff
10 changed files with 46 additions and 25 deletions

View file

@ -3,12 +3,11 @@
ColorWindow::ColorWindow()
{
Sizeable().Zoomable();
SetRect(100, 100, 100, 100);
}
void ColorWindow::Paint(Draw& draw)
{
draw.DrawRect(draw.GetClip(), White());
draw.DrawRect(GetSize(), White());
for(int i = 0; i < 16; i++) {
Color c(i & 1 ? 255 : 0, i & 2 ? 255 : 0, i & 4 ? 255 : 0);
draw.DrawText(0, i * 30, AsString(c), Arial(30).Underline(), c);

View file

@ -1,5 +1,5 @@
#include <Web/Web.h>
#include <Draw/Draw.h>
#include <CtrlCore/CtrlCore.h>
//#include <plugin/png/png.h>
#include <plugin/gif/gif.h>
#ifdef PLATFORM_WIN32
@ -29,9 +29,10 @@ static void SignalHandler(int signal)
}
#endif
CONSOLE_APP_MAIN
GUI_APP_MAIN
{
#ifdef PLATFORM_WIN32
AllocConsole();
SetConsoleCtrlHandler(&ControlBreak, TRUE);
#endif
#ifdef PLATFORM_POSIX

View file

@ -1,10 +1,11 @@
description "Simple http image server";
description "Simple http image server\377";
uses
Web,
Draw,
plugin\png,
plugin\gif;
plugin\gif,
CtrlCore;
file
imgsrv.cpp;

View file

@ -4,4 +4,5 @@
#include "Draw/init"
#include "plugin\png/init"
#include "plugin\gif/init"
#include "CtrlCore/init"
#endif

View file

@ -14,7 +14,7 @@ GUI_APP_MAIN
w.StartPage();
const char *text = "Hello world!";
Font font = Roman(300);
Point p = Rect(w.GetPagePixels()).CenterPos(GetTextSize(text, font));
Point p = Rect(w.GetPageSize()).CenterPos(GetTextSize(text, font));
w.DrawText(p.x, p.y, "Hello world!", font);
w.EndPage();
}

View file

@ -0,0 +1,11 @@
description "Demonstrates usage of internal (iml) images in QTF\377";
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,8 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
PromptOK("@@iml:400*400`CtrlImg:exclamation`");
}

View file

@ -1,5 +1,5 @@
LAYOUT(MainLayout, 404, 204)
ITEM(CounterCtrl, counter, SetFont(Roman(34)).Ink(Color(153, 0, 51)).Paper(Color(102, 204, 204)).LeftPosZ(128, 120).TopPosZ(56, 52))
ITEM(CounterCtrl, counter, SetFont(RomanZ(34)).Ink(Color(153, 0, 51)).Paper(Color(102, 204, 204)).LeftPosZ(128, 120).TopPosZ(56, 52))
ITEM(LabelBox, dv___1, SetLabel(t_("This is the CounterCtrl")).LeftPosZ(98, 184).TopPosZ(36, 80))
END_LAYOUT

View file

@ -1,23 +1,23 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class MyApp : public TopWindow {
Button button;
void Click(String s) {
button.SetLabel("I was clicked, YOHOO!");
PromptOK(s);
button <<= THISBACK1(Click, "Button was clicked once again!");
void Click() {
if(PromptYesNo("Button was clicked. Do you want to quit?"))
Break();
}
public:
typedef MyApp CLASSNAME;
MyApp() {
Title("Testing of Ultimate++");
button.SetRect(100, 100, 200, 50);
button.SetLabel("Click me!");
button <<= THISBACK1(Click, "Button was clicked for the first time.");
Add(button);
Title("Hello world");
button.SetLabel("Hello world!");
button <<= THISBACK(Click);
Add(button.HSizePos(100, 100).VSizePos(100, 100));
}
};

View file

@ -6,9 +6,9 @@ using namespace Upp;
// It compiles all U++ examples using MSC8 and MINGW build methods
// or methods listed on commandline
String input = "d:\\";
String output = "e:\\all";
String umk = "d:\\theide\\umk.exe ";
String input = "u:\\upp.src";
String output = "u:\\all";
String umk = "u:\\theide\\umk.exe ";
Vector<String> bm;
Vector<String> failed;
@ -25,7 +25,7 @@ void Build(const char *nest, const char *bm, bool release)
FindFile ff(AppendFileName(AppendFileName(input, nest), "*.*"));
bool first = true;
while(ff) {
if(ff.IsFolder()) {
if(ff.IsFolder() && !ff.IsHidden()) {
String txt;
txt << ff.GetName() << ' ' << bm << ' ' << mn;
Cout() << " Building " << txt;
@ -64,14 +64,14 @@ void Build(const char *nest)
CONSOLE_APP_MAIN
{
const Vector<String>& arg = CommandLine();
input = GetDataFile("BuildAll.cpp")[0] + String(":\\");
input = GetFileFolder(GetFileFolder(GetFileFolder(GetDataFile("BuildAll.cpp"))));
output = "C:\\out";
for(int i = 0; i < arg.GetCount(); i++)
bm.Add(arg[i]);
if(bm.GetCount() == 0) {
bm.Add("MSC71cdb");
bm.Add("MSC8");
bm.Add("MINGWI2");
// bm.Add("MSC71cdb");
bm.Add("MSC9");
// bm.Add("MINGWI2");
}
Build("examples");
Build("reference");