]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/slider.cpp
fix for wxDateTime::SetToYearDay(last month day) (bug 816065)
[wxWidgets.git] / src / os2 / slider.cpp
index c548169535a1ce35ebf7a53d6110a7947c3f8a74..0a6eb8f9854990a7d3d4549c571330f4ae206c1a 100644 (file)
@@ -104,7 +104,7 @@ void wxSlider::AdjustSubControls(
                               ,(LONG)nXOffset - (nMinLen + nCx)
                               ,(LONG)nYOffset
                               ,(LONG)nMinLen
-                              ,(LONG)nCy
+                              ,(LONG)nCyf
                               ,SWP_SIZE | SWP_MOVE
                              );
             nXOffset += nWidth + nCx;
@@ -114,7 +114,7 @@ void wxSlider::AdjustSubControls(
                               ,(LONG)nXOffset
                               ,(LONG)nYOffset
                               ,(LONG)nMaxLen
-                              ,(LONG)nCy
+                              ,(LONG)nCyf
                               ,SWP_ZORDER | SWP_SHOW
                              );
         }
@@ -125,20 +125,20 @@ void wxSlider::AdjustSubControls(
         // Now deal with a vertical slider
         //
 
-        if (m_lWindowStyle & winSL_LABELS )
+        if (m_windowStyle & wxSL_LABELS )
         {
             int                     nMinLen = 0;
             int                     nMaxLen = 0;
 
             ::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf);
-            GetTextExtent(zBuf, &lMinLen, &nCyf, NULL, NULL, &this->GetFont());
+            GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &this->GetFont());
 
             ::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf);
-            GetTextExtent(zBuf, &lMaxLen, &nCyf, NULL, NULL, &this->GetFont());
+            GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &this->GetFont());
 
             if (m_hStaticValue)
             {
-                int                 nNewWidth = (DAWUTL_MAX(nMinLen, nMaxLen));
+                int                 nNewWidth = (wxMax(nMinLen, nMaxLen));
 
                 ::WinSetWindowPos( (HWND)m_hStaticValue
                                   ,HWND_TOP
@@ -204,9 +204,7 @@ bool wxSlider::Create(
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
@@ -286,7 +284,7 @@ bool wxSlider::Create(
     if (m_windowStyle & wxSL_VERTICAL)
         lMsStyle = SLS_VERTICAL | SLS_HOMEBOTTOM | WS_VISIBLE | WS_TABSTOP;
     else
-        lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT| WS_VISIBLE | WS_TABSTOP;
+        lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT | WS_VISIBLE | WS_TABSTOP;
 
     if (m_windowStyle & wxCLIP_SIBLINGS)
         lMsStyle |= WS_CLIPSIBLINGS;
@@ -321,7 +319,7 @@ bool wxSlider::Create(
                                                                    ,(ULONG)lMsStyle          // Style flags
                                                                    ,0L, 0L, 0L, 0L           // Origin -- 0 size
                                                                    ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
-                                                                   ,HWND_TOP                 // initial z position
+                                                                   ,HWND_BOTTOM                 // initial z position
                                                                    ,(HMENU)m_windowId       // Window identifier
                                                                    ,&vSlData                 // Slider control data
                                                                    ,NULL                     // no Presentation parameters
@@ -392,6 +390,8 @@ bool wxSlider::Create(
         }
     }
 
+    SetXComp(0);
+    SetYComp(0);
     SetSize( nX
             ,nY
             ,nWidth
@@ -461,7 +461,6 @@ bool wxSlider::Create(
                       ,(PVOID)&lColor
                      );
     SetValue(nValue);
-    delete pTextFont;
     return TRUE;
 } // end of wxSlider::Create
 
@@ -590,6 +589,14 @@ void wxSlider::DoSetSize(
                               ,(LONG)nSliderHeight
                               ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
                              );
+            ::WinQueryWindowPos(GetHwnd(), GetSwp());
+            ::WinSendMsg( GetHwnd()
+                         ,SLM_SETSLIDERINFO
+                         ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
+                                       ,0
+                                      )
+                         ,MPFROMLONG((ULONG)(nSliderHeight/2))
+                        );
             nXOffset += nSliderLength + nCx;
 
             ::WinSetWindowPos( (HWND)m_hStaticMax
@@ -648,26 +655,20 @@ void wxSlider::DoSetSize(
                 int              nNewWidth = wxMax(nMinLen, nMaxLen);
                 int              nValueHeight = nCyf;
 
-                nNewWidth += nCx;
-
-                //
-                // The height needs to be a bit bigger under Win95 if using native
-                // 3D effects.
-                //
                 ::WinSetWindowPos( (HWND)m_hStaticValue
                                   ,HWND_TOP
                                   ,(LONG)nXOffset
-                                  ,(LONG)nYOffset + lHeight
+                                  ,(LONG)nYOffset + nHeight
                                   ,(LONG)nNewWidth
                                   ,(LONG)nValueHeight
                                   ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
                                  );
-                nUsedHeight += nCy;
+                nUsedHeight += nCyf;
             }
             ::WinSetWindowPos( (HWND)m_hStaticMin
                               ,HWND_TOP
                               ,(LONG)nXOffset
-                              ,(LONG)nYOffset + lHeight -lCyf
+                              ,(LONG)nYOffset + nHeight - nCyf
                               ,(LONG)nMinLen
                               ,(LONG)nCy
                               ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
@@ -689,16 +690,24 @@ void wxSlider::DoSetSize(
             ::WinSetWindowPos( GetHwnd()
                               ,HWND_TOP
                               ,(LONG)nXOffset
-                              ,(LONG)nYOffset
+                              ,(LONG)nYOffset + nCyf
                               ,(LONG)nSliderWidth
                               ,(LONG)nSliderLength
                               ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
                              );
+            ::WinQueryWindowPos(GetHwnd(), GetSwp());
+            ::WinSendMsg( GetHwnd()
+                         ,SLM_SETSLIDERINFO
+                         ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
+                                       ,0
+                                      )
+                         ,MPFROMLONG((ULONG)(nSliderWidth/2))
+                        );
             nUsedHeight += nSliderLength;
             ::WinSetWindowPos( (HWND)m_hStaticMax
                               ,HWND_TOP
                               ,(LONG)nXOffset
-                              ,(LONG)nYOffset
+                              ,(LONG)nYOffset - nCyf
                               ,(LONG)nMaxLen
                               ,(LONG)nCy
                               ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW