summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/dialog.rc2
-rw-r--r--src/test/w32dtst.cpp44
2 files changed, 43 insertions, 3 deletions
diff --git a/src/test/dialog.rc b/src/test/dialog.rc
index 5655da6..cae59bb 100644
--- a/src/test/dialog.rc
+++ b/src/test/dialog.rc
@@ -6,7 +6,7 @@ TESTDLG DIALOG 10, 10, 240, 100
"Test Dialog"
FONT 8,"MS Shell Dlg"
{
- LTEXT "Text:", IDSTATIC1, 10, 10, 50, 12
+ LTEXT "Text:", IDSTATIC1, 10, 10, 35, 12
EDITTEXT IDTEXT, 50, 10, 100, 12
PUSHBUTTON "Try Me!", IDBUTTON, 10, 30, 150, 18
AUTOCHECKBOX "Check", IDCHECK, 10,50,150,18
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,