summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/dialog.h6
-rw-r--r--src/test/dialog.rc8
-rw-r--r--src/test/w32dtst.cpp61
3 files changed, 67 insertions, 8 deletions
diff --git a/src/test/dialog.h b/src/test/dialog.h
index d1dee42..ac47a4e 100644
--- a/src/test/dialog.h
+++ b/src/test/dialog.h
@@ -4,3 +4,9 @@
#define IDBUTTON 4
#define IDQUIT 5
#define IDCHECK 6
+#define IDLOADTXT 7
+#define IDLOADBUT 8
+#define IDSAVETXT 9
+#define IDSAVEBUT 10
+#define IDDIRTXT 11
+#define IDDIRBUT 12
diff --git a/src/test/dialog.rc b/src/test/dialog.rc
index cae59bb..27f1ea6 100644
--- a/src/test/dialog.rc
+++ b/src/test/dialog.rc
@@ -1,7 +1,7 @@
#include <windows.h>
#include "dialog.h"
-TESTDLG DIALOG 10, 10, 240, 100
+TESTDLG DIALOG 10, 10, 240, 180
STYLE WS_POPUP | WS_BORDER CAPTION
"Test Dialog"
FONT 8,"MS Shell Dlg"
@@ -11,4 +11,10 @@ TESTDLG DIALOG 10, 10, 240, 100
PUSHBUTTON "Try Me!", IDBUTTON, 10, 30, 150, 18
AUTOCHECKBOX "Check", IDCHECK, 10,50,150,18
PUSHBUTTON "Quit", IDQUIT, 10,70,150,18
+
+ EDITTEXT IDLOADTXT, 10, 100, 200, 12
+ PUSHBUTTON "Load ...",IDLOADBUT, 10, 115, 100, 18
+
+ EDITTEXT IDSAVETXT, 10, 140, 200, 12
+ PUSHBUTTON "Save ...",IDSAVEBUT, 10, 155, 100, 18
}
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;
}