diff --git a/uppdev/UppTest/UppTest.dli b/uppdev/UppTest/UppTest.dli new file mode 100644 index 000000000..0a28f3cdb --- /dev/null +++ b/uppdev/UppTest/UppTest.dli @@ -0,0 +1,4 @@ +FN(int, Init, (XDisplay *display)) +FN(void, UnInit, ()) +FN(int, IsInitted, ()) +FN(void, DrawCode, (Drawable drawable, int cx, int cy)) \ No newline at end of file diff --git a/uppdev/UppTest/UppTest.h b/uppdev/UppTest/UppTest.h new file mode 100644 index 000000000..cc81093cc --- /dev/null +++ b/uppdev/UppTest/UppTest.h @@ -0,0 +1,20 @@ +#ifndef _UppTest_UppTest_h +#define _UppTest_UppTest_h + +#include + +using namespace Upp; + +#define LAYOUTFILE +#include + +class UppTest : public WithUppTestLayout { +public: + typedef UppTest CLASSNAME; + UppTest(); + void Paint(Draw&); + virtual ~UppTest(); +}; + +#endif + diff --git a/uppdev/UppTest/UppTest.lay b/uppdev/UppTest/UppTest.lay new file mode 100644 index 000000000..42e35070b --- /dev/null +++ b/uppdev/UppTest/UppTest.lay @@ -0,0 +1,3 @@ +LAYOUT(UppTestLayout, 220, 132) +END_LAYOUT + diff --git a/uppdev/UppTest/UppTest.upp b/uppdev/UppTest/UppTest.upp new file mode 100644 index 000000000..28557ff42 --- /dev/null +++ b/uppdev/UppTest/UppTest.upp @@ -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"; + diff --git a/uppdev/UppTest/init b/uppdev/UppTest/init new file mode 100644 index 000000000..f19bdb773 --- /dev/null +++ b/uppdev/UppTest/init @@ -0,0 +1,4 @@ +#ifndef _UppTest_icpp_init_stub +#define _UppTest_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/uppdev/Utf8/Utf8.cpp b/uppdev/Utf8/Utf8.cpp new file mode 100644 index 000000000..fe17d5c39 --- /dev/null +++ b/uppdev/Utf8/Utf8.cpp @@ -0,0 +1,38 @@ +#include + +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(); +} + diff --git a/uppdev/Utf8/Utf8.upp b/uppdev/Utf8/Utf8.upp new file mode 100644 index 000000000..44ccbdd2c --- /dev/null +++ b/uppdev/Utf8/Utf8.upp @@ -0,0 +1,10 @@ +uses + Core, + CtrlLib; + +file + Utf8.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/Utf8/init b/uppdev/Utf8/init new file mode 100644 index 000000000..0d7e7f5d5 --- /dev/null +++ b/uppdev/Utf8/init @@ -0,0 +1,5 @@ +#ifndef _Utf8_icpp_init_stub +#define _Utf8_icpp_init_stub +#include "Core/init" +#include "CtrlLib/init" +#endif diff --git a/uppdev/X11MinMax/X11MinMax.upp b/uppdev/X11MinMax/X11MinMax.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/uppdev/X11MinMax/X11MinMax.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/X11MinMax/main.cpp b/uppdev/X11MinMax/main.cpp new file mode 100644 index 000000000..76e342076 --- /dev/null +++ b/uppdev/X11MinMax/main.cpp @@ -0,0 +1,65 @@ +#include + +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); +} +