|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52919 - sandbox/mirror/boost/mirror/factory/wx_constructor_gui
From: chochlik_at_[hidden]
Date: 2009-05-11 14:08:13
Author: matus.chochlik
Date: 2009-05-11 14:08:12 EDT (Mon, 11 May 2009)
New Revision: 52919
URL: http://svn.boost.org/trac/boost/changeset/52919
Log:
[mirror 0.4.x]
- added support for defaults to wx_constructor_gui
Text files modified:
sandbox/mirror/boost/mirror/factory/wx_constructor_gui/basic.hpp | 31 +++++++++++++++++++++++++++++--
sandbox/mirror/boost/mirror/factory/wx_constructor_gui/boolean.hpp | 7 +++++--
sandbox/mirror/boost/mirror/factory/wx_constructor_gui/default.hpp | 3 ++-
3 files changed, 36 insertions(+), 5 deletions(-)
Modified: sandbox/mirror/boost/mirror/factory/wx_constructor_gui/basic.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/factory/wx_constructor_gui/basic.hpp (original)
+++ sandbox/mirror/boost/mirror/factory/wx_constructor_gui/basic.hpp 2009-05-11 14:08:12 EDT (Mon, 11 May 2009)
@@ -60,6 +60,23 @@
{
return text_ctl->GetValue();
}
+
+ template <typename Default>
+ void init(const Default* opt_def)
+ {
+ if(opt_def) text_ctl->SetValue(*opt_def);
+ }
+
+ template <typename Default>
+ void init(const wxString& fmt, const Default* opt_def)
+ {
+ if(opt_def) text_ctl->SetValue(
+ wxString::Format(
+ fmt,
+ *opt_def
+ )
+ );
+ }
public:
template <class MetaFunctions, class FuncIndex, class ParamIndex>
wx_constructor_gui_basic(
@@ -67,6 +84,7 @@
MetaFunctions mf,
FuncIndex fi,
ParamIndex pi,
+ Product const* opt_default,
wxString pattern,
wxString message
): text_ctl(
@@ -82,6 +100,7 @@
#define BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI( \
PRODUCT, \
+ CONSTRUCTOR_BODY, \
FUNCTOR_BODY, \
PATTERN, \
MESSAGE \
@@ -99,21 +118,24 @@
wx_constructor_gui_data* parent_data, \
MetaFunctions mf, \
FuncIndex fi, \
- ParamIndex pi \
+ ParamIndex pi, \
+ PRODUCT const* opt_default = (PRODUCT const*)0 \
): base_class( \
parent_data, \
mf, \
fi, \
pi, \
+ opt_default, \
wxT( PATTERN ), \
wxT( MESSAGE ) \
- ){ } \
+ ) CONSTRUCTOR_BODY \
\
inline PRODUCT operator()(void) FUNCTOR_BODY \
};
BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI(
cts::bstring,
+ {init(opt_default);},
{return cts::bstring(get_text().c_str());},
"",
""
@@ -122,11 +144,13 @@
#define BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI_WX_CONVERT( \
TYPE, \
TEMP_TYPE, \
+ FORMAT_STRING, \
CONVERSION, \
PATTERN, \
MESSAGE \
) BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI( \
TYPE, \
+ {init(wxT(FORMAT_STRING), opt_default);}, \
{ \
TEMP_TYPE result; \
if(!get_text().CONVERSION(&result)) \
@@ -141,6 +165,7 @@
BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI_WX_CONVERT( \
TYPE, \
unsigned long, \
+ "%ul", \
ToULong, \
"^[+]?[[:digit:]]+$", \
"invalid unsigned integer" \
@@ -150,6 +175,7 @@
BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI_WX_CONVERT( \
TYPE, \
long, \
+ "%dl", \
ToLong, \
"^[+-]?[[:digit:]]+$", \
"invalid integer" \
@@ -159,6 +185,7 @@
BOOST_MIRROR_FACTORY_PLUGINS_SPECIALIZE_WX_CONSTR_GUI_WX_CONVERT( \
TYPE, \
double, \
+ "%f", \
ToDouble, \
"^[+-]?[[:digit:]]+\\.?[[:digit:]]*$", \
"invalid floating point number" \
Modified: sandbox/mirror/boost/mirror/factory/wx_constructor_gui/boolean.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/factory/wx_constructor_gui/boolean.hpp (original)
+++ sandbox/mirror/boost/mirror/factory/wx_constructor_gui/boolean.hpp 2009-05-11 14:08:12 EDT (Mon, 11 May 2009)
@@ -43,9 +43,12 @@
wx_constructor_gui_data* parent_data,
MetaFunctions mf,
FuncIndex fi,
- ParamIndex pi
+ ParamIndex pi,
+ const bool* opt_default = (const bool*)0
): chb_ctl(make_ctl(chbctl_maker(), parent_data, mf, fi, pi))
- { }
+ {
+ if(opt_default) chb_ctl->SetValue(*opt_default);
+ }
inline bool operator()(void) const
{
Modified: sandbox/mirror/boost/mirror/factory/wx_constructor_gui/default.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/factory/wx_constructor_gui/default.hpp (original)
+++ sandbox/mirror/boost/mirror/factory/wx_constructor_gui/default.hpp 2009-05-11 14:08:12 EDT (Mon, 11 May 2009)
@@ -30,7 +30,8 @@
wx_constructor_gui_data* parent_data,
MetaFunctions mf,
FuncIndex fi,
- ParamIndex pi
+ ParamIndex pi,
+ const Product* opt_default = (const Product*)0
)
{
// we need the parent data
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk