diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GNUmakefile | 89 | ||||
-rw-r--r-- | src/autocheck.cpp | 74 | ||||
-rw-r--r-- | src/button.cpp | 55 | ||||
-rw-r--r-- | src/common.cpp | 112 | ||||
-rw-r--r-- | src/control.cpp | 118 | ||||
-rw-r--r-- | src/dialog.cpp | 153 | ||||
-rw-r--r-- | src/text.cpp | 45 | ||||
-rw-r--r-- | src/w32dlib/Doxyfile | 254 | ||||
-rw-r--r-- | src/w32dlib/autocheck.h | 92 | ||||
-rw-r--r-- | src/w32dlib/base.h | 39 | ||||
-rw-r--r-- | src/w32dlib/button.h | 65 | ||||
-rw-r--r-- | src/w32dlib/common.h | 110 | ||||
-rw-r--r-- | src/w32dlib/control.h | 111 | ||||
-rw-r--r-- | src/w32dlib/dialog.h | 128 | ||||
-rw-r--r-- | src/w32dlib/text.h | 59 | ||||
-rw-r--r-- | src/w32dlib/w32dlib.h | 34 |
16 files changed, 1538 insertions, 0 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile new file mode 100644 index 0000000..a1cbcfb --- /dev/null +++ b/src/GNUmakefile @@ -0,0 +1,89 @@ +# 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-22 01:43:54 ianc Exp $ +# + + +# **************************************** START OF CONFIGURATION +# + +# The directory to install the built library, headers and docs into. +# *** NB: USE FORWARD SLASHES *** +# +INSTALLDIR = C:/w32dlib + +# Set this to one to generate a wd32lib-config and copy it to /usr/local/bin +# when installing. +# +CREATECONF = 1 + +# +# **************************************** END OF CONFIGURATION + + +# Do not change past here. +# Well, unless something doesn't work of course... +# +TARGET = w32dlib.a + +SOURCES = autocheck.cpp \ + button.cpp \ + common.cpp \ + control.cpp \ + dialog.cpp \ + text.cpp + +HEADERS = w32dlib/*.h + +OBJECTS = $(SOURCES:.cpp=.o) + +FLAGS = -I. # -Wall + +DEPEND = depend.mak + +DOCDIR = ../doc + + +$(TARGET): depend $(OBJECTS) GNUMakefile + ar rcusv $(TARGET) $(OBJECTS) + +doc: $(DOCDIR)/html/index.html + +$(DOCDIR)/html/index.html: $(HEADERS) + -rm -rf $(DOCDIR)/* + cd w32dlib ; doxygen + +%.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/autocheck.cpp b/src/autocheck.cpp new file mode 100644 index 0000000..dfa1bf5 --- /dev/null +++ b/src/autocheck.cpp @@ -0,0 +1,74 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +// $Log$ +// +#include "w32dlib/autocheck.h" +#include "w32dlib/dialog.h" + +namespace W32DLib +{ + + +// ------------------------------------------------------------ +// +AutoCheck::AutoCheck(Dialog *parent, int resource_id) : + Control(parent,resource_id) +{ +} + + +// ------------------------------------------------------------ +// +AutoCheck::~AutoCheck() +{ +} + + +// ------------------------------------------------------------ +// +void AutoCheck::OnPress(W32DLibCallback callback) +{ + m_parent->AddCallback(WM_COMMAND,callback); +} + + +// ------------------------------------------------------------ +// +void AutoCheck::SetState(EState state) +{ + CheckDlgButton(m_parent->GetHWND(), + m_resid, + static_cast<UINT>(state)); +} + + +// ------------------------------------------------------------ +// +AutoCheck::EState AutoCheck::GetState() +{ + return static_cast<EState>(IsDlgButtonChecked(m_parent->GetHWND(),m_resid)); +} + +}; // namespace W32DLib + + + +// END OF FILE diff --git a/src/button.cpp b/src/button.cpp new file mode 100644 index 0000000..047d9d6 --- /dev/null +++ b/src/button.cpp @@ -0,0 +1,55 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +// $Log$ +// + +#include "w32dlib/button.h" +#include "w32dlib/dialog.h" + +namespace W32DLib +{ + +// ------------------------------------------------------------ +// +Button::Button(Dialog *parent, int resource_id) : + Control(parent,resource_id) +{ +} + + +// ------------------------------------------------------------ +// +Button::~Button() +{ +} + + +// ------------------------------------------------------------ +// +void Button::OnPress(W32DLibCallback callback) +{ + Dialog::AddCallback(WM_COMMAND,callback); +} + + +}; // namespace W32DLib + +// END OF FILE diff --git a/src/common.cpp b/src/common.cpp new file mode 100644 index 0000000..a096fe6 --- /dev/null +++ b/src/common.cpp @@ -0,0 +1,112 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +// $Log$ +// +#include "w32dlib/common.h" + +namespace W32DLib +{ + +// ------------------------------------------------------------ +// +void Common::Message(HWND parent, const char *msg) +{ + ::MessageBox(parent,msg,"Message",MB_ICONINFORMATION|MB_OK); +} + + +// ------------------------------------------------------------ +// +void Common::Error(HWND parent, const char *msg) +{ + ::MessageBox(parent,msg,"Error",MB_ICONSTOP|MB_OK); +} + + +// ------------------------------------------------------------ +// +bool Common::Query(HWND parent, const char *msg) +{ + return ::MessageBox(parent,msg,"Question",MB_ICONQUESTION|MB_YESNO)==IDOK; +} + + +// ------------------------------------------------------------ +// +std::string OpenFile(const char *filter) +{ + return std::string(); +} + + +// ------------------------------------------------------------ +// +std::string SaveFile(const char *filter) +{ + return std::string(); +} + + +// ------------------------------------------------------------ +// +std::string SelectDirectory() +{ + return std::string(); +} + + +// ------------------------------------------------------------ +// +std::string Common::GetOSError() +{ + std::string res; + LPVOID msg; + DWORD dw=GetLastError(); + + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &msg, + 0, NULL ); + + res=static_cast<char*>(msg); + + LocalFree(msg); + + return res; +} + + +// ------------------------------------------------------------ +// +HINSTANCE Common::GetInstance() +{ + MEMORY_BASIC_INFORMATION mbi; + VirtualQuery((void *)GetInstance, &mbi, sizeof(mbi)); + return (HINSTANCE)mbi.AllocationBase; +} + + +}; // namespace W32DLib + +// END OF FILE diff --git a/src/control.cpp b/src/control.cpp new file mode 100644 index 0000000..abcf8fb --- /dev/null +++ b/src/control.cpp @@ -0,0 +1,118 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +// $Log$ +// +#include "w32dlib/control.h" +#include "w32dlib/dialog.h" + +namespace W32DLib +{ + + +// ------------------------------------------------------------ +// +Control::Control(Dialog *parent, int resource_id) : + m_parent(parent), + m_resid(resource_id), + m_cblist() +{ +} + + +// ------------------------------------------------------------ +// +Control::~Control() +{ +} + + +// ------------------------------------------------------------ +// +int Control::ResourceID() +{ + return m_resid; +} + + +// ------------------------------------------------------------ +// +void Control::SetText(const char *text) +{ +} + + +// ------------------------------------------------------------ +// +std::string Control::GetText(int maxlen) +{ + char *buff=new char[maxlen+1]; + std::string res; + + if (GetDlgItemText(m_parent->GetHWND(),m_resid,buff,maxlen)) + { + res=buff; + } + + delete[] buff; + + return res; +} + + +// ------------------------------------------------------------ +// +BOOL Control::ProcessMessage(UINT msg, WPARAM wp, LPARAM lp) +{ + if (m_cblist.count(msg)>0) + { + W32DLibCallback cb=m_cblist[msg]; + + if (cb) + { + return cb(msg,wp,lp); + } + } + + return false; +} + + +// ------------------------------------------------------------ +// +void Control::AddCallback(UINT msg, W32DLibCallback callback) +{ + if (callback) + { + m_cblist[msg]=callback; + } + else + { + if (m_cblist.count(msg)) + { + m_cblist.remove(msg); + } + } +} + + +}; // namespace W32DLib + +// END OF FILE diff --git a/src/dialog.cpp b/src/dialog.cpp new file mode 100644 index 0000000..75b7e04 --- /dev/null +++ b/src/dialog.cpp @@ -0,0 +1,153 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +// $Log$ +// +#include "w32dlib/dialog.h" +#include "w32dlib/control.h" + +namespace W32DLib +{ +// ------------------------------------------------------------ +// +Dialog::ProcSet Dialog::m_procset; + + +// ------------------------------------------------------------ +// +Dialog::Dialog() +{ +} + + +// ------------------------------------------------------------ +// +Dialog::~Dialog() +{ +} + + +// ------------------------------------------------------------ +// +void Dialog::OnInit() +{ +} + + +// ------------------------------------------------------------ +// +void Dialog::OnClose() +{ +} + + +// ------------------------------------------------------------ +// +HWND Dialog::GetHWND() +{ + return m_wnd; +} + + +// ------------------------------------------------------------ +// +INT_PTR Dialog::ShowModal(HINSTANCE inst, HWND parent) +{ + return ::DialogBox(inst, + MAKEINTRESOURCE(ResourceID()), + NULL, + &this->DialogProc); +} + + +// ------------------------------------------------------------ +// +void Dialog::Close(INT_PTR result) +{ + EndDialog(m_wnd,result); +} + + +// ------------------------------------------------------------ +// +void Dialog::AddControl(Control *control) +{ + m_cset.push_back(control); +} + + +// ------------------------------------------------------------ +// + +BOOL Dialog::InstanceDialogProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) +{ + BOOL ret=FALSE; + WORD lo=LOWORD(wp); + + switch(msg) + { + case WM_INITDIALOG: + m_wnd=wnd; + m_procset[wnd]=this; + OnInit(); + break; + + case WM_CLOSE: + OnClose(); + m_procset.erase(wnd); + break; + + case WM_COMMAND: + for(ControlSet::iterator i=m_cset.begin();i!=m_cset.end();++i) + { + if (lo==(*i)->ResourceID()) + { + ret=(*i)->ProcessMessage(msg,wp,lp); + break; + } + } + break; + + default: + break; + } + + return ret; +} + +// ------------------------------------------------------------ +// + +BOOL CALLBACK Dialog::DialogProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) +{ + if (m_procset.count(wnd)) + { + return m_procset[wnd]->InstanceDialogProc(wnd,msg,wp,lp); + } + else + { + return FALSE; + } +} + + +}; // namespace w32dlib + +// END OF FILE diff --git a/src/text.cpp b/src/text.cpp new file mode 100644 index 0000000..8f8d1eb --- /dev/null +++ b/src/text.cpp @@ -0,0 +1,45 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +// $Log$ +// +#include "w32dlib/text.h" + +namespace W32DLib +{ + +// ------------------------------------------------------------ +// +Text::Text(Dialog *parent, int resource_id) : + Control(parent,resource_id) +{ +} + + +// ------------------------------------------------------------ +// +Text::~Text() +{ +} + + +}; // namespace W32DLib + +// END OF FILE diff --git a/src/w32dlib/Doxyfile b/src/w32dlib/Doxyfile new file mode 100644 index 0000000..55febc5 --- /dev/null +++ b/src/w32dlib/Doxyfile @@ -0,0 +1,254 @@ +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = W32DLib +PROJECT_NUMBER = +OUTPUT_DIRECTORY = ../../doc +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = .. +STRIP_FROM_INC_PATH = .. +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = . +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/src/w32dlib/autocheck.h b/src/w32dlib/autocheck.h new file mode 100644 index 0000000..0246c03 --- /dev/null +++ b/src/w32dlib/autocheck.h @@ -0,0 +1,92 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_AUTOCHECK_H + +#define W32DLIB_AUTOCHECK_H "$Id$" + +#include "w32dlib/base.h" +#include "w32dlib/control.h" + +namespace W32DLib +{ + + /// \brief The AutoCheck class. + /// + class AutoCheck : public Control + { + public: + + /// \brief Describes the checkstate + /// + enum EState + { + eError =0, ///< Error getting state + eChecked =BST_CHECKED, ///< Checked + eUnchecked =BST_UNCHECKED, ///< Unchecked + eIndeterminate =BST_INDETERMINATE ///< Indeterminate + }; + + /// \brief Constructor + /// + /// \param parent The dialog the control belongs to. + /// \param resource_id The ID of the control in the resource file. + /// + AutoCheck(Dialog *parent, int resource_id); + + /// \brief Destructor + /// + virtual ~AutoCheck(); + + + /// \brief Sets a callback for a button press + /// + /// \param callback The callback. Set to NULL to clear the callback. + /// + void OnPress(W32DLibCallback callback); + + + /// \brief Sets the tickstate. + /// + /// \param state The tick state + /// \sa GetState() + /// + void SetState(EState state); + + + /// \brief Gets the tickstate. + /// + /// \return The tick state + /// \sa SetState() + /// + EState GetState(); + + protected: + + private: + + }; // class AutoCheck + +}; // namespace w32dlib + +#endif // W32DLIB_AUTOCHECK_H + + +// END OF FILE diff --git a/src/w32dlib/base.h b/src/w32dlib/base.h new file mode 100644 index 0000000..5dfcbfc --- /dev/null +++ b/src/w32dlib/base.h @@ -0,0 +1,39 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_BASE_H + +#define W32DLIB_BASE_H "$Id$" + +#include <windows.h> +#include <vector> +#include <map> +#include <string> + +namespace W32DLib +{ +class Dialog; +class Control; +}; + +#endif // W32DLIB_BASE_H + + +// END OF FILE diff --git a/src/w32dlib/button.h b/src/w32dlib/button.h new file mode 100644 index 0000000..0ab0b8d --- /dev/null +++ b/src/w32dlib/button.h @@ -0,0 +1,65 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_BUTTON_H + +#define W32DLIB_BUTTON_H "$Id$" + +#include "w32dlib/base.h" +#include "w32dlib/control.h" + +namespace W32DLib +{ + + /// \brief The Button class. + /// + class Button : public Control + { + public: + + /// \brief Constructor + /// + /// \param parent The dialog the control belongs to. + /// \param resource_id The ID of the control in the resource file. + /// + Button(Dialog *parent, int resource_id); + + /// \brief Destructor + /// + virtual ~Button(); + + /// \brief Sets a callback for a button press + /// + /// \param callback The callback. Set to NULL to clear the callback. + /// + void OnPress(W32DLibCallback callback); + + protected: + + private: + + }; // class Button + +}; // namespace w32dlib + +#endif // W32DLIB_BUTTON_H + + +// END OF FILE diff --git a/src/w32dlib/common.h b/src/w32dlib/common.h new file mode 100644 index 0000000..004d81f --- /dev/null +++ b/src/w32dlib/common.h @@ -0,0 +1,110 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_COMMON_H + +#define W32DLIB_COMMON_H "$Id$" + +#include "w32dlib/base.h" + +namespace W32DLib +{ + + /// \brief The Common class. + /// + /// This class provides common dialogs and useful routines. + /// + class Common + { + public: + + /// \brief Displays a message box. + /// + /// \param parent Parent window (NULL for none) + /// \param msg The message to display. + /// + static void Message(HWND parent, const char *msg); + + + /// \brief Displays an error message box. + /// + /// \param parent Parent window (NULL for none) + /// \param msg The error message to display. + /// + static void Error(HWND parent, const char *msg); + + + /// \brief Displays a Yes/No message box. + /// + /// \param parent Parent window (NULL for none) + /// \param msg The message to display. + /// \return True if the user selects Yes. + /// + static bool Query(HWND parent, const char *msg); + + + /// \brief Requests a file to open. + /// + /// \param filter The file selector filter. + /// \return The path, or an empty string if non selected. + /// + static std::string OpenFile(const char *filter); + + + /// \brief Requests a file to save. + /// + /// \param filter The file selector filter. + /// \return The path, or an empty string if non selected. + /// + static std::string SaveFile(const char *filter); + + + /// \brief Selects a directory + /// + /// \return The path, or an empty string if non selected. + /// + static std::string SelectDirectory(); + + + /// \brief Returns the last error as a readable string. + /// + /// \return The error message + /// + static std::string GetOSError(); + + + /// \brief Get the application HINSTANCE. + /// + /// \return The HINSTANCE + /// + static HINSTANCE GetInstance(); + + + private: + Common(); + + }; // class Common + +}; // namespace w32dlib + +#endif // W32DLIB_COMMON_H + + +// END OF FILE diff --git a/src/w32dlib/control.h b/src/w32dlib/control.h new file mode 100644 index 0000000..bd1d39c --- /dev/null +++ b/src/w32dlib/control.h @@ -0,0 +1,111 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_CONTROL_H + +#define W32DLIB_CONTROL_H "$Id$" + +#include "w32dlib/base.h" + +namespace W32DLib +{ + + /// \brief Defines a callback. + /// + /// Return TRUE if the message was handled. + /// + typedef BOOL (*W32DLibCallback)(UINT msg, WPARAM wp, LPARAM lp); + + /// \brief The base Control class. + /// + class Control + { + public: + + /// \brief Constructor + /// + /// \param parent The Dialog the control belongs to. + /// \param resource_id The ID of the control in the resource file. + /// + Control(Dialog *parent, int resource_id); + + /// \brief Destructor + /// + virtual ~Control(); + + /// \brief Returns the Resource ID for the control. + /// + int ResourceID(); + + /// \brief Sets the text in a control + /// + /// \param text The control's text + /// \sa GetText() + /// + void SetText(const char *text); + + /// \brief Gets the text in a control + /// + /// \param maxlen The maximum length to fetch + /// \return The control's text + /// \sa SetText() + /// + std::string GetText(int maxlen); + + /// \brief Processes a windows event. + /// + /// \param msg The Windows event parameters + /// \param wp The Windows event parameters + /// \param lp The Windows event parameters + /// \return True if the message was processed. + /// + BOOL ProcessMessage(UINT msg, WPARAM wp, LPARAM lp); + + protected: + + /// \brief Add or remove a callback for the control. + /// + /// \param msg The Windows event message to respond to. + /// \param callback The callback. Pass NULL to remove the callback. + /// + void AddCallback(UINT msg, W32DLibCallback callback); + + /// \brief Filled in by the constructor with the parent dialog. + /// + Dialog *m_parent; + + /// \brief Filled in by the constructor with the resource ID. + /// + int m_resid; + + private: + + typedef std::map<UINT,W32DLibCallback> CallbackList; + + CallbackList m_cblist; + + }; // class Control + +}; // namespace w32dlib + +#endif // W32DLIB_CONTROL_H + + +// END OF FILE diff --git a/src/w32dlib/dialog.h b/src/w32dlib/dialog.h new file mode 100644 index 0000000..fbe36e3 --- /dev/null +++ b/src/w32dlib/dialog.h @@ -0,0 +1,128 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_DIALOG_H + +#define W32DLIB_DIALOG_H "$Id$" + +#include "w32dlib/base.h" + +namespace W32DLib +{ + /// \brief The base Dialog class. + /// + class Dialog + { + public: + + /// \brief Constructor + /// + Dialog(); + + /// \brief Destructor + /// + virtual ~Dialog(); + + /// \brief Returns the Resource ID for the dialog. + /// + /// All derived classes must implement this. This should return + /// the ID of the dialog in the resource file. + /// + virtual int ResourceID()=0; + + /// \brief Called when the dialog is displaying. + /// + /// Override this call to initialise dialog controls. + /// + virtual void OnInit(); + + /// \brief Called when the dialog is closing. + /// + /// Override this call to pick up this event. + /// + virtual void OnClose(); + + /// \brief Returns the HWND for the dialog. + /// + /// This call will only work while the dialog is on display. + /// The behaviour is undefined if it is called at any other time. + /// + HWND GetHWND(); + + /// \brief Displays a modal dialog. + /// + /// Call this to display the dialog. + /// + /// \param instance The HINSTANCE. Call Common::GetInstance() + /// to get the applications instance (from a DLL, for example). + /// \param parent The parent window of the dialog (NULL for none). + /// \return The result from Close(). + /// \sa Close() + /// \sa Common::GetInstance() + /// + INT_PTR ShowModal(HINSTANCE instance, HWND parent); + + /// \brief Closes the dialog. + /// + /// Closes the dialog. Silently ignored if the dialog is not open. + /// + /// \param result The result to return. + /// \sa ShowModal() + /// + void Close(INT_PTR result); + + protected: + + /// \brief Adds a control to the dialog. + /// + /// Note that the pointer to the control is stored, so the control + /// must exist as long as the dialog is in use. + /// + void AddControl(Control *control); + + private: + + typedef std::vector<Control*> ControlSet; + typedef std::map<HWND,Dialog*> ProcSet; + + HWND m_wnd; + bool m_open; + ControlSet m_cset; + + static ProcSet m_procset; + + BOOL InstanceDialogProc(HWND wnd, + UINT msg, + WPARAM wp, + LPARAM lp); + + static BOOL CALLBACK DialogProc(HWND wnd, + UINT msg, + WPARAM wp, + LPARAM lp); + + }; // class Dialog + +}; // namespace w32dlib + +#endif // W32DLIB_DIALOG_H + + +// END OF FILE diff --git a/src/w32dlib/text.h b/src/w32dlib/text.h new file mode 100644 index 0000000..fa00705 --- /dev/null +++ b/src/w32dlib/text.h @@ -0,0 +1,59 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_TEXT_H + +#define W32DLIB_TEXT_H "$Id$" + +#include "w32dlib/base.h" +#include "w32dlib/control.h" + +namespace W32DLib +{ + + /// \brief The Text class. + /// + class Text : public Control + { + public: + + /// \brief Constructor + /// + /// \param parent The dialog the control belongs to. + /// \param resource_id The ID of the control in the resource file. + /// + Text(Dialog *parent, int resource_id); + + /// \brief Destructor + /// + virtual ~Text(); + + protected: + + private: + + }; // class Text + +}; // namespace w32dlib + +#endif // W32DLIB_TEXT_H + + +// END OF FILE diff --git a/src/w32dlib/w32dlib.h b/src/w32dlib/w32dlib.h new file mode 100644 index 0000000..6c6947f --- /dev/null +++ b/src/w32dlib/w32dlib.h @@ -0,0 +1,34 @@ +// 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 +// +// ------------------------------------------------------------------------- +// +#ifndef W32DLIB_H + +#define W32DLIB_H "$Id$" + +#include "w32dlib/dialog.h" +#include "w32dlib/control.h" +#include "w32dlib/button.h" +#include "w32dlib/text.h" +#include "w32dlib/autocheck.h" + +#endif // W32DLIB_H + + +// END OF FILE |