From b286a613b6c48b5042b1b03047cbc99a2cf8f2f3 Mon Sep 17 00:00:00 2001 From: koldo Date: Fri, 19 Feb 2010 23:07:46 +0000 Subject: [PATCH] Timer test: First release git-svn-id: svn://ultimatepp.org/upp/trunk@2100 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/TimerTest/TimerTest.h | 25 +++++++++++++++++++++++++ bazaar/TimerTest/TimerTest.lay | 4 ++++ bazaar/TimerTest/TimerTest.upp | 12 ++++++++++++ bazaar/TimerTest/init | 5 +++++ bazaar/TimerTest/main.cpp | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 bazaar/TimerTest/TimerTest.h create mode 100644 bazaar/TimerTest/TimerTest.lay create mode 100644 bazaar/TimerTest/TimerTest.upp create mode 100644 bazaar/TimerTest/init create mode 100644 bazaar/TimerTest/main.cpp diff --git a/bazaar/TimerTest/TimerTest.h b/bazaar/TimerTest/TimerTest.h new file mode 100644 index 000000000..fb9899563 --- /dev/null +++ b/bazaar/TimerTest/TimerTest.h @@ -0,0 +1,25 @@ +#ifndef _TimerTest_TimerTest_h +#define _TimerTest_TimerTest_h + +#include + +using namespace Upp; + +#define LAYOUTFILE +#include + +#include + +class TimerTest : public WithLayout { +public: + typedef TimerTest CLASSNAME; + TimerTest(); + + void Info(const String & s); + void Test(); +private: + Timer t; +}; + +#endif + diff --git a/bazaar/TimerTest/TimerTest.lay b/bazaar/TimerTest/TimerTest.lay new file mode 100644 index 000000000..3a3775a67 --- /dev/null +++ b/bazaar/TimerTest/TimerTest.lay @@ -0,0 +1,4 @@ +LAYOUT(Layout, 200, 100) + ITEM(DocEdit, info, LeftPosZ(20, 160).TopPosZ(16, 76)) +END_LAYOUT + diff --git a/bazaar/TimerTest/TimerTest.upp b/bazaar/TimerTest/TimerTest.upp new file mode 100644 index 000000000..a7f46d125 --- /dev/null +++ b/bazaar/TimerTest/TimerTest.upp @@ -0,0 +1,12 @@ +uses + CtrlLib, + Timer; + +file + TimerTest.h, + main.cpp, + TimerTest.lay; + +mainconfig + "" = "GUI MT"; + diff --git a/bazaar/TimerTest/init b/bazaar/TimerTest/init new file mode 100644 index 000000000..bb43969d5 --- /dev/null +++ b/bazaar/TimerTest/init @@ -0,0 +1,5 @@ +#ifndef _TimerTest_icpp_init_stub +#define _TimerTest_icpp_init_stub +#include "CtrlLib/init" +#include "Timer/init" +#endif diff --git a/bazaar/TimerTest/main.cpp b/bazaar/TimerTest/main.cpp new file mode 100644 index 000000000..b0447e105 --- /dev/null +++ b/bazaar/TimerTest/main.cpp @@ -0,0 +1,34 @@ +#include "TimerTest.h" + +#define REPEAT_TEST + +TimerTest::TimerTest() +{ + CtrlLayout(*this, "Window title"); +#ifdef REPEAT_TEST + t.SetTimeCallback(-1000, THISBACK(Test), 0); +#else + PostCallback(THISBACK(Test)); +#endif +} + +void TimerTest::Info(const String & s) +{ + info.Insert(info.GetLength(), s); + info.SetCursor(info.GetLength()); +} + +void TimerTest::Test() +{ + Info("O"); +#ifdef REPEAT_TEST +#else + t.SetTimeCallback(1000, THISBACK(Test), 0); +#endif +} + +GUI_APP_MAIN +{ + TimerTest().Run(); +} +