]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/slider.cpp
Popup Menu processing.
[wxWidgets.git] / src / os2 / slider.cpp
index e8558d2e8db3b005446da2a933fcd494ce1d30d8..7819dca287ef0ef6af1bea376e76fcede34513ab 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <wx/utils.h>
 #include <wx/brush.h>
+#include <wx/scrolwin.h>
 #endif
 
 #include "wx/slider.h"
@@ -200,6 +201,15 @@ bool wxSlider::Create(
     {
         lMsStyle |= WS_VISIBLE | SS_TEXT | DT_VCENTER;
 
+        //
+        // If the parent is a scrolled window the controls must
+        // have this style or they will overlap the scrollbars
+        //
+        if (pParent)
+            if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
+                pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
+                lMsStyle |= WS_CLIPSIBLINGS;
+
         m_hStaticValue = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                                    ,WC_STATIC                // Window class
                                                    ,(PSZ)NULL                // Initial Text
@@ -219,6 +229,15 @@ bool wxSlider::Create(
         lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE;
         if (m_windowStyle & wxCLIP_SIBLINGS)
             lWstyle |= WS_CLIPSIBLINGS;
+        //
+        // If the parent is a scrolled window the controls must
+        // have this style or they will overlap the scrollbars
+        //
+        if (pParent)
+            if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
+                pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
+                lWstyle |= WS_CLIPSIBLINGS;
+
         m_hStaticMin = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                                  ,WC_STATIC                // Window class
                                                  ,(PSZ)wxBuffer            // Initial Text
@@ -263,6 +282,15 @@ bool wxSlider::Create(
     else
         lMsStyle |= SLS_PRIMARYSCALE2;
 
+    //
+    // If the parent is a scrolled window the controls must
+    // have this style or they will overlap the scrollbars
+    //
+    if (pParent)
+        if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
+            pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
+            lMsStyle |= WS_CLIPSIBLINGS;
+
     m_nPageSize = ((nMaxValue - nMinValue)/10);
     vSlData.usScale1Increments = m_nPageSize;
     vSlData.usScale2Increments = m_nPageSize;
@@ -301,7 +329,7 @@ bool wxSlider::Create(
     m_hWnd = (WXHWND)hScrollBar;
     SubclassWin(GetHWND());
     ::WinSetWindowText((HWND)m_hWnd, "");
-    SetFont(pParent->GetFont());
+    SetFont(*wxSMALL_FONT);
     if (m_windowStyle & wxSL_LABELS)
     {
         //
@@ -311,6 +339,15 @@ bool wxSlider::Create(
         lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE;
         if (m_windowStyle & wxCLIP_SIBLINGS)
             lMsStyle |= WS_CLIPSIBLINGS;
+        //
+        // If the parent is a scrolled window the controls must
+        // have this style or they will overlap the scrollbars
+        //
+        if (pParent)
+            if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
+                pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
+                lWstyle |= WS_CLIPSIBLINGS;
+
         m_hStaticMax = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                                  ,WC_STATIC                // Window class
                                                  ,(PSZ)wxBuffer            // Initial Text
@@ -382,6 +419,27 @@ bool wxSlider::Create(
                       ,sizeof(LONG)
                       ,(PVOID)&lColor
                      );
+    lColor = (LONG)m_backgroundColour.GetPixel();
+    ::WinSetPresParam( m_hStaticMin
+                      ,PP_BACKGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
+    ::WinSetPresParam( m_hStaticMax
+                      ,PP_BACKGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
+    ::WinSetPresParam( m_hStaticValue
+                      ,PP_BACKGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
+    ::WinSetPresParam( m_hWnd
+                      ,PP_BACKGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
     SetValue(nValue);
     return TRUE;
 } // end of wxSlider::Create