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@1543 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
fa59ec7b80
commit
772db5d172
3 changed files with 72 additions and 0 deletions
10
uppdev/SetSurtface1/SetSurtface1.upp
Normal file
10
uppdev/SetSurtface1/SetSurtface1.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
Painter;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
5
uppdev/SetSurtface1/init
Normal file
5
uppdev/SetSurtface1/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _SetSurtface1_icpp_init_stub
|
||||
#define _SetSurtface1_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "Painter/init"
|
||||
#endif
|
||||
57
uppdev/SetSurtface1/main.cpp
Normal file
57
uppdev/SetSurtface1/main.cpp
Normal file
|
|
@ -0,0 +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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue