ultimatepp/uppsrc/Turtle/Complex.upt
oblivion cd6fcc35c5 Turtle: Project templates are updated. (CLASSNAME declaration is removed)
git-svn-id: svn://ultimatepp.org/upp/trunk@15252 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2020-10-14 23:12:17 +00:00

117 lines
2.3 KiB
Text

template "U++ Turtle 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;
text "Server URL" host = "localhost";
text "Connection port" port = "8888";
text "Connection limit" limit = "100";
option "Debug mode" debugmode;
option "Add GUI mode switch" guiflag;
@@<:PACKAGE:>.h
#ifndef _<:PACKAGE:>_<:PACKAGE:>_h
#define _<:PACKAGE:>_<:PACKAGE:>_h
<:?guiflag:>
#ifdef flagTURTLEGUI
#include <Turtle/Turtle.h>
#else
#include <CtrlLib/CtrlLib.h>
#endif
<:/:>
#include <Turtle/Turtle.h>
<:.:>
namespace Upp {<:?lay:>
#define LAYOUTFILE <<:PACKAGE:>/<:PACKAGE:>.lay>
#include <CtrlCore/lay.h><:.:><:?iml:>
#define IMAGEFILE <<:PACKAGE:>/<:PACKAGE:>.iml>
#include <Draw/iml_header.h><:.:>
class <:classname:> : public <:lay > 1 ? "With" + classname + "Layout<TopWindow>" : "TopWindow":> {
public:
<:classname:>();
};
}
#endif
@@main.cpp
#include "<:PACKAGE:>.h"<:?iml:>
#define IMAGEFILE <<:PACKAGE:>/<:PACKAGE:>.iml>
#include <Draw/iml_source.h><:.:>
using namespace Upp;
<:classname:>::<:classname:>()
{<:?lay > 1:>
CtrlLayout<:(lay == 3 ? "OKCancel" : ""):>(*this, "Window title");<:.:>
}
void AppMainLoop()
{
// "Main" stuff should go in here...
<:classname:>().Run();
}
<:?guiflag:>
#ifdef flagTURTLEGUI
<:.:>
CONSOLE_APP_MAIN
{
<:?debugmode:>
#ifdef _DEBUG
TurtleServer::DebugMode();
#endif
<:.:>
// MemoryLimitKb(100000000); // Can aid preventing DDoS attacks.
TurtleServer guiserver;
guiserver.Host("<:host:>");
guiserver.Port(<:port:>);
guiserver.MaxConnections(<:limit:>);
RunTurtleGui(guiserver, AppMainLoop);
}
<:?guiflag:>
#else
GUI_APP_MAIN
{
AppMainLoop();
}
#endif
<:.:>
@@<: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
<:?guiflag:>
uses (TURTLEGUI) Turtle;
uses (!TURTLEGUI) CtrlLib;
<:/:>
uses Turtle;
<:.:>
file
<:PACKAGE:>.h,
main.cpp<:?lay:>,
<:PACKAGE:>.lay<:.:><:?iml:>,
<:PACKAGE:>.iml<:.:>;
mainconfig
"" = "TURTLEGUI"<:?guiflag:>,<:/:>;<:.:>
<:?guiflag:>"" = "GUI";<:.:>