syncing uppdev

git-svn-id: svn://ultimatepp.org/upp/trunk@1929 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-01-24 13:21:31 +00:00
parent e26d52b8d8
commit 03de5f35f6
17 changed files with 294 additions and 4 deletions

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,49 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct EditStringSpecial : EditString {
ArrayCtrl *GetArrayCtrl() {
for(Ctrl *q = GetParent(); q; q = q->GetParent())
if(ArrayCtrl *a = dynamic_cast<ArrayCtrl *>(q))
return a;
return NULL;
}
static void DoMenu(EditStringSpecial *x) {
MenuBar bar;
x->StdBar(bar);
ArrayCtrl *a = x->GetArrayCtrl();
if(a) {
bar.Separator();
a->WhenBar(bar);
}
bar.Execute();
}
void MyBar(Bar& bar)
{
PostCallback(callback1(DoMenu, this));
}
typedef EditStringSpecial CLASSNAME;
EditStringSpecial() {
WhenBar = THISBACK(MyBar);
}
};
GUI_APP_MAIN
{
ArrayCtrl a;
a.Appending().Removing();
a.AddColumn("Text").Ctrls<EditStringSpecial>();
for(int i = 0; i < 300; i++)
a.Add(AsString(i));
a.SetLineCy(Draw::GetStdFontCy() + 8);
TopWindow app;
app.Add(a.SizePos());
app.Sizeable();
app.Run();
}

View file

@ -0,0 +1,10 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
ArrayMap<int, int> x, y;
BREAK_WHEN_PICKED(x);
x = y;
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
BREAK_ON_PICKED.cpp;
mainconfig
"" = "";

View file

@ -2,10 +2,18 @@
using namespace Upp; using namespace Upp;
int compactcommandline()
/**/{
int goo;
go
int i,j;
}
void MyTest() {}
CONSOLE_APP_MAIN CONSOLE_APP_MAIN
{ {
CParser p("i if while 12345 alfa"); MyTes(*)
__BREAK__;
int q = p.Id("i") + p.Id("if") + p.Id("while");
Cout() << q;
} }

View file

@ -0,0 +1,7 @@
#include <Core/Core.h>
CONSOLE_APP_MAIN
{
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
GetLanguages.cpp;
mainconfig
"" = "";

View file

@ -0,0 +1,11 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
Index<int> x = GetLngSet();
for(int i = 0; i < x.GetCount(); i++)
DDUMP(LNGAsText(x[i]));
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
GetTranslationLanguages.cpp;
mainconfig
"" = "";

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,37 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class TestSplitter : public TopWindow
{
private:
// pages column list
ColumnList pageList;
// page container
StaticRect pagePane;
// the splitter
Splitter splitter;
public:
TestSplitter();
};
TestSplitter::TestSplitter()
{
// adds the splitter
// SizePos();
Add(splitter);
// setup pagelist appearance
pageList.Columns(1).SizePos();
// adds the columnlist on left
splitter.Horz(pageList, pagePane).SetPos(100);
}
GUI_APP_MAIN
{
TestSplitter().Run();
}

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,53 @@
#include "CtrlLib/CtrlLib.h"
using namespace Upp;
struct App : TopWindow {
TreeCtrl tree;
typedef App CLASSNAME;
void OpenDir(int id) {
String path = tree[id];
for(FindFile ff(AppendFileName(path, "*.*")); ff; ff.Next()) {
String n = ff.GetName();
if(n != "." && n != ".." && ff.IsFolder()) {
tree.Add(id, CtrlImg::Dir(),
AppendFileName(path, n), n, true);
}
}
// I expect to get the +/- sign removed if a folder does not contain other folders
// using the following code:
if (tree.GetChildCount(id) == 0)
{
TreeCtrl::Node node = tree.GetNode(id);
node.CanOpen(false);
tree.SetNode(id, node);
}
}
void CloseDir(int id) {
tree.RemoveChildren(id);
}
App() {
Add(tree.SizePos());
tree.WhenOpen = THISBACK(OpenDir);
tree.WhenClose = THISBACK(CloseDir);
String dir = "u:/upp.src";
tree.SetRoot(CtrlImg::Dir(), dir);
Sizeable();
}
};
GUI_APP_MAIN
{
App().Run();
}

View file

@ -0,0 +1,20 @@
#include <Core/Core.h>
using namespace Upp;
template <class T>
struct MyVector : public Vector<T> {
void Foo() {}
void Xmlize(XmlIO xml) {
Upp::Xmlize(xml, *this);
}
};
CONSOLE_APP_MAIN
{
MyVector<int> x;
x.Add(10);
DDUMP(StoreAsXML(x, "test"));
LOG("XXX");
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
XmlizeTest.cpp;
mainconfig
"" = "";

23
uppdev/tt/tt.cpp Normal file
View file

@ -0,0 +1,23 @@
#include <Core/Core.h>
using namespace Upp;
struct tt_char {
const char *s;
String ToString() const { return GetLngString(s); }
operator const char *() const { return ToString(); }
};
CONSOLE_APP_MAIN
{
static tt_char x[] = {
tt_("Aborted by user."),
tt_("Two"),
tt_("Three")
};
SetLanguage(LNG_('I','T','I','T'));
DDUMP(x[0]);
}

9
uppdev/tt/tt.upp Normal file
View file

@ -0,0 +1,9 @@
uses
Core;
file
tt.cpp;
mainconfig
"" = "";