git-svn-id: svn://ultimatepp.org/upp/trunk@2939 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-12-27 18:16:54 +00:00
parent 9bf4c10a44
commit 096cffa57c
10 changed files with 175 additions and 0 deletions

View file

@ -0,0 +1,4 @@
FN(int, Init, (XDisplay *display))
FN(void, UnInit, ())
FN(int, IsInitted, ())
FN(void, DrawCode, (Drawable drawable, int cx, int cy))

20
uppdev/UppTest/UppTest.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef _UppTest_UppTest_h
#define _UppTest_UppTest_h
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <UppTest/UppTest.lay>
#include <CtrlCore/lay.h>
class UppTest : public WithUppTestLayout<TopWindow> {
public:
typedef UppTest CLASSNAME;
UppTest();
void Paint(Draw&);
virtual ~UppTest();
};
#endif

View file

@ -0,0 +1,3 @@
LAYOUT(UppTestLayout, 220, 132)
END_LAYOUT

View file

@ -0,0 +1,17 @@
uses
CtrlLib;
target(!DEBUG) upp_exe;
target(DEBUG) upp_debug_exe;
file
UppTest.h,
main.cpp,
UppTest.dli,
UppTest.lay;
mainconfig
"" = "GUI NOGTK",
"" = "GUI USEMALLOC NOGTK";

4
uppdev/UppTest/init Normal file
View file

@ -0,0 +1,4 @@
#ifndef _UppTest_icpp_init_stub
#define _UppTest_icpp_init_stub
#include "CtrlLib/init"
#endif

38
uppdev/Utf8/Utf8.cpp Normal file
View file

@ -0,0 +1,38 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct TestWindow : TopWindow {
WString wtext;
String text;
virtual void Paint(Draw& w) {
w.DrawRect(GetSize(), White);
w.DrawText(10, 10, wtext);
w.DrawText(10, 50, text);
w.DrawText(100, 100, "Hello!");
}
};
GUI_APP_MAIN
{
WString x = FromUtf8(LoadFile(GetHomeDirFile("aaa")));
DDUMP(FormatIntHex(x[0]));
DDUMP(x.GetCount());
LOGHEXDUMP(~x, 2 * x.GetCount());
String h = ToUtf8(x);
LOGHEXDUMP(~h, h.GetCount());
SaveFile(GetHomeDirFile("aaa.1"), h);
TestWindow w;
w.text = h;
w.wtext = x;
// w.Run();
LineEdit le;
le.Set(x);
w.Add(le.SizePos());
w.Run();
}

10
uppdev/Utf8/Utf8.upp Normal file
View file

@ -0,0 +1,10 @@
uses
Core,
CtrlLib;
file
Utf8.cpp;
mainconfig
"" = "GUI";

5
uppdev/Utf8/init Normal file
View file

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

View file

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

65
uppdev/X11MinMax/main.cpp Normal file
View file

@ -0,0 +1,65 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct MyApp : public TopWindow
{
TimeCallback cb;
void Back() {
LOG("Back");
Overlap();
}
virtual bool Key(dword key, int) {
if(key == K_CTRL_M)
Maximize();
if(key == K_CTRL_N) {
Minimize();
cb.Set(2000, THISBACK(Back));
}
if(key == K_CTRL_B)
Overlap();
if(key == K_CTRL_F)
FullScreen(!IsFullScreen());
return false;
}
virtual void Paint(Draw& w) {
w.DrawRect(GetSize(), White());
if(IsMaximized())
w.DrawText(0, 0, "Maximized!");
else
if(IsMinimized())
w.DrawText(0, 0, "Minimized!");
}
void Sync() {
if(IsMaximized())
Title("Maximized!");
else
if(IsMinimized())
Title("Minimized!");
else
Title("Normal");
}
typedef MyApp CLASSNAME;
void Serialize(Stream& s)
{
SerializePlacement(s, true);
}
MyApp() {
Sizeable().Zoomable();
SetTimeCallback(-100, THISBACK(Sync));
}
};
GUI_APP_MAIN
{
MyApp app;
LoadFromFile(app);
app.Run();
StoreToFile(app);
}