]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/slider95.cpp
[ 1509599 ] 'Split pickers page in widgets sample' with more icons and rebaking.
[wxWidgets.git] / src / msw / slider95.cpp
index 479a180b8210f3d9039abc1ef2df39ff7b8b6c59..480e82b6005c5f9e3b344aea8d38fa985727e476 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msw/slider.cpp
+// Name:        src/msw/slider.cpp
 // Purpose:     wxSlider, using the Win95 (and later) trackbar control
 // Author:      Julian Smart
 // Modified by:
 // declarations
 // ============================================================================
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "slider95.h"
-#endif
-
 // ----------------------------------------------------------------------------
 // headers
 // ----------------------------------------------------------------------------
 
 #if wxUSE_SLIDER
 
+#include "wx/slider.h"
+
 #ifndef WX_PRECOMP
     #include "wx/brush.h"
 #endif
 
-#include "wx/slider.h"
 #include "wx/msw/subwin.h"
 
-#if !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
-    #include <commctrl.h>
-#endif
-
-#define USE_DEFERRED_SIZING 1
+// include <commctrl.h> "properly"
+#include "wx/msw/wrapcctl.h"
 
 // ----------------------------------------------------------------------------
 // constants
@@ -109,7 +103,7 @@ wxBEGIN_FLAGS( wxSliderStyle )
 
 wxEND_FLAGS( wxSliderStyle )
 
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl,"wx/scrolbar.h")
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl,"wx/slider.h")
 
 wxBEGIN_PROPERTIES_TABLE(wxSlider)
     wxEVENT_RANGE_PROPERTY( Scroll , wxEVT_SCROLL_TOP , wxEVT_SCROLL_CHANGED , wxScrollEvent )
@@ -190,7 +184,7 @@ wxSlider::Create(wxWindow *parent,
             }
     };
 
-    wxASSERT_MSG( !(style & wxSL_VERTICAL) | !(style & wxSL_HORIZONTAL),
+    wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL),
                     _T("incompatible slider direction and orientation") );
 
 
@@ -460,16 +454,6 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
         return;
     }
 
-    // if our parent had prepared a defer window handle for us, use it (unless
-    // we are a top level window)
-    wxWindowMSW *parent = GetParent();
-
-#if USE_DEFERRED_SIZING
-    HDWP hdwp = parent && !IsTopLevel() ? (HDWP)parent->m_hDWP : NULL;
-#else
-    HDWP hdwp = 0;
-#endif    
-
     // be careful to position the slider itself after moving the labels as
     // otherwise our GetBoundingBox(), which is called from WM_SIZE handler,
     // would return a wrong result and wrong size would be cached internally
@@ -482,21 +466,20 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
 
         // position all labels: min at the top, value in the middle and max at
         // the bottom
-        wxMoveWindowDeferred(hdwp, this, (*m_labels)[SliderLabel_Min],
+        DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
                      xLabel, y, wLabel, hLabel);
 
-        wxMoveWindowDeferred(hdwp, this, (*m_labels)[SliderLabel_Value],
+        DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
                      xLabel, y + (height - hLabel)/2, wLabel, hLabel);
 
-        wxMoveWindowDeferred(hdwp, this, (*m_labels)[SliderLabel_Max],
-                     xLabel, y + height - hLabel, wLabel, hLabel);
+        DoMoveSibling((HWND)(*m_labels)[SliderLabel_Max],
+                      xLabel, y + height - hLabel, wLabel, hLabel);
 
         // position the slider itself along the left/right edge
-        wxMoveWindowDeferred(hdwp, this, GetHwnd(),
-                     HasFlag(wxSL_LEFT) ? x : x + wLabel + HGAP,
-                     y + hLabel/2,
-                     width - wLabel - HGAP,
-                     height - hLabel);
+        wxSliderBase::DoMoveWindow(HasFlag(wxSL_LEFT) ? x : x + wLabel + HGAP,
+                                   y + hLabel/2,
+                                   width - wLabel - HGAP,
+                                   height - hLabel);
     }
     else // horizontal
     {
@@ -507,30 +490,21 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
 
         // position all labels: min on the left, value in the middle and max to
         // the right
-        wxMoveWindowDeferred(hdwp, this, (*m_labels)[SliderLabel_Min],
-                     x, yLabel, wLabel, hLabel);
+        DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
+                      x, yLabel, wLabel, hLabel);
 
-        wxMoveWindowDeferred(hdwp, this, (*m_labels)[SliderLabel_Value],
-                     x + (width - wLabel)/2, yLabel, wLabel, hLabel);
+        DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
+                      x + (width - wLabel)/2, yLabel, wLabel, hLabel);
 
-        wxMoveWindowDeferred(hdwp, this, (*m_labels)[SliderLabel_Max],
-                     x + width - wLabel, yLabel, wLabel, hLabel);
+        DoMoveSibling((HWND)(*m_labels)[SliderLabel_Max],
+                      x + width - wLabel, yLabel, wLabel, hLabel);
 
         // position the slider itself along the top/bottom edge
-        wxMoveWindowDeferred(hdwp, this, GetHwnd(),
-                     x,
-                     HasFlag(wxSL_TOP) ? y : y + hLabel,
-                     width,
-                     height - hLabel);
+        wxSliderBase::DoMoveWindow(x,
+                                   HasFlag(wxSL_TOP) ? y : y + hLabel,
+                                   width,
+                                   height - hLabel);
     }
-
-#if USE_DEFERRED_SIZING
-    if ( parent )
-    {
-        // hdwp must be updated as it may have been changed
-        parent->m_hDWP = (WXHANDLE)hdwp;
-    }
-#endif
 }
 
 wxSize wxSlider::DoGetBestSize() const