git-svn-id: svn://ultimatepp.org/upp/trunk@3636 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-07-10 21:32:09 +00:00
parent 712e69b6a5
commit 1b18bba778
7 changed files with 1412 additions and 55 deletions

View file

@ -5,6 +5,7 @@ include
gdfgsdfg;
file
h.iml,
bak.tpp,
AccessKey.h,
test.key,

1317
uppdev/AccessKey/h.iml Normal file

File diff suppressed because it is too large Load diff

View file

@ -7,40 +7,91 @@ using namespace Upp;
#define IMAGEFILE <PainterBug/Pictures.iml>
#include <Draw/iml.h>
struct App : TopWindow
void InvRectPath(Painter& pw, const Rect& r)
{
App()
{
Sizeable();
Zoomable();
}
pw.Move(r.left, r.top).Line(r.left, r.bottom).Line(r.right, r.bottom).Line(r.right, r.top).Close();
}
static void sRenderLine(Painter& w, int x, int y, int dx, int dy, int cx, int cy, int len, byte pattern)
{
for(int i = 0; i < len; i++)
if((256 >> (i & 3)) & pattern)
w.DrawRect(x + dx * i, y + dy * i, cx, cy, Black);
}
static void sRenderRect(Painter& w, const Rect& r, int n, byte pattern)
{
sRenderLine(w, r.left, r.top, 1, 0, 1, n, r.GetWidth(), pattern);
sRenderLine(w, r.left, r.bottom - 1, 1, 0, 1, n, r.GetWidth(), pattern);
sRenderLine(w, r.left, r.top, 0, 1, n, 1, r.GetHeight(), pattern);
sRenderLine(w, r.right - 1, r.top, 0, 1, n, 1, r.GetHeight(), pattern);
}
// This is Upp conversion of Qt example, see
// http://doc.trolltech.com/3.0/hello-example.html
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class HelloWorld : public TopWindow {
public:
virtual void LeftDown(Point, dword);
virtual void Paint(Draw& w);
private:
int pos;
int dir;
String text;
virtual void Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, White);
w.DrawText(10, 2, "GDI");
w.DrawText(250, 2, "Painter");
int cx = 200;
int cy = 150;
ChPaint(w, Rect(10, 20, 10 + cx, 20 + cy), Images::WindowBg());
ImageBuffer ib(cx, cy);
BufferPainter bp(ib);
bp.Clear(RGBAZero());
ChPaint(bp, Rect(0, 0, cx, cy), Images::WindowBg());
w.DrawImage(250, 20, ib);
}
void Animate();
public:
typedef HelloWorld CLASSNAME;
HelloWorld& Text(const String& t) { text = t; Refresh(); return *this; }
HelloWorld();
};
HelloWorld::HelloWorld()
{
SetTimeCallback(-1, THISBACK(Animate));
BackPaint();
Zoomable().Sizeable();
pos = 0;
dir = 1;
}
void HelloWorld::LeftDown(Point, dword)
{
Close();
}
void HelloWorld::Animate()
{
pos += dir;
if(pos <= 0) {
dir = 1;
pos = 0;
}
if(pos >= 2000) {
dir = -1;
pos = 2000;
}
Refresh();
}
void HelloWorld::Paint(Draw& w)
{
w.DrawRect(GetSize(), White());
DrawFrame(w, Size(pos, pos), InvertColor);
}
GUI_APP_MAIN
{
App().Run();
HelloWorld hw;
hw.Title("Hello world example");
hw.Text(Nvl(Join(CommandLine(), " "), "Hello world !"));
hw.Run();
}

View file

@ -1,6 +1,7 @@
uses
RichEdit,
plugin\jpg;
plugin\jpg,
Painter;
file
main.cpp,

View file

@ -2,4 +2,5 @@
#define _RichEditTest_icpp_init_stub
#include "RichEdit/init"
#include "plugin\jpg/init"
#include "Painter/init"
#endif

View file

@ -27,7 +27,8 @@ GUI_APP_MAIN
DUMP(ScrollBarSize());
e.Pick(ParseQTF(LoadFile(FileName())));
// e.Pick(ParseQTF(LoadFile(FileName())));
e.SetQTF(LoadFile("U:\\xxx\\PainterBug.qtf"));
// e.ClipZoom(4, 1);
RichEdit::PosInfo f;
LoadFromFile(f, ConfigFile("pos"));
@ -44,7 +45,7 @@ GUI_APP_MAIN
w.Run();
*/
String x = e.GetQTF();
SaveFile(FileName(), x);
// SaveFile(FileName(), x);
f = e.GetPosInfo();
StoreToFile(f, ConfigFile("pos"));
LOG("Exit");

View file

@ -6,29 +6,14 @@ using namespace Upp;
struct App : TopWindow {
void Paint(Draw& w) {
DrawPainter sw(w, GetSize());
sw.Clear(White());
double width2=200;
double width1=100;
double h1=50.5;
double length2=100;
sw.Offset(200, 200);
sw
.Move(-.5*width2, h1)
.Line(-.5*width1, 0)
.Line( .5*width1, 0)
.Line( .5*width2, h1)
.Line(-.5*width2, h1)
.Fill(Green())
// .Fill(-.25*width2, h1, White(), -.15*width2, .4*h1, .3*width2, Green())
;
sw
.Rectangle(-.5*width2,h1,width2,length2)
.ColorStop(0.10, Green())
.ColorStop(0.25, White())
.ColorStop(0.55, Green())
.Fill(Green())
// .Fill(-.5*width2, 0., Green(), .5*width2, 0., Green())
;
.Move(0, 0)
.Line(0, 0).Line(0, 0).Line(0, 0).Line(0, 0)
.Line(0, 0)
.Arc(0, 0, 0, 0, 0)
// .Move(dInf, dInf * tInf)
.Line(0, 0)
.Fill(Black());
}
};