From f8ba03594573e8487927c236180ad5895e73db17 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 11 Apr 2005 00:03:53 +0000 Subject: Some changes and added RadioButton --- src/GNUmakefile | 8 ++-- src/control.cpp | 5 +- src/datax.cpp | 32 +++++++------ src/debug.cpp | 85 +++++++++++++++++++++++++++++++++ src/dialog.cpp | 5 ++ src/radiobutton.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++++++ src/test/.cvsignore | 3 +- src/test/dialog.h | 3 ++ src/test/dialog.rc | 6 ++- src/test/w32dtst.cpp | 79 +++++++++++++++++++++++++------ src/w32dlib/autocheck.h | 5 +- src/w32dlib/base.h | 26 +++++++++-- src/w32dlib/button.h | 5 +- src/w32dlib/combobox.h | 5 +- src/w32dlib/control.h | 14 ++++-- src/w32dlib/datax.h | 24 ++++++++-- src/w32dlib/radiobutton.h | 111 ++++++++++++++++++++++++++++++++++++++++++++ src/w32dlib/static.h | 5 +- src/w32dlib/text.h | 5 +- src/w32dlib/w32dlib.h | 1 + src/window.cpp | 5 ++ 21 files changed, 487 insertions(+), 61 deletions(-) create mode 100644 src/radiobutton.cpp create mode 100644 src/w32dlib/radiobutton.h diff --git a/src/GNUmakefile b/src/GNUmakefile index f654739..e410ca0 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: GNUmakefile,v 1.7 2005-04-05 01:01:58 ianc Exp $ +# $Id: GNUmakefile,v 1.8 2005-04-11 00:03:53 ianc Exp $ # @@ -35,7 +35,8 @@ INSTALLDIR = /usr/local # CREATECONF = 1 -# Uncomment this if you want a debug build +# Uncomment this if you want a debug build. Note that debug goes to a file +# called debug.out in the pwd. # DEBUG = -g -DW32D_DEBUG @@ -58,7 +59,8 @@ SOURCES = autocheck.cpp \ debug.cpp \ window.cpp \ combobox.cpp \ - datax.cpp + datax.cpp \ + radiobutton.cpp HEADERS = w32dlib/*.h diff --git a/src/control.cpp b/src/control.cpp index fa8e2e7..6464ee1 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -67,6 +67,7 @@ BOOL Control::ProcessMessage(UINT msg, WPARAM wp, LPARAM lp) WORD hi=HIWORD(wp); CallbackList::const_iterator i; + int ret=FALSE; for(i=m_cblist.begin();i!=m_cblist.end();++i) { @@ -79,12 +80,12 @@ BOOL Control::ProcessMessage(UINT msg, WPARAM wp, LPARAM lp) Window *owner=details.owner; W32DLibCallback cb=details.cb; - return (owner->*cb)(msg,wp,lp); + ret|=(owner->*cb)(msg,wp,lp); } } } - return FALSE; + return ret; } diff --git a/src/datax.cpp b/src/datax.cpp index e1e3f5f..d5a5b04 100644 --- a/src/datax.cpp +++ b/src/datax.cpp @@ -26,22 +26,28 @@ namespace W32DLib // ------------------------------------------------------------ // -DataX::DataX(DataX::EType type) : m_type(type) +DataX::DataX(int value) : m_type(eInt) { - switch(m_type) - { - case eString: - m_data=static_cast(new std::string()); - break; + m_data=static_cast(new int); + Set(value); +} - case eInt: - m_data=static_cast(new int); - break; - case eBool: - m_data=static_cast(new bool); - break; - } +// ------------------------------------------------------------ +// +DataX::DataX(const char *value) : m_type(eString) +{ + m_data=static_cast(new std::string()); + Set(value); +} + + +// ------------------------------------------------------------ +// +DataX::DataX(bool value) : m_type(eBool) +{ + m_data=static_cast(new bool); + Set(value); } diff --git a/src/debug.cpp b/src/debug.cpp index f697041..f234442 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -19,10 +19,17 @@ // ------------------------------------------------------------------------- // #include "w32dlib/base.h" +#include +#include +#include namespace W32DLib { +// Just to save any cstdio is it a define or function worries +// +using namespace std; + #ifdef W32D_DEBUG const char *MsgName(UINT msg) @@ -217,6 +224,35 @@ const char *MsgName(UINT msg) } } +void W32Debug(const char *func, const char *file, const char *msg) +{ + static const char *filter=std::getenv("W32DEBUGFILTER"); + static FILE *fp=0; + int len; + + if (!fp) + { + fp=fopen("debug.out","w"); + setbuf(fp,0); + } + + if (filter && !std::strstr(filter,file)) + { + return; + } + + len=35-std::strlen(func)-std::strlen(file)-3; + + if (len<1) + { + fprintf(fp,"%s (%s): %s\n",func,file,msg); + } + else + { + fprintf(fp,"%s (%s)%-*.*s: %s\n",func,file,len,len,"",msg); + } +} + #else const char *MsgName(UINT msg) @@ -224,8 +260,57 @@ const char *MsgName(UINT msg) return ""; } +void W32Debug(const char *func, const char *file, const char *msg) +{ +} + #endif // W32D_DEBUG + +std::string EncodeCString(const char *p) +{ + std::string ret("\""); + + while(*p) + { + switch(*p) + { + case '"': + ret+="\\\""; + break; + + case '\r': + ret+="\\r"; + break; + + case '\n': + ret+="\\n"; + break; + + default: + if (*p<32 || *p>126) + { + char s[32]; + + sprintf(s,"\\0%o",static_cast(*p)); + + ret+=s; + } + else + { + ret+=*p; + } + break; + } + + p++; + } + + ret+="\""; + + return ret; +} + }; // namespace W32DLib // END OF FILE diff --git a/src/dialog.cpp b/src/dialog.cpp index d8bea39..fc72fee 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -191,6 +191,11 @@ BOOL Dialog::InstanceProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) break; default: + /* + W32DEBUGOUT(MsgName(msg) << " (" << msg << + ", " << wp << ", " << lp << ")" << + " ignored"); + */ break; } diff --git a/src/radiobutton.cpp b/src/radiobutton.cpp new file mode 100644 index 0000000..ac1a5cc --- /dev/null +++ b/src/radiobutton.cpp @@ -0,0 +1,116 @@ +// 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/window.h" +#include "w32dlib/radiobutton.h" +#include "w32dlib/dialog.h" +#include "w32dlib/datax.h" + +namespace W32DLib +{ + + +// ------------------------------------------------------------ +// +RadioButton::RadioButton(Dialog *parent, int resource_id, + int first_radio, int last_radio, DataX *datax) : + Control(parent,resource_id,datax), + m_first(first_radio), + m_last(last_radio) +{ +} + + +// ------------------------------------------------------------ +// +RadioButton::~RadioButton() +{ +} + + +// ------------------------------------------------------------ +// +void RadioButton::OnPress(Window *owner, W32DLibCallback callback) +{ + Control::AddCallback(WM_COMMAND,0,owner,callback); +} + + +// ------------------------------------------------------------ +// +void RadioButton::SetState() +{ + BOOL ret=CheckRadioButton(m_parent->GetHWND(),m_first,m_last,m_resid); + + W32DEBUGOUT("CheckRadioButton(" << m_parent->GetHWND() <<"," << + m_first << "," << + m_last << "," << + m_resid << + ") for " << m_resid << + " returned " << ret); +} + + +// ------------------------------------------------------------ +// +bool RadioButton::GetState() +{ + return IsDlgButtonChecked(m_parent->GetHWND(),m_resid)==BST_CHECKED; +} + + +// ------------------------------------------------------------ +// +void RadioButton::DoDataExchange(bool set) +{ + if (m_data) + { + switch(m_data->Type()) + { + case DataX::eString: + Control::DoDataExchange(set); + break; + + case DataX::eInt: + break; + + case DataX::eBool: + if (set) + { + if (m_data->Bool()) + { + SetState(); + } + } + else + { + m_data->Set(GetState()); + } + break; + } + } +} + + +}; // namespace W32DLib + + + +// END OF FILE diff --git a/src/test/.cvsignore b/src/test/.cvsignore index 0ad1fae..f94fa70 100644 --- a/src/test/.cvsignore +++ b/src/test/.cvsignore @@ -1,2 +1,3 @@ depend.mak -w32dtst.exe \ No newline at end of file +w32dtst.exe +debug.out \ No newline at end of file diff --git a/src/test/dialog.h b/src/test/dialog.h index 6789be0..d70c14c 100644 --- a/src/test/dialog.h +++ b/src/test/dialog.h @@ -22,3 +22,6 @@ #define IDPOPUP 22 #define IDPOPUP1 23 #define IDPOPUP2 24 +#define IDRADIO1 25 +#define IDRADIO2 26 +#define IDRADIO3 27 diff --git a/src/test/dialog.rc b/src/test/dialog.rc index 0f36ecc..8207c9f 100644 --- a/src/test/dialog.rc +++ b/src/test/dialog.rc @@ -19,6 +19,10 @@ TESTDLG DIALOG 10, 10, 500, 300 COMBOBOX IDCOMBO, 10, 180, 100, 100, CBS_SIMPLE | CBS_SORT | WS_VSCROLL | WS_TABSTOP + AUTORADIOBUTTON "Radio 1", IDRADIO1, 120, 180, 100, 18 + AUTORADIOBUTTON "Radio 2", IDRADIO2, 120, 200, 100, 18 + AUTORADIOBUTTON "Radio 3", IDRADIO3, 120, 220, 100, 18 + LTEXT "Text:", IDSTATIC1, 210, 10, 35, 12 EDITTEXT IDTEXT, 250, 10, 100, 100, ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | ES_WANTRETURN } @@ -43,7 +47,7 @@ IDMENU MENU IDPOPUP MENU { - POPUP "File" + POPUP "Popup?" { MENUITEM "Opt 1", IDPOPUP1 MENUITEM "Opt 2", IDPOPUP2 diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp index c06c5ce..e3a55cf 100644 --- a/src/test/w32dtst.cpp +++ b/src/test/w32dtst.cpp @@ -29,19 +29,25 @@ class Test : public W32DLib::Dialog { public: - Test() : m_check_data(W32DLib::DataX::eBool) - , m_combo_data(W32DLib::DataX::eInt) - , m_text_data(W32DLib::DataX::eString) - , m_static(this,IDSTATIC1) + Test() : m_check_data(true) + , m_combo_data(2) + , m_text_data("Hello") + , m_radio1_data(true) + , m_radio2_data(false) + , m_radio3_data(false) + , m_static(this,IDSTATIC1,0) , m_text(this,IDTEXT,&m_text_data) , m_check(this,IDCHECK,&m_check_data) - , m_button(this,IDBUTTON) - , m_quit(this,IDQUIT) - , m_load(this,IDLOADTXT) - , m_loadbut(this,IDLOADBUT) - , m_save(this,IDSAVETXT) - , m_savebut(this,IDSAVEBUT) + , m_button(this,IDBUTTON,0) + , m_quit(this,IDQUIT,0) + , m_load(this,IDLOADTXT,0) + , m_loadbut(this,IDLOADBUT,0) + , m_save(this,IDSAVETXT,0) + , m_savebut(this,IDSAVEBUT,0) , m_combo(this,IDCOMBO,&m_combo_data) + , m_radio1(this,IDRADIO1,IDRADIO1,IDRADIO3,&m_radio1_data) + , m_radio2(this,IDRADIO2,IDRADIO1,IDRADIO3,&m_radio2_data) + , m_radio3(this,IDRADIO3,IDRADIO1,IDRADIO3,&m_radio3_data) { m_button.OnPress (this,static_cast(&Test::OnButton)); @@ -65,6 +71,13 @@ public: m_combo.OnTextChanged (this,static_cast(&Test::OnComboTxt)); + m_radio1.OnPress + (this,static_cast(&Test::OnRadio)); + m_radio2.OnPress + (this,static_cast(&Test::OnRadio)); + m_radio3.OnPress + (this,static_cast(&Test::OnRadio)); + SetMenuProc (this,static_cast(&Test::OnMenu)); } @@ -95,14 +108,12 @@ public: std::cout << "HWND=" << m_combo.GetHWND() << std::endl; #ifdef DATAX_TEST - m_text_data.Set("Hello"); - m_check_data.Set(true); - m_combo_data.Set(2); SetData(); #else m_text.SetText("Hello"); m_check.SetState(W32DLib::AutoCheck::eChecked); m_combo.SelectedIndex(2); + m_radio1.SetState(); #endif } @@ -110,6 +121,9 @@ private: W32DLib::DataX m_check_data; W32DLib::DataX m_combo_data; W32DLib::DataX m_text_data; + W32DLib::DataX m_radio1_data; + W32DLib::DataX m_radio2_data; + W32DLib::DataX m_radio3_data; W32DLib::StaticText m_static; W32DLib::Text m_text; @@ -125,6 +139,10 @@ private: W32DLib::ComboBox m_combo; + W32DLib::RadioButton m_radio1; + W32DLib::RadioButton m_radio2; + W32DLib::RadioButton m_radio3; + std::string m_loadpath; std::string m_savepath; @@ -152,7 +170,18 @@ private: m_static.SetText(txt); SetText(txt+" [Title]"); m_combo.AddString(m_combo.GetText()); - m_text.AppendText(m_combo.GetText()+"\n"); + m_text.AppendText(m_combo.GetText()+"\r\n"); + +#ifdef DATAX_TEST + GetData(); + m_radio1_data.Set(false); + m_radio2_data.Set(true); + m_radio3_data.Set(false); + SetData(); +#else + m_radio2.SetState(); +#endif + return TRUE; } @@ -261,6 +290,28 @@ private: return TRUE; } + + BOOL OnRadio(UINT msg, WPARAM wp, LPARAM lp) + { +#ifdef DATAX_TEST + GetData(); + bool radio1=m_radio1_data.Bool(); + bool radio2=m_radio2_data.Bool(); + bool radio3=m_radio3_data.Bool(); +#else + bool radio1=m_radio1.GetState(); + bool radio2=m_radio2.GetState(); + bool radio3=m_radio3.GetState(); +#endif + + std::cout << "OnRadio" << std::endl; + + std::cout << "radio1=" << radio1 << std::endl; + std::cout << "radio2=" << radio2 << std::endl; + std::cout << "radio3=" << radio3 << std::endl; + + return TRUE; + } }; int WINAPI WinMain (HINSTANCE hInstance, diff --git a/src/w32dlib/autocheck.h b/src/w32dlib/autocheck.h index f7aa2fa..14dd04e 100644 --- a/src/w32dlib/autocheck.h +++ b/src/w32dlib/autocheck.h @@ -48,10 +48,9 @@ namespace W32DLib /// /// \param parent The dialog the control belongs to. /// \param resource_id The ID of the control in the resource file. - /// \param datax The DataX to use. The default of 0 means don't - /// use data exchange. + /// \param datax The DataX to use. NULL means don't use data exchange. /// - AutoCheck(Dialog *parent, int resource_id, DataX *datax=0); + AutoCheck(Dialog *parent, int resource_id, DataX *datax); /// \brief Destructor /// diff --git a/src/w32dlib/base.h b/src/w32dlib/base.h index e4796ca..639c368 100644 --- a/src/w32dlib/base.h +++ b/src/w32dlib/base.h @@ -60,9 +60,9 @@ typedef BOOL (Window::*W32DLibCallback) (UINT msg, WPARAM wp, LPARAM lp); #define W32DEBUGOUT(x) \ do \ { \ - std::ostringstream s; \ - s << __FUNCTION__ << "(" << __FILE__ << "): " << x; \ - OutputDebugString(s.str().c_str()); \ + std::ostringstream str; \ + str << x; \ + W32Debug(__FUNCTION__,__FILE__,str.str().c_str()); \ } while(0) #else @@ -83,6 +83,26 @@ typedef BOOL (Window::*W32DLibCallback) (UINT msg, WPARAM wp, LPARAM lp); const char *MsgName(UINT msg); +/// \brief Logs debug output. +/// +/// Only available in debug builds -- does nothing otherwise. +/// +/// \param func The function it was called from. +/// \param file The file it was called from. +/// \param msg The debug message. +/// +void W32Debug(const char *func, const char *file, const char *msg); + + +/// \brief Encodes string so they appear C-like. +/// +/// Used in debug build to dump strings. +/// +/// \param p The string to encode. +/// \return The encoded string. +/// +std::string EncodeCString(const char *p); + }; diff --git a/src/w32dlib/button.h b/src/w32dlib/button.h index b674f87..6a98307 100644 --- a/src/w32dlib/button.h +++ b/src/w32dlib/button.h @@ -38,10 +38,9 @@ namespace W32DLib /// /// \param parent The dialog the control belongs to. /// \param resource_id The ID of the control in the resource file. - /// \param datax The DataX to use. The default of 0 means don't - /// use data exchange. + /// \param datax The DataX to use. NULL means don't use data exchange. /// - Button(Dialog *parent, int resource_id, DataX *datax=0); + Button(Dialog *parent, int resource_id, DataX *datax); /// \brief Destructor /// diff --git a/src/w32dlib/combobox.h b/src/w32dlib/combobox.h index 2ff9c63..2aad581 100644 --- a/src/w32dlib/combobox.h +++ b/src/w32dlib/combobox.h @@ -38,10 +38,9 @@ namespace W32DLib /// /// \param parent The dialog the control belongs to. /// \param resource_id The ID of the control in the resource file. - /// \param datax The DataX to use. The default of 0 means don't - /// use data exchange. + /// \param datax The DataX to use. NULL means don't use data exchange. /// - ComboBox(Dialog *parent, int resource_id, DataX *datax=0); + ComboBox(Dialog *parent, int resource_id, DataX *datax); /// \brief Destructor /// diff --git a/src/w32dlib/control.h b/src/w32dlib/control.h index f645a98..b1a0bec 100644 --- a/src/w32dlib/control.h +++ b/src/w32dlib/control.h @@ -40,10 +40,9 @@ namespace W32DLib /// /// \param parent The Dialog the control belongs to. /// \param resource_id The ID of the control in the resource file. - /// \param datax The DataX to use. The default of 0 means don't - /// use data exchange. + /// \param datax The DataX to use. NULL means don't use data exchange. /// - Control(Dialog *parent, int resource_id, DataX *datax=0); + Control(Dialog *parent, int resource_id, DataX *datax); /// \brief Destructor /// @@ -83,9 +82,16 @@ namespace W32DLib /// \brief Add a callback for the control. /// + /// Note that multiple callbacks can be lodged for the same msg and + /// notification. If this is the case then the result returned + /// through ProcessMessage is the logical OR of all the returns. + /// + /// When multiple callbacks match they are called in the order they + /// were registered. + /// /// \param msg The Windows event message to respond to. /// \param notification The top word of the WPARAM will be checked - /// against this. If zero, then ignored. + /// against this. If zero, then ignored. /// \param owner The class (generally a Dialog derived one) in which /// the callback resides. The class must be derived from /// Window. diff --git a/src/w32dlib/datax.h b/src/w32dlib/datax.h index 1ed4088..19dec96 100644 --- a/src/w32dlib/datax.h +++ b/src/w32dlib/datax.h @@ -44,17 +44,31 @@ namespace W32DLib /// enum EType { - eInt, ///< Standard int + eInt, ///< int eString, ///< std::string - eBool ///< Standard bool + eBool ///< bool }; - /// \brief Constructor + /// \brief Constructs an \link DataX::eInt eInt \endlink object. /// - /// \param type The type of DataX object to create. + /// \param value The initial value. /// - DataX(EType type); + DataX(int value); + + + /// \brief Constructs an \link DataX::eString eString \endlink object. + /// + /// \param value The initial value. + /// + DataX(const char *value); + + + /// \brief Constructs an \link DataX::eBool eBool \endlink object. + /// + /// \param value The initial value. + /// + DataX(bool value); /// \brief Destructor diff --git a/src/w32dlib/radiobutton.h b/src/w32dlib/radiobutton.h new file mode 100644 index 0000000..d272c19 --- /dev/null +++ b/src/w32dlib/radiobutton.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_RADIOBUTTON_H + +#define W32DLIB_RADIOBUTTON_H "$Id$" + +#include "w32dlib/base.h" +#include "w32dlib/control.h" + +namespace W32DLib +{ + + /// \brief The RadioButton class. + /// + class RadioButton : 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. + /// \param first_radio The ID of the first radio button in the group. + /// \param last_radio The ID of the last radio button in the group. + /// \param datax The DataX to use. NULL means don't use data exchange. + /// + RadioButton(Dialog *parent, int resource_id, + int first_radio, int last_radio, DataX *datax); + + + /// \brief Destructor + /// + virtual ~RadioButton(); + + + /// \brief Sets a callback for a button press. + /// + /// \param owner The class the callback resides in. + /// \param callback The callback. + /// + void OnPress(Window *owner, + W32DLibCallback callback); + + + /// \brief Sets the radio button on. + /// + /// Note that this will affect other radio buttons in the group if + /// appropriate. If DataX is used to set this and more than two + /// buttons in the group are set the results are indeterminate. + /// + /// \sa GetState() + /// + void SetState(); + + + /// \brief Gets the tickstate. + /// + /// \return The tick state + /// \sa SetState() + /// + bool GetState(); + + /// \brief Performs data exchange. + /// + /// Support types: + /// + /// \link DataX::eString eString \endlink -- see + /// Control::DoDataExchange() + /// + /// \link DataX::eBool eBool \endlink -- same as + /// GetState() / SetState() + /// + /// \param set If true the set the Control from the DataX object. If + /// false then set the DataX object from the Control. + /// + virtual void DoDataExchange(bool set); + + protected: + + private: + + int m_first; + int m_last; + + }; // class RadioButton + +}; // namespace w32dlib + +#endif // W32DLIB_RADIOBUTTON_H + + +// END OF FILE diff --git a/src/w32dlib/static.h b/src/w32dlib/static.h index b593b2c..009b1bc 100644 --- a/src/w32dlib/static.h +++ b/src/w32dlib/static.h @@ -38,10 +38,9 @@ namespace W32DLib /// /// \param parent The dialog the control belongs to. /// \param resource_id The ID of the control in the resource file. - /// \param datax The DataX to use. The default of 0 means don't - /// use data exchange. + /// \param datax The DataX to use. NULL means don't use data exchange. /// - StaticText(Dialog *parent, int resource_id, DataX *datax=0); + StaticText(Dialog *parent, int resource_id, DataX *datax); /// \brief Destructor /// diff --git a/src/w32dlib/text.h b/src/w32dlib/text.h index 73013fb..01738ab 100644 --- a/src/w32dlib/text.h +++ b/src/w32dlib/text.h @@ -38,10 +38,9 @@ namespace W32DLib /// /// \param parent The dialog the control belongs to. /// \param resource_id The ID of the control in the resource file. - /// \param datax The DataX to use. The default of 0 means don't - /// use data exchange. + /// \param datax The DataX to use. NULL means don't use data exchange. /// - Text(Dialog *parent, int resource_id, DataX *datax=0); + Text(Dialog *parent, int resource_id, DataX *datax); /// \brief Destructor /// diff --git a/src/w32dlib/w32dlib.h b/src/w32dlib/w32dlib.h index abc91f0..41d53d0 100644 --- a/src/w32dlib/w32dlib.h +++ b/src/w32dlib/w32dlib.h @@ -32,6 +32,7 @@ #include #include #include +#include #endif // W32DLIB_H diff --git a/src/window.cpp b/src/window.cpp index e64bd30..7f0d9d3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -139,6 +139,8 @@ void Window::SetText(const char *text) // void Window::SetText(const std::string& text) { + W32DEBUGOUT("WND=" << m_wnd << " SetText(" << + EncodeCString(text.c_str()) << ")"); SetText(text.c_str()); } @@ -155,6 +157,9 @@ std::string Window::GetText() SendMsg(WM_GETTEXT,len+1,reinterpret_cast(buff)); + W32DEBUGOUT("WND=" << m_wnd << " GetText(" << + EncodeCString(buff) << ")"); + res=buff; delete[] buff; -- cgit v1.2.3