summaryrefslogtreecommitdiff
path: root/src/test/w32dtst.cpp
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-03-24 02:09:13 +0000
committerIan C <ianc@noddybox.co.uk>2005-03-24 02:09:13 +0000
commit2d704117349864405f1c749b40bdd9d6f819ca03 (patch)
treef3b6c215db178fd94bd977ffd7c7961a243e6ee4 /src/test/w32dtst.cpp
parent5a11b5f4b59c46e919989a0fdd05d81ba5ac9347 (diff)
Code updates (first working version)
Diffstat (limited to 'src/test/w32dtst.cpp')
-rw-r--r--src/test/w32dtst.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp
index ca796db..984df33 100644
--- a/src/test/w32dtst.cpp
+++ b/src/test/w32dtst.cpp
@@ -27,14 +27,23 @@
class Test : public W32DLib::Dialog
{
public:
- Test() : //m_static(this,IDSTATIC1),
+ Test() : m_static(this,IDSTATIC1),
m_text(this,IDTEXT),
m_check(this,IDCHECK),
m_button(this,IDBUTTON),
m_quit(this,IDQUIT)
{
+ AddControl(&m_text);
+ AddControl(&m_check);
+ AddControl(&m_button);
+ AddControl(&m_quit);
+
+ m_button.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnButton));
m_quit.OnPress
(this,static_cast<W32DLib::W32DLibCallback>(&Test::OnQuit));
+ m_check.OnPress
+ (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnCheck));
}
virtual ~Test()
@@ -46,8 +55,16 @@ public:
return TESTDLG;
}
+ virtual void OnInit()
+ {
+ std::cout << "OnInit()" << std::endl;
+ m_text.SetText("Hello");
+ m_check.SetState(W32DLib::AutoCheck::eIndeterminate);
+ m_quit.Enable(true);
+ }
+
private:
- //W32DLib::StaticText m_static;
+ W32DLib::StaticText m_static;
W32DLib::Text m_text;
W32DLib::AutoCheck m_check;
W32DLib::Button m_button;
@@ -59,6 +76,29 @@ private:
Dialog::Close(IDOK);
return TRUE;
}
+
+ BOOL OnButton(UINT msg, WPARAM wp, LPARAM lp)
+ {
+ std::string txt=m_text.GetText(512);
+
+ std::cout << "Called OnButton()" << std::endl;
+ std::cout << "text=" << txt << std::endl;
+ std::cout << "check=" << m_check.GetState() << std::endl;
+ m_static.SetText(txt.c_str());
+ SetTitle((txt+" [Title]").c_str());
+ return TRUE;
+ }
+
+ BOOL OnCheck(UINT msg, WPARAM wp, LPARAM lp)
+ {
+ W32DLib::AutoCheck::EState state=m_check.GetState();
+
+ std::cout << "Called OnCheck() - state " << state << std::endl;
+
+ m_quit.Enable(state==W32DLib::AutoCheck::eChecked);
+
+ return TRUE;
+ }
};
int WINAPI WinMain (HINSTANCE hInstance,