diff options
Diffstat (limited to 'src/test/w32dtst.cpp')
-rw-r--r-- | src/test/w32dtst.cpp | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp index 6ce87d1..5f14a6d 100644 --- a/src/test/w32dtst.cpp +++ b/src/test/w32dtst.cpp @@ -27,16 +27,24 @@ class Test : public W32DLib::Dialog { public: - Test() : m_static(this,IDSTATIC1), - m_text(this,IDTEXT), - m_check(this,IDCHECK), - m_button(this,IDBUTTON), - m_quit(this,IDQUIT) + Test() : m_static(this,IDSTATIC1) + , m_text(this,IDTEXT) + , m_check(this,IDCHECK) + , m_button(this,IDBUTTON) + , m_quit(this,IDQUIT) + , m_load(this,IDLOADTXT) + , m_loadbut(this,IDLOADBUT) + , m_save(this,IDSAVETXT) + , m_savebut(this,IDSAVEBUT) { AddControl(&m_text); AddControl(&m_check); AddControl(&m_button); AddControl(&m_quit); + AddControl(&m_load); + AddControl(&m_loadbut); + AddControl(&m_save); + AddControl(&m_savebut); m_button.OnPress (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnButton)); @@ -44,6 +52,11 @@ public: (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnQuit)); m_check.OnPress (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnCheck)); + + m_loadbut.OnPress + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnLoad)); + m_savebut.OnPress + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnSave)); } virtual ~Test() @@ -70,6 +83,15 @@ private: W32DLib::Button m_button; W32DLib::Button m_quit; + W32DLib::Text m_load; + W32DLib::Button m_loadbut; + + W32DLib::Text m_save; + W32DLib::Button m_savebut; + + std::string m_loadpath; + std::string m_savepath; + BOOL OnQuit(UINT msg, WPARAM wp, LPARAM lp) { std::cout << "Called OnQuit()" << std::endl; @@ -95,8 +117,33 @@ private: std::cout << "Called OnCheck() - state " << state << std::endl; - //m_quit.Enable(state==W32DLib::AutoCheck::eChecked); - Enable(state==W32DLib::AutoCheck::eChecked); + m_quit.Enable(state==W32DLib::AutoCheck::eChecked); + + return TRUE; + } + + BOOL OnLoad(UINT msg, WPARAM wp, LPARAM lp) + { + if (W32DLib::Common::OpenFile(this->GetHWND(), + "Select file to open", + m_loadpath, + "CPP Files\0*.cpp\0Any File\0*.*\0")) + { + m_load.SetText(m_loadpath.c_str()); + } + + return TRUE; + } + + BOOL OnSave(UINT msg, WPARAM wp, LPARAM lp) + { + if (W32DLib::Common::SaveFile(this->GetHWND(), + "Select file to save", + m_savepath, + NULL)) + { + m_save.SetText(m_savepath.c_str()); + } return TRUE; } |