mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
reference: RichTextLayoutTracer example, GuiLock fixed
git-svn-id: svn://ultimatepp.org/upp/trunk@1512 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
72d276642f
commit
9b26dccfd1
4 changed files with 61 additions and 11 deletions
|
|
@ -17,18 +17,17 @@ struct App : TopWindow {
|
|||
|
||||
void App::Work()
|
||||
{
|
||||
int q = 0;
|
||||
while(!Thread::IsShutdownThreads()) {
|
||||
{
|
||||
GuiLock __;
|
||||
if(list.GetCount() > 1000) {
|
||||
if(PromptYesNo("Quit?"))
|
||||
Break();
|
||||
list.Clear();
|
||||
}
|
||||
list.Add((int64)Random());
|
||||
}
|
||||
for(;;) {
|
||||
Sleep(1);
|
||||
GuiLock __;
|
||||
if(Thread::IsShutdownThreads())
|
||||
break;
|
||||
if(list.GetCount() > 1000) {
|
||||
if(PromptYesNo("Quit?"))
|
||||
Break();
|
||||
list.Clear();
|
||||
}
|
||||
list.Add((int64)Random());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
12
reference/RichTextLayoutTracer/RichTextLayoutTracer.upp
Normal file
12
reference/RichTextLayoutTracer/RichTextLayoutTracer.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
description "Demonstrates using RichTextLayoutTracer to count number of table rows per report page\377";
|
||||
|
||||
uses
|
||||
CtrlLib,
|
||||
Report;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
5
reference/RichTextLayoutTracer/init
Normal file
5
reference/RichTextLayoutTracer/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _RichTextLayoutTracer_icpp_init_stub
|
||||
#define _RichTextLayoutTracer_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "Report/init"
|
||||
#endif
|
||||
34
reference/RichTextLayoutTracer/main.cpp
Normal file
34
reference/RichTextLayoutTracer/main.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include <Report/Report.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct TableRowTracer : RichTextLayoutTracer {
|
||||
VectorMap<int, int> pgr;
|
||||
|
||||
virtual void TableRow(const Rect& page, PageY y, int, const RichTable&) {
|
||||
pgr.GetAdd(y.page, 0)++;
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
Report r;
|
||||
r.Footer("[R1 ");
|
||||
TableRowTracer t;
|
||||
r.SetRichTextLayoutTracer(t);
|
||||
String qtf = "&[R This is a demonstration of [* RichTextLayoutTracer]&&&{{1 Table";
|
||||
for(int i = 0; i < 100; i++)
|
||||
qtf << ":: " << i;
|
||||
qtf << "}}";
|
||||
r.Put(qtf);
|
||||
|
||||
Report rr;
|
||||
for(int i = 0; i < r.GetCount(); i++) {
|
||||
if(i)
|
||||
rr.NewPage();
|
||||
rr.Footer("[R1 There is " + AsString(t.pgr.Get(i, 0)) + " table rows on this page");
|
||||
rr.DrawDrawing(r.GetPageSize(), r[i]);
|
||||
}
|
||||
|
||||
Perform(rr);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue