]> git.saurik.com Git - wxWidgets.git/commitdiff
SpinCtrl editor's 'value change by mouse motion' feature is made optional, enabled...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Thu, 11 Dec 2008 16:14:55 +0000 (16:14 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Thu, 11 Dec 2008 16:14:55 +0000 (16:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57252 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

interface/wx/propgrid/property.h
samples/propgrid/propgrid.cpp
src/propgrid/advprops.cpp

index fbd27ec03303a479aba17279825cd10c7803d936..9369d8cb964a5eb61e0b5318e906c0f21645f99d 100644 (file)
 */
 #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
     appear before list strings. If 2, user strings appear after list string.
 */
index 46baf1c55cba66aff2d168c4777f5d16b79be9a2..8cc2d539dac2d23b0923aa153a191081ecdb63e3 100644 (file)
@@ -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_MAX, (long)16384 );   // for reduced binary size.
     pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("Step"), (long)2 );
+    pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("MotionSpin"), true );
     //pg->SetPropertyAttribute( wxT("SpinCtrl"), wxT("Wrap"), true );
 
     pg->SetPropertyHelpString( wxT("SpinCtrl"),
index 5bd56c3cd4bb424a6a1162b046489d76de70904b..5c5a2e99fa81f9551ca567dbd08d325ad019c5ad 100644 (file)
@@ -108,6 +108,14 @@ bool operator == (const wxArrayInt& array1, const wxArrayInt& array2)
 #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
 // 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,
                                       wxPGSpinCtrlEditor,
@@ -245,7 +255,16 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP
 
     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__
     wnd2->Hide();
@@ -296,11 +315,16 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper
 
     if ( evtType == wxEVT_SCROLL_LINEUP || evtType == wxEVT_SCROLL_LINEDOWN )
     {
-        wxPGSpinButton* spinButton =
-            (wxPGSpinButton*) propgrid->GetEditorControlSecondary();
+    #if IS_MOTION_SPIN_SUPPORTED
+        if ( property->GetAttributeAsLong(wxT("MotionSpin"), 0) )
+        {
+            wxPGSpinButton* spinButton =
+                (wxPGSpinButton*) propgrid->GetEditorControlSecondary();
 
-        if ( spinButton )
-            spins = spinButton->GetSpins();
+            if ( spinButton )
+                spins = spinButton->GetSpins();
+        }
+    #endif
 
         wxString s;
         // Can't use wnd since it might be clipper window