syncing uppdev

git-svn-id: svn://ultimatepp.org/upp/trunk@1657 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-10-25 20:12:22 +00:00
parent 8365652425
commit d8ce94784b
8 changed files with 156 additions and 0 deletions

View file

@ -0,0 +1,13 @@
description "Demonstrates using RichTextLayoutTracer to count number of table rows per report page\377";
uses
CtrlLib,
Report,
Painter;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,6 @@
#ifndef _RichTextLayoutTracer_icpp_init_stub
#define _RichTextLayoutTracer_icpp_init_stub
#include "CtrlLib/init"
#include "Report/init"
#include "Painter/init"
#endif

View file

@ -0,0 +1,34 @@
#include <Report/Report.h>
using namespace Upp;
struct TableRowTracer : RichTextLayoutTracer {
VectorMap<int, int> pgr;
virtual void TableCell(const Rect& page, PageY py, int i, int j, const RichTable& table, PageY npy)
{
if(j == 0)
for(int i = py.page; i <= npy.page; i++)
pgr.GetAdd(i, 0)++;
}
};
GUI_APP_MAIN
{
Report r;
r.Footer("[R1 ");
TableRowTracer t;
r.SetRichTextLayoutTracer(t);
String qtf = LoadFile("D:\\log.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);
}

5
uppdev/testOnglet/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _testOnglet_icpp_init_stub
#define _testOnglet_icpp_init_stub
#include "CtrlLib/init"
#include "Docking/init"
#endif

View file

@ -0,0 +1,47 @@
#include "testOnglet.h"
testOnglet::testOnglet()
{
CtrlLayout(*this, "Window title");
Sizeable();
//Add(tabs.SizePos());
CtrlLayout(tab1);
CtrlLayout(tab2);
tabs.Add(tab1, "first");
tabs.Add(tab2, "second");
WithTab1<ParentCtrl>* dynTab = new WithTab1<ParentCtrl>();
CtrlLayout(*dynTab);
dynTab->SizePos();
tabs.Add(*dynTab, "third");
// MENU BAR
AddFrame(menuBar);
menuBar.Set(THISBACK(mainBar));
// BOTTOM STATUS BAR
// statusBar.SetFrame(TopSeparatorFrame());
AddFrame(statusBar);
bClose << THISBACK(closeOnglet);
}
void testOnglet::closeOnglet()
{
if (tabs.GetCount() > 0) tabs.Remove(0);
}
void testOnglet::mainBar(Bar& bar)
{
bar.Add(t_("File"), THISBACK(Close));
bar.Add(t_("Data"), THISBACK(Close));
}
GUI_APP_MAIN
{
testOnglet().Run();
}

View file

@ -0,0 +1,24 @@
#ifndef _testOnglet_testOnglet_h
#define _testOnglet_testOnglet_h
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <testOnglet/testOnglet.lay>
#include <CtrlCore/lay.h>
class testOnglet : public WithtestOngletLayout<TopWindow> {
public:
StatusBar statusBar;
MenuBar menuBar;
void mainBar(Bar& bar);
void closeOnglet();
typedef testOnglet CLASSNAME;
testOnglet();
};
#endif

View file

@ -0,0 +1,16 @@
LAYOUT(Tab1, 400, 200)
ITEM(Clock, dv___0, HSizePosZ(216, 34).VSizePosZ(12, 32))
ITEM(Button, dv___1, LeftPosZ(36, 72).TopPosZ(12, 28))
END_LAYOUT
LAYOUT(Tab2, 400, 200)
ITEM(Calendar, dv___0, HSizePosZ(76, 88).VSizePosZ(12, 32))
END_LAYOUT
LAYOUT(testOngletLayout, 568, 484)
ITEM(TabCtrl, tabs, HSizePosZ(124, 22).VSizePosZ(8, 12))
ITEM(WithTab1<ParentCtrl>, tab1, LeftPosZ(132, 404).TopPosZ(40, 428))
ITEM(WithTab2<ParentCtrl>, tab2, LeftPosZ(132, 404).TopPosZ(40, 428))
ITEM(Button, bClose, SetLabel(t_("close")).HSizePosZ(24, 460).VSizePosZ(156, 280))
END_LAYOUT

View file

@ -0,0 +1,11 @@
uses
CtrlLib;
file
testOnglet.h,
main.cpp,
testOnglet.lay;
mainconfig
"" = "GUI MT";