diff --git a/docs/changes.txt b/docs/changes.txt index 801172be93..f4e42fb2d1 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -115,6 +115,7 @@ All (GUI): - Add support for loading fonts from external files (Arthur Norman). - Improve wxSVGFileDC to support more of wxDC API (Maarten Bent). - Add support for wxAuiManager and wxAuiPaneInfo to XRC (Andrea Zanellato). +- Add XRC handler for wxSpinCtrlDouble (Trylz). - Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius). - Update Scintilla to v3.7.2 (NewPagodi, Paul Kulchenko). - Update bundled libpng to 1.6.28 (Catalin Raceanu). diff --git a/include/wx/xrc/xh_spin.h b/include/wx/xrc/xh_spin.h index 93762e0325..bf522e936f 100644 --- a/include/wx/xrc/xh_spin.h +++ b/include/wx/xrc/xh_spin.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/xrc/xh_spin.h -// Purpose: XML resource handler for wxSpinButton and wxSpinCtrl +// Purpose: XML resource handler for wxSpinButton, wxSpinCtrl, wxSpinCtrlDouble // Author: Bob Mitchell // Created: 2000/03/21 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive @@ -28,7 +28,6 @@ public: #endif // wxUSE_SPINBTN - #if wxUSE_SPINCTRL class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler @@ -41,6 +40,16 @@ public: wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler); }; +class WXDLLIMPEXP_XRC wxSpinCtrlDoubleXmlHandler : public wxXmlResourceHandler +{ +public: + wxSpinCtrlDoubleXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDoubleXmlHandler); +}; + #endif // wxUSE_SPINCTRL #endif // wxUSE_XRC diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index b298088e45..e4617452f6 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -214,6 +214,7 @@ builtinWindowClasses = | wxSlider | wxSpinButton | wxSpinCtrl + | wxSpinCtrlDouble | wxSplitterWindow | wxSearchCtrl | wxStatusBar @@ -310,6 +311,7 @@ builtinClassesNames = | "wxSlider" | "wxSpinButton" | "wxSpinCtrl" + | "wxSpinCtrlDouble" | "wxSplitterWindow" | "wxSearchCtrl" | "wxStatusBar" @@ -1413,6 +1415,18 @@ wxSpinCtrl = } +wxSpinCtrlDouble = + element object { + attribute class { "wxSpinCtrlDouble" } & + stdObjectNodeAttributes & + stdWindowProperties & + [xrc:p="o"] element value {_, t_float }* & + [xrc:p="o"] element min {_, t_float }* & + [xrc:p="o"] element max {_, t_float }* & + [xrc:p="o"] element inc {_, t_float}* + } + + wxSplitterWindow = element object { attribute class { "wxSplitterWindow" } & diff --git a/src/xrc/xh_spin.cpp b/src/xrc/xh_spin.cpp index ebd452e7ae..1e7a04affc 100644 --- a/src/xrc/xh_spin.cpp +++ b/src/xrc/xh_spin.cpp @@ -67,6 +67,8 @@ bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node) #include "wx/spinctrl.h" +static const float DEFAULT_INC = 1.; + wxIMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler); wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler() @@ -109,6 +111,46 @@ bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node) return IsOfClass(node, wxT("wxSpinCtrl")); } + +wxIMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDoubleXmlHandler, wxXmlResourceHandler); + +wxSpinCtrlDoubleXmlHandler::wxSpinCtrlDoubleXmlHandler() + : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxSP_HORIZONTAL); + XRC_ADD_STYLE(wxSP_VERTICAL); + XRC_ADD_STYLE(wxSP_ARROW_KEYS); + XRC_ADD_STYLE(wxSP_WRAP); + XRC_ADD_STYLE(wxALIGN_LEFT); + XRC_ADD_STYLE(wxALIGN_CENTER); + XRC_ADD_STYLE(wxALIGN_RIGHT); +} + +wxObject *wxSpinCtrlDoubleXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(control, wxSpinCtrlDouble) + + control->Create(m_parentAsWindow, + GetID(), + GetText(wxS("value")), + GetPosition(), GetSize(), + GetStyle(wxS("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT), + GetFloat(wxS("min"), (float)DEFAULT_MIN), + GetFloat(wxS("max"), (float)DEFAULT_MAX), + GetFloat(wxS("value"), (float)DEFAULT_VALUE), + GetFloat(wxS("inc"), DEFAULT_INC), + GetName()); + + SetupWindow(control); + + return control; +} + +bool wxSpinCtrlDoubleXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxS("wxSpinCtrlDouble")); +} + #endif // wxUSE_SPINCTRL #endif // wxUSE_XRC diff --git a/src/xrc/xmlrsall.cpp b/src/xrc/xmlrsall.cpp index 00c787a58f..0f67288385 100644 --- a/src/xrc/xmlrsall.cpp +++ b/src/xrc/xmlrsall.cpp @@ -165,6 +165,7 @@ void wxXmlResource::InitAllHandlers() #endif #if wxUSE_SPINCTRL AddHandler(new wxSpinCtrlXmlHandler); + AddHandler(new wxSpinCtrlDoubleXmlHandler); #endif #if wxUSE_SPLITTER AddHandler(new wxSplitterWindowXmlHandler);