diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/.cvsignore | 2 | ||||
-rw-r--r-- | src/test/GNUmakefile | 61 | ||||
-rw-r--r-- | src/test/dialog.h | 6 | ||||
-rw-r--r-- | src/test/dialog.rc | 14 | ||||
-rw-r--r-- | src/test/w32dtst.cpp | 84 |
5 files changed, 167 insertions, 0 deletions
diff --git a/src/test/.cvsignore b/src/test/.cvsignore new file mode 100644 index 0000000..0ad1fae --- /dev/null +++ b/src/test/.cvsignore @@ -0,0 +1,2 @@ +depend.mak
+w32dtst.exe
\ No newline at end of file diff --git a/src/test/GNUmakefile b/src/test/GNUmakefile new file mode 100644 index 0000000..97ca9c0 --- /dev/null +++ b/src/test/GNUmakefile @@ -0,0 +1,61 @@ +# w32dlib - Win32 Dialog Helpers +# +# Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# ------------------------------------------------------------------------- +# +# $Id: GNUmakefile,v 1.1 2005-03-24 00:07:40 ianc Exp $ +# + + +TARGET = w32dtst.exe + +SOURCES = w32dtst.cpp + +LIB = ../w32dlib.a + +RES = dialog + +OBJECTS = $(SOURCES:.cpp=.o) $(RES).o + +FLAGS = -I.. -Wall -L.. -g + +DEPEND = depend.mak + +$(TARGET): $(OBJECTS) $(LIB) + $(CXX) -o $(TARGET) $(FLAGS) $(OBJECTS) -mwindows -mconsole $(LIB) + +$(RES).o: $(RES).rc $(RES).h + windres -i $(RES).rc -o $(RES).o + + +%.o: %.cpp + $(CXX) -c $(FLAGS) $< -o $@ + +-include depend.mak + +clean: + -rm -f $(TARGET) $(OBJECTS) depend.mak + +depend: $(DEPEND) + +$(DEPEND): $(SOURCES) $(HEADERS) GNUMakefile + @echo Dependencies updated.... + $(CXX) -MM $(FLAGS) $(SOURCES) > $(DEPEND) + + +# END OF FILE diff --git a/src/test/dialog.h b/src/test/dialog.h new file mode 100644 index 0000000..d1dee42 --- /dev/null +++ b/src/test/dialog.h @@ -0,0 +1,6 @@ +#define TESTDLG 1 +#define IDSTATIC1 2 +#define IDTEXT 3 +#define IDBUTTON 4 +#define IDQUIT 5 +#define IDCHECK 6 diff --git a/src/test/dialog.rc b/src/test/dialog.rc new file mode 100644 index 0000000..5655da6 --- /dev/null +++ b/src/test/dialog.rc @@ -0,0 +1,14 @@ +#include <windows.h> +#include "dialog.h" + +TESTDLG DIALOG 10, 10, 240, 100 + STYLE WS_POPUP | WS_BORDER CAPTION + "Test Dialog" + FONT 8,"MS Shell Dlg" +{ + LTEXT "Text:", IDSTATIC1, 10, 10, 50, 12 + EDITTEXT IDTEXT, 50, 10, 100, 12 + PUSHBUTTON "Try Me!", IDBUTTON, 10, 30, 150, 18 + AUTOCHECKBOX "Check", IDCHECK, 10,50,150,18 + PUSHBUTTON "Quit", IDQUIT, 10,70,150,18 +} diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp new file mode 100644 index 0000000..ca796db --- /dev/null +++ b/src/test/w32dtst.cpp @@ -0,0 +1,84 @@ +// w32dlib - Win32 Control Helpers +// +// Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// ------------------------------------------------------------------------- +// +#include <w32dlib/w32dlib.h> +#include <iostream> +#include <string> + +#include "dialog.h" + +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) + { + m_quit.OnPress + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnQuit)); + } + + virtual ~Test() + { + } + + int ResourceID() + { + return TESTDLG; + } + +private: + //W32DLib::StaticText m_static; + W32DLib::Text m_text; + W32DLib::AutoCheck m_check; + W32DLib::Button m_button; + W32DLib::Button m_quit; + + BOOL OnQuit(UINT msg, WPARAM wp, LPARAM lp) + { + std::cout << "Called OnQuit()" << std::endl; + Dialog::Close(IDOK); + return TRUE; + } +}; + +int WINAPI WinMain (HINSTANCE hInstance, + HINSTANCE hPrevInstance, + PSTR szCmdLine, + int iCmdShow) +{ + Test t; + INT_PTR i; + + i=t.ShowModal(hInstance,NULL); + + if (i==IDOK) + { + std::cout << "res=IDOK" << std::endl; + } + else + { + std::cout << "res=" << i << std::endl; + } + + return 0; +} |