diff options
Diffstat (limited to 'src/test/w32dtst.cpp')
-rw-r--r-- | src/test/w32dtst.cpp | 44 |
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, |