diff options
Diffstat (limited to 'src/test/w32dtst.cpp')
-rw-r--r-- | src/test/w32dtst.cpp | 79 |
1 files changed, 65 insertions, 14 deletions
diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp index c06c5ce..e3a55cf 100644 --- a/src/test/w32dtst.cpp +++ b/src/test/w32dtst.cpp @@ -29,19 +29,25 @@ class Test : public W32DLib::Dialog { public: - Test() : m_check_data(W32DLib::DataX::eBool) - , m_combo_data(W32DLib::DataX::eInt) - , m_text_data(W32DLib::DataX::eString) - , m_static(this,IDSTATIC1) + Test() : m_check_data(true) + , m_combo_data(2) + , m_text_data("Hello") + , m_radio1_data(true) + , m_radio2_data(false) + , m_radio3_data(false) + , m_static(this,IDSTATIC1,0) , m_text(this,IDTEXT,&m_text_data) , m_check(this,IDCHECK,&m_check_data) - , m_button(this,IDBUTTON) - , m_quit(this,IDQUIT) - , m_load(this,IDLOADTXT) - , m_loadbut(this,IDLOADBUT) - , m_save(this,IDSAVETXT) - , m_savebut(this,IDSAVEBUT) + , m_button(this,IDBUTTON,0) + , m_quit(this,IDQUIT,0) + , m_load(this,IDLOADTXT,0) + , m_loadbut(this,IDLOADBUT,0) + , m_save(this,IDSAVETXT,0) + , m_savebut(this,IDSAVEBUT,0) , m_combo(this,IDCOMBO,&m_combo_data) + , m_radio1(this,IDRADIO1,IDRADIO1,IDRADIO3,&m_radio1_data) + , m_radio2(this,IDRADIO2,IDRADIO1,IDRADIO3,&m_radio2_data) + , m_radio3(this,IDRADIO3,IDRADIO1,IDRADIO3,&m_radio3_data) { m_button.OnPress (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnButton)); @@ -65,6 +71,13 @@ public: m_combo.OnTextChanged (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnComboTxt)); + m_radio1.OnPress + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnRadio)); + m_radio2.OnPress + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnRadio)); + m_radio3.OnPress + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnRadio)); + SetMenuProc (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnMenu)); } @@ -95,14 +108,12 @@ public: std::cout << "HWND=" << m_combo.GetHWND() << std::endl; #ifdef DATAX_TEST - m_text_data.Set("Hello"); - m_check_data.Set(true); - m_combo_data.Set(2); SetData(); #else m_text.SetText("Hello"); m_check.SetState(W32DLib::AutoCheck::eChecked); m_combo.SelectedIndex(2); + m_radio1.SetState(); #endif } @@ -110,6 +121,9 @@ private: W32DLib::DataX m_check_data; W32DLib::DataX m_combo_data; W32DLib::DataX m_text_data; + W32DLib::DataX m_radio1_data; + W32DLib::DataX m_radio2_data; + W32DLib::DataX m_radio3_data; W32DLib::StaticText m_static; W32DLib::Text m_text; @@ -125,6 +139,10 @@ private: W32DLib::ComboBox m_combo; + W32DLib::RadioButton m_radio1; + W32DLib::RadioButton m_radio2; + W32DLib::RadioButton m_radio3; + std::string m_loadpath; std::string m_savepath; @@ -152,7 +170,18 @@ private: m_static.SetText(txt); SetText(txt+" [Title]"); m_combo.AddString(m_combo.GetText()); - m_text.AppendText(m_combo.GetText()+"\n"); + m_text.AppendText(m_combo.GetText()+"\r\n"); + +#ifdef DATAX_TEST + GetData(); + m_radio1_data.Set(false); + m_radio2_data.Set(true); + m_radio3_data.Set(false); + SetData(); +#else + m_radio2.SetState(); +#endif + return TRUE; } @@ -261,6 +290,28 @@ private: return TRUE; } + + BOOL OnRadio(UINT msg, WPARAM wp, LPARAM lp) + { +#ifdef DATAX_TEST + GetData(); + bool radio1=m_radio1_data.Bool(); + bool radio2=m_radio2_data.Bool(); + bool radio3=m_radio3_data.Bool(); +#else + bool radio1=m_radio1.GetState(); + bool radio2=m_radio2.GetState(); + bool radio3=m_radio3.GetState(); +#endif + + std::cout << "OnRadio" << std::endl; + + std::cout << "radio1=" << radio1 << std::endl; + std::cout << "radio2=" << radio2 << std::endl; + std::cout << "radio3=" << radio3 << std::endl; + + return TRUE; + } }; int WINAPI WinMain (HINSTANCE hInstance, |