mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@1544 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
772db5d172
commit
61c0c32e37
1 changed files with 57 additions and 57 deletions
|
|
@ -1,57 +1,57 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <Painter/Painter.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
class PainterCtrl : public Ctrl {
|
||||
ImageBuffer ib;
|
||||
|
||||
public:
|
||||
virtual void Paint(Painter &pntr,Size &sz)=0;
|
||||
|
||||
virtual void Layout(){
|
||||
Size sz=GetSize();
|
||||
ib.Clear();
|
||||
ib.Create(sz);
|
||||
BufferPainter pntr(ib);
|
||||
Paint(pntr,sz);
|
||||
}
|
||||
|
||||
virtual void Paint(Draw &draw) {
|
||||
Rect paintrect=draw.GetPaintRect();
|
||||
|
||||
Point p = paintrect.TopLeft();
|
||||
if(p.x < ib.GetSize().cx && p.y < ib.GetSize().cy)
|
||||
SetSurface(draw, paintrect, ib, ib.GetSize(), p);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct ExampleCtrl : PainterCtrl {
|
||||
|
||||
virtual void Paint(Painter &pntr,Size &sz){
|
||||
pntr.Move(0,0).Line(sz.cx,0).Line(sz.cx,sz.cy).Line(0,sz.cy).Close().Fill(White()).Stroke(5,Black());
|
||||
pntr.Move(0,0).Line(sz.cx,sz.cy).Stroke(5,Black());
|
||||
}
|
||||
};
|
||||
|
||||
class ExampleTopWindow: public TopWindow{
|
||||
public:
|
||||
ExampleCtrl ec;
|
||||
|
||||
virtual void Layout(){
|
||||
ec.SetRect(20,0,GetSize().cx-20,GetSize().cy);
|
||||
}
|
||||
|
||||
ExampleTopWindow(){
|
||||
Add(ec);
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ExampleTopWindow win;
|
||||
win.Sizeable();
|
||||
win.Open();
|
||||
win.Run();
|
||||
}
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <Painter/Painter.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
class PainterCtrl : public Ctrl {
|
||||
ImageBuffer ib;
|
||||
|
||||
public:
|
||||
virtual void Paint(Painter &pntr,Size &sz)=0;
|
||||
|
||||
virtual void Layout(){
|
||||
Size sz=GetSize();
|
||||
ib.Clear();
|
||||
ib.Create(sz);
|
||||
BufferPainter pntr(ib);
|
||||
Paint(pntr,sz);
|
||||
}
|
||||
|
||||
virtual void Paint(Draw &draw) {
|
||||
Rect paintrect=draw.GetPaintRect();
|
||||
DDUMP(paintrect);
|
||||
Point p = paintrect.TopLeft();
|
||||
if(p.x < ib.GetSize().cx && p.y < ib.GetSize().cy)
|
||||
SetSurface(draw, paintrect, ib, ib.GetSize(), p);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct ExampleCtrl : PainterCtrl {
|
||||
|
||||
virtual void Paint(Painter &pntr,Size &sz){
|
||||
pntr.Move(0,0).Line(sz.cx,0).Line(sz.cx,sz.cy).Line(0,sz.cy).Close().Fill(White()).Stroke(5,Black());
|
||||
pntr.Move(0,0).Line(sz.cx,sz.cy).Stroke(5,Black());
|
||||
}
|
||||
};
|
||||
|
||||
class ExampleTopWindow: public TopWindow{
|
||||
public:
|
||||
ExampleCtrl ec;
|
||||
|
||||
virtual void Layout(){
|
||||
ec.SetRect(20,0,GetSize().cx-20,GetSize().cy);
|
||||
}
|
||||
|
||||
ExampleTopWindow(){
|
||||
Add(ec);
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ExampleTopWindow win;
|
||||
win.Sizeable();
|
||||
win.Open();
|
||||
win.Run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue