Report: WhenPage

git-svn-id: svn://ultimatepp.org/upp/trunk@6578 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-11-19 12:26:16 +00:00
parent 27d2f55f9f
commit ba3baa6cbd
2 changed files with 16 additions and 16 deletions

View file

@ -51,15 +51,23 @@ void Report::PaintHF(Draw& w, int y, const char *qtf, int i)
txt.Paint(w, 0, y, GetSize().cx);
}
void Report::Flush()
{
if(pagei >= 0) {
Drawing dw = GetResult();
page.At(pagei).Append(dw);
Create(GetSize());
}
}
void Report::StartPage(int i)
{
DrawingDraw dw;
PaintHF(dw, 0, header, i);
PaintHF(dw, GetSize().cy - footercy, footer, i);
Drawing& g = page.At(i);
g = dw;
g.SetSize(GetSize());
DrawingDraw dw(GetSize());
page.At(i) = dw;
Create(GetSize());
WhenPage();
PaintHF(*this, 0, header, i);
PaintHF(*this, GetSize().cy - footercy, footer, i);
y = GetPageRect().top;
}
@ -72,7 +80,6 @@ Draw& Report::Page(int i)
while(page.GetCount() <= pagei)
StartPage(page.GetCount());
y = GetPageRect().top;
Create(GetSize());
}
return *this;
}
@ -127,15 +134,6 @@ void Report::RestartPage()
StartPage(pagei);
}
void Report::Flush()
{
if(pagei >= 0) {
Drawing dw = GetResult();
page.At(pagei).Append(dw);
Create(GetSize());
}
}
Report& Report::Landscape()
{
Size sz = GetSize();

View file

@ -30,6 +30,8 @@ private:
void RestartPage();
public:
Callback WhenPage;
int GetCount() { Flush(); return page.GetCount(); }
Drawing GetPage(int i) { Flush(); return page[i]; }
Drawing operator[](int i) { return GetPage(i); }