SpinCtrl editor's 'value change by mouse motion' feature is made optional, enabled via 'MotionSpin' attribute. Also, for now only enabled on MSW (mouse capture etc. inconsistent on native wxGTK spinbutton?).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57252 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -128,6 +128,11 @@
|
|||||||
*/
|
*/
|
||||||
#define wxPG_ATTR_SPINCTRL_WRAP wxS("Wrap")
|
#define wxPG_ATTR_SPINCTRL_WRAP wxS("Wrap")
|
||||||
|
|
||||||
|
/** SpinCtrl editor, bool. If @true, value can also by changed by moving
|
||||||
|
mouse when left mouse button is being pressed.
|
||||||
|
*/
|
||||||
|
#define wxPG_ATTR_SPINCTRL_MOTIONSPIN wxS("MotionSpin")
|
||||||
|
|
||||||
/** wxMultiChoiceProperty, int. If 0, no user strings allowed. If 1, user strings
|
/** wxMultiChoiceProperty, int. If 0, no user strings allowed. If 1, user strings
|
||||||
appear before list strings. If 2, user strings appear after list string.
|
appear before list strings. If 2, user strings appear after list string.
|
||||||
*/
|
*/
|
||||||
|
@@ -1371,6 +1371,7 @@ void FormMain::PopulateWithExamples ()
|
|||||||
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_MIN, (long)-10 ); // Use constants instead of string
|
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_MIN, (long)-10 ); // Use constants instead of string
|
||||||
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_MAX, (long)16384 ); // for reduced binary size.
|
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_MAX, (long)16384 ); // for reduced binary size.
|
||||||
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("Step"), (long)2 );
|
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("Step"), (long)2 );
|
||||||
|
pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("MotionSpin"), true );
|
||||||
//pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("Wrap"), true );
|
//pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("Wrap"), true );
|
||||||
|
|
||||||
pg->SetPropertyHelpString( wxT("SpinCtrl"),
|
pg->SetPropertyHelpString( wxT("SpinCtrl"),
|
||||||
|
@@ -108,6 +108,14 @@ bool operator == (const wxArrayInt& array1, const wxArrayInt& array2)
|
|||||||
#if wxUSE_SPINBTN
|
#if wxUSE_SPINBTN
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
#define IS_MOTION_SPIN_SUPPORTED 1
|
||||||
|
#else
|
||||||
|
#define IS_MOTION_SPIN_SUPPORTED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if IS_MOTION_SPIN_SUPPORTED
|
||||||
|
|
||||||
//
|
//
|
||||||
// This class implements ability to rapidly change "spin" value
|
// This class implements ability to rapidly change "spin" value
|
||||||
// by moving mouse when one of the spin buttons is depressed.
|
// by moving mouse when one of the spin buttons is depressed.
|
||||||
@@ -222,6 +230,8 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // IS_MOTION_SPIN_SUPPORTED
|
||||||
|
|
||||||
|
|
||||||
WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(SpinCtrl,
|
WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(SpinCtrl,
|
||||||
wxPGSpinCtrlEditor,
|
wxPGSpinCtrlEditor,
|
||||||
@@ -245,7 +255,16 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP
|
|||||||
|
|
||||||
wxSpinButton* wnd2;
|
wxSpinButton* wnd2;
|
||||||
|
|
||||||
wnd2 = new wxPGSpinButton();
|
#if IS_MOTION_SPIN_SUPPORTED
|
||||||
|
if ( property->GetAttributeAsLong(wxT("MotionSpin"), 0) )
|
||||||
|
{
|
||||||
|
wnd2 = new wxPGSpinButton();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
wnd2 = new wxSpinButton();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wnd2->Hide();
|
wnd2->Hide();
|
||||||
@@ -296,11 +315,16 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper
|
|||||||
|
|
||||||
if ( evtType == wxEVT_SCROLL_LINEUP || evtType == wxEVT_SCROLL_LINEDOWN )
|
if ( evtType == wxEVT_SCROLL_LINEUP || evtType == wxEVT_SCROLL_LINEDOWN )
|
||||||
{
|
{
|
||||||
wxPGSpinButton* spinButton =
|
#if IS_MOTION_SPIN_SUPPORTED
|
||||||
(wxPGSpinButton*) propgrid->GetEditorControlSecondary();
|
if ( property->GetAttributeAsLong(wxT("MotionSpin"), 0) )
|
||||||
|
{
|
||||||
|
wxPGSpinButton* spinButton =
|
||||||
|
(wxPGSpinButton*) propgrid->GetEditorControlSecondary();
|
||||||
|
|
||||||
if ( spinButton )
|
if ( spinButton )
|
||||||
spins = spinButton->GetSpins();
|
spins = spinButton->GetSpins();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxString s;
|
wxString s;
|
||||||
// Can't use wnd since it might be clipper window
|
// Can't use wnd since it might be clipper window
|
||||||
|
Reference in New Issue
Block a user