diff options
Diffstat (limited to 'src/w32dlib')
-rw-r--r-- | src/w32dlib/Doxyfile | 4 | ||||
-rw-r--r-- | src/w32dlib/autocheck.h | 8 | ||||
-rw-r--r-- | src/w32dlib/base.h | 21 | ||||
-rw-r--r-- | src/w32dlib/button.h | 8 | ||||
-rw-r--r-- | src/w32dlib/common.h | 2 | ||||
-rw-r--r-- | src/w32dlib/control.h | 29 | ||||
-rw-r--r-- | src/w32dlib/dialog.h | 4 | ||||
-rw-r--r-- | src/w32dlib/static.h | 59 | ||||
-rw-r--r-- | src/w32dlib/text.h | 2 | ||||
-rw-r--r-- | src/w32dlib/w32dlib.h | 3 |
10 files changed, 114 insertions, 26 deletions
diff --git a/src/w32dlib/Doxyfile b/src/w32dlib/Doxyfile index 55febc5..d74787d 100644 --- a/src/w32dlib/Doxyfile +++ b/src/w32dlib/Doxyfile @@ -41,10 +41,10 @@ SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -EXTRACT_ALL = NO +EXTRACT_ALL = YES EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_CLASSES = NO EXTRACT_LOCAL_METHODS = NO HIDE_UNDOC_MEMBERS = YES HIDE_UNDOC_CLASSES = YES diff --git a/src/w32dlib/autocheck.h b/src/w32dlib/autocheck.h index 0246c03..e58d5f9 100644 --- a/src/w32dlib/autocheck.h +++ b/src/w32dlib/autocheck.h @@ -20,7 +20,7 @@ // #ifndef W32DLIB_AUTOCHECK_H -#define W32DLIB_AUTOCHECK_H "$Id$" +#define W32DLIB_AUTOCHECK_H "$Id$" #include "w32dlib/base.h" #include "w32dlib/control.h" @@ -58,9 +58,11 @@ namespace W32DLib /// \brief Sets a callback for a button press /// - /// \param callback The callback. Set to NULL to clear the callback. + /// \param owner The class the callback reside in. + /// \param callback The callback. /// - void OnPress(W32DLibCallback callback); + void OnPress(W32DLibCallbackInterface *owner, + W32DLibCallback callback); /// \brief Sets the tickstate. diff --git a/src/w32dlib/base.h b/src/w32dlib/base.h index 5dfcbfc..0d6f453 100644 --- a/src/w32dlib/base.h +++ b/src/w32dlib/base.h @@ -20,7 +20,7 @@ // #ifndef W32DLIB_BASE_H -#define W32DLIB_BASE_H "$Id$" +#define W32DLIB_BASE_H "$Id$" #include <windows.h> #include <vector> @@ -31,6 +31,25 @@ namespace W32DLib { class Dialog; class Control; + +/// \brief Dummy class to allow the use of callbacks. +/// +class W32DLibCallbackInterface +{ + public: + W32DLibCallbackInterface() {} + virtual ~W32DLibCallbackInterface() {} +}; + +/// \brief The callback type for W32DLib. +/// +/// Simply accepts the usual Windows message parameters, and must return TRUE +/// if the event was handled. +/// +typedef BOOL (W32DLibCallbackInterface::*W32DLibCallback) + (UINT msg, WPARAM wp, LPARAM lp); + + }; #endif // W32DLIB_BASE_H diff --git a/src/w32dlib/button.h b/src/w32dlib/button.h index 0ab0b8d..3ba48b3 100644 --- a/src/w32dlib/button.h +++ b/src/w32dlib/button.h @@ -20,7 +20,7 @@ // #ifndef W32DLIB_BUTTON_H -#define W32DLIB_BUTTON_H "$Id$" +#define W32DLIB_BUTTON_H "$Id$" #include "w32dlib/base.h" #include "w32dlib/control.h" @@ -47,9 +47,11 @@ namespace W32DLib /// \brief Sets a callback for a button press /// - /// \param callback The callback. Set to NULL to clear the callback. + /// \param owner The class the callback reside in. + /// \param callback The callback. /// - void OnPress(W32DLibCallback callback); + void OnPress(W32DLibCallbackInterface *owner, + W32DLibCallback callback); protected: diff --git a/src/w32dlib/common.h b/src/w32dlib/common.h index 004d81f..bb9547f 100644 --- a/src/w32dlib/common.h +++ b/src/w32dlib/common.h @@ -20,7 +20,7 @@ // #ifndef W32DLIB_COMMON_H -#define W32DLIB_COMMON_H "$Id$" +#define W32DLIB_COMMON_H "$Id$" #include "w32dlib/base.h" diff --git a/src/w32dlib/control.h b/src/w32dlib/control.h index bd1d39c..7aef528 100644 --- a/src/w32dlib/control.h +++ b/src/w32dlib/control.h @@ -20,22 +20,16 @@ // #ifndef W32DLIB_CONTROL_H -#define W32DLIB_CONTROL_H "$Id$" +#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 + class Control : public W32DLibCallbackInterface { public: @@ -80,12 +74,17 @@ namespace W32DLib protected: - /// \brief Add or remove a callback for the control. + /// \brief Add a callback for the control. /// /// \param msg The Windows event message to respond to. - /// \param callback The callback. Pass NULL to remove the callback. + /// \param owner The class (generally a Dialog derived one) in which + /// the callback resides. The class must be derived from + /// W32DLibCallbackInterface. + /// \param callback The callback. /// - void AddCallback(UINT msg, W32DLibCallback callback); + void AddCallback(UINT msg, + W32DLibCallbackInterface *owner, + W32DLibCallback callback); /// \brief Filled in by the constructor with the parent dialog. /// @@ -97,7 +96,13 @@ namespace W32DLib private: - typedef std::map<UINT,W32DLibCallback> CallbackList; + struct CallbackDetails + { + W32DLibCallbackInterface *owner; + W32DLibCallback cb; + }; + + typedef std::map<UINT,CallbackDetails> CallbackList; CallbackList m_cblist; diff --git a/src/w32dlib/dialog.h b/src/w32dlib/dialog.h index fbe36e3..cac003e 100644 --- a/src/w32dlib/dialog.h +++ b/src/w32dlib/dialog.h @@ -20,7 +20,7 @@ // #ifndef W32DLIB_DIALOG_H -#define W32DLIB_DIALOG_H "$Id$" +#define W32DLIB_DIALOG_H "$Id$" #include "w32dlib/base.h" @@ -28,7 +28,7 @@ namespace W32DLib { /// \brief The base Dialog class. /// - class Dialog + class Dialog : public W32DLibCallbackInterface { public: diff --git a/src/w32dlib/static.h b/src/w32dlib/static.h new file mode 100644 index 0000000..3eca8af --- /dev/null +++ b/src/w32dlib/static.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 StaticText class. + /// + class StaticText : 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. + /// + StaticText(Dialog *parent, int resource_id); + + /// \brief Destructor + /// + virtual ~StaticText(); + + protected: + + private: + + }; // class StaticText + +}; // namespace w32dlib + +#endif // W32DLIB_TEXT_H + + +// END OF FILE diff --git a/src/w32dlib/text.h b/src/w32dlib/text.h index fa00705..3614950 100644 --- a/src/w32dlib/text.h +++ b/src/w32dlib/text.h @@ -20,7 +20,7 @@ // #ifndef W32DLIB_TEXT_H -#define W32DLIB_TEXT_H "$Id$" +#define W32DLIB_TEXT_H "$Id$" #include "w32dlib/base.h" #include "w32dlib/control.h" diff --git a/src/w32dlib/w32dlib.h b/src/w32dlib/w32dlib.h index 6c6947f..a295226 100644 --- a/src/w32dlib/w32dlib.h +++ b/src/w32dlib/w32dlib.h @@ -20,12 +20,13 @@ // #ifndef W32DLIB_H -#define W32DLIB_H "$Id$" +#define W32DLIB_H "$Id$" #include "w32dlib/dialog.h" #include "w32dlib/control.h" #include "w32dlib/button.h" #include "w32dlib/text.h" +#include "w32dlib/static.h" #include "w32dlib/autocheck.h" #endif // W32DLIB_H |