template "U++ CtrlLib application with main window" main; id "Main window class name" classname = PACKAGE; select("No layouts", "Generate layout file", "Main window has layout", "Main window has OK/Cancel") "Layout" lay = 2; option "Imagelist file" iml; @@<:PACKAGE:>.h #ifndef _<:PACKAGE:>_<:PACKAGE:>_h #define _<:PACKAGE:>_<:PACKAGE:>_h #include using namespace Upp;<:?lay:> #define LAYOUTFILE <<:PACKAGE:>/<:PACKAGE:>.lay> #include <:.:><:?iml:> #define IMAGEFILE <<:PACKAGE:>/<:PACKAGE:>.iml> #include <:.:> class <:classname:> : public <:lay > 1 ? "With" + classname + "Layout" : "TopWindow":> { public: <:classname:>(); }; #endif @@main.cpp #include "<:PACKAGE:>.h"<:?iml:> #define IMAGEFILE <<:PACKAGE:>/<:PACKAGE:>.iml> #include <:.:> <:classname:>::<:classname:>() {<:?lay > 1:> CtrlLayout<:(lay == 3 ? "OKCancel" : ""):>(*this, "Window title");<:.:> } GUI_APP_MAIN { <:classname:>().Run(); } @@<:PACKAGE:>.lay ??lay LAYOUT(<:classname:>Layout, 200, 100)<:?lay == 3:> ITEM(Button, ok, SetLabel("OK").RightPosZ(90, 80).BottomPosZ(4, 22)) ITEM(Button, cancel, SetLabel("Cancel").RightPosZ(4, 80).BottomPosZ(4, 22))<:.:> END_LAYOUT @@<:PACKAGE:>.iml ??iml @@<:PACKAGE:>.upp uses CtrlLib; file <:PACKAGE:>.h, main.cpp<:?lay:>, <:PACKAGE:>.lay<:.:><:?iml:>, <:PACKAGE:>.iml<:.:>; mainconfig "" = "GUI";