Merge branch 'xrc-spinctrldouble'
Add XRC handler for wxSpinCtrlDouble. Closes https://github.com/wxWidgets/wxWidgets/pull/665
This commit is contained in:
@@ -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).
|
||||
|
@@ -1906,6 +1906,19 @@ wxWidgets 2.9.5, another one:
|
||||
@endTable
|
||||
|
||||
|
||||
@subsubsection xrc_wxspinctrldouble wxSpinCtrlDouble
|
||||
|
||||
wxSpinCtrlDouble supports the same properties as @ref xrc_wxspinbutton but @c
|
||||
value, @c min and @a max are all of type float instead of int. There is one
|
||||
additional property:
|
||||
@beginTable
|
||||
@row3col{inc, float,
|
||||
The amount by which the number is changed by a single arrow press.}
|
||||
@endTable
|
||||
|
||||
This handler was added in wxWidgets 3.1.1.
|
||||
|
||||
|
||||
@subsubsection xrc_wxsplitterwindow wxSplitterWindow
|
||||
|
||||
@beginTable
|
||||
|
@@ -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
|
||||
|
@@ -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" } &
|
||||
|
@@ -67,18 +67,25 @@ bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
|
||||
|
||||
#include "wx/spinctrl.h"
|
||||
|
||||
static const float DEFAULT_INC = 1.;
|
||||
|
||||
static void AddSpinCtrlStyles(wxXmlResourceHandler& handler)
|
||||
{
|
||||
handler.XRC_ADD_STYLE(wxSP_HORIZONTAL);
|
||||
handler.XRC_ADD_STYLE(wxSP_VERTICAL);
|
||||
handler.XRC_ADD_STYLE(wxSP_ARROW_KEYS);
|
||||
handler.XRC_ADD_STYLE(wxSP_WRAP);
|
||||
handler.XRC_ADD_STYLE(wxALIGN_LEFT);
|
||||
handler.XRC_ADD_STYLE(wxALIGN_CENTER);
|
||||
handler.XRC_ADD_STYLE(wxALIGN_RIGHT);
|
||||
}
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlXmlHandler, wxXmlResourceHandler);
|
||||
|
||||
wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
|
||||
: wxXmlResourceHandler()
|
||||
: 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);
|
||||
AddSpinCtrlStyles(*this);
|
||||
}
|
||||
|
||||
wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
|
||||
@@ -109,6 +116,40 @@ bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
|
||||
return IsOfClass(node, wxT("wxSpinCtrl"));
|
||||
}
|
||||
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDoubleXmlHandler, wxXmlResourceHandler);
|
||||
|
||||
wxSpinCtrlDoubleXmlHandler::wxSpinCtrlDoubleXmlHandler()
|
||||
: wxXmlResourceHandler()
|
||||
{
|
||||
AddSpinCtrlStyles(*this);
|
||||
}
|
||||
|
||||
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
|
||||
|
@@ -165,6 +165,7 @@ void wxXmlResource::InitAllHandlers()
|
||||
#endif
|
||||
#if wxUSE_SPINCTRL
|
||||
AddHandler(new wxSpinCtrlXmlHandler);
|
||||
AddHandler(new wxSpinCtrlDoubleXmlHandler);
|
||||
#endif
|
||||
#if wxUSE_SPLITTER
|
||||
AddHandler(new wxSplitterWindowXmlHandler);
|
||||
|
Reference in New Issue
Block a user