]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/gauge.cpp
replace apple extended code
[wxWidgets.git] / src / os2 / gauge.cpp
index c1fe612f6c8c1bd3a4a479801be38f572450dd76..3ad621de7393ce08c5d3fea0de7086f024c7d79a 100644 (file)
@@ -14,6 +14,7 @@
 #ifndef WX_PRECOMP
 #include "wx/defs.h"
 #include "wx/utils.h"
+#include "wx/scrolwin.h"
 #endif
 
 #include "wx/os2/private.h"
@@ -36,12 +37,10 @@ MRESULT EXPENTRY wxGaugeWndProc(
     wxGauge*                        pGauge = (wxGauge *)::WinQueryWindowULong( hWnd
                                                                               ,QWL_USER
                                                                              );
-    wxWindowOS2*                    pWindow = NULL;
-    MRESULT                         rc = (MRESULT)0;
-    bool                            bProcessed = FALSE;
     HPS                             hPS;
     RECTL                           vRect;
     RECTL                           vRect2;
+    RECTL                           vRect3;
     double                          dPixelToRange = 0.0;
     double                          dRange = 0.0;
 
@@ -69,28 +68,55 @@ MRESULT EXPENTRY wxGaugeWndProc(
                                          ,0L
                                          ,NULL
                                         );
+                //
+                // Draw the guage box
+                //
+                LONG                lColor = 0x00FFFFFF; // White
+                POINTL              vPoint = {vRect.xLeft + 1, vRect.yBottom + 1};
+
+                ::GpiSetColor(hPS, lColor);
+                ::GpiMove(hPS, &vPoint);
+                vPoint.x = vRect.xRight - 1;
+                ::GpiLine(hPS, &vPoint);
+                vPoint.y = vRect.yTop - 1;
+                ::GpiLine(hPS, &vPoint);
+                lColor = 0x000C0C0C; // Darkish Grey to give depth feel
+                ::GpiSetColor(hPS, lColor);
+                vPoint.x = vRect.xLeft + 1;
+                ::GpiLine(hPS, &vPoint);
+                vPoint.y = vRect.yBottom + 1;
+                ::GpiLine(hPS, &vPoint);
+                vRect3.xLeft   = vRect.xLeft + 2;
+                vRect3.xRight  = vRect.xRight - 2;
+                vRect3.yTop    = vRect.yTop - 2;
+                vRect3.yBottom = vRect.yBottom + 2;
+
                 if (pGauge->GetWindowStyleFlag() & wxGA_VERTICAL)
                 {
-                    dRange = (double)(vRect.yTop - vRect.yBottom);
+                    dRange = (double)(vRect3.yTop - vRect3.yBottom);
                     dPixelToRange  = dRange/(double)pGauge->GetRange();
                     vRect2.yTop    = (int)(pGauge->GetValue() * dPixelToRange);
-                    vRect2.yBottom = vRect.yBottom;
-                    vRect2.xLeft   = vRect.xLeft;
-                    vRect2.xRight  = vRect.xRight;
-                    vRect.yBottom  = vRect2.yTop;
-                    ::WinFillRect(hPS, &vRect,  pGauge->GetBackgroundColour().GetPixel());
+                    vRect2.yBottom = vRect3.yBottom;
+                    vRect2.xLeft   = vRect3.xLeft;
+                    vRect2.xRight  = vRect3.xRight;
+                    vRect3.yBottom  = vRect2.yTop;
+                    if (vRect3.yBottom <= 1)
+                         vRect3.yBottom = 2;
+                    ::WinFillRect(hPS, &vRect3,  pGauge->GetBackgroundColour().GetPixel());
                     ::WinFillRect(hPS, &vRect2, pGauge->GetForegroundColour().GetPixel());
                 }
                 else
                 {
-                    dRange = (double)(vRect.xRight - vRect.xLeft);
+                    dRange = (double)(vRect3.xRight - vRect3.xLeft);
                     dPixelToRange  = dRange/(double)pGauge->GetRange();
-                    vRect2.yTop    = vRect.yTop;
-                    vRect2.yBottom = vRect.yBottom;
-                    vRect2.xLeft   = vRect.xLeft;
+                    vRect2.yTop    = vRect3.yTop;
+                    vRect2.yBottom = vRect3.yBottom;
+                    vRect2.xLeft   = vRect3.xLeft;
                     vRect2.xRight  = (int)(pGauge->GetValue() * dPixelToRange);
-                    vRect.xLeft = vRect2.xRight;
-                    ::WinFillRect(hPS, &vRect,  pGauge->GetBackgroundColour().GetPixel());
+                    vRect3.xLeft = vRect2.xRight;
+                    if (vRect3.xLeft <= 1)
+                        vRect3.xLeft = 2;
+                    ::WinFillRect(hPS, &vRect3,  pGauge->GetBackgroundColour().GetPixel());
                     ::WinFillRect(hPS, &vRect2, pGauge->GetForegroundColour().GetPixel());
                 }
                 ::WinEndPaint(hPS);
@@ -111,9 +137,7 @@ bool wxGauge::Create(
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
@@ -130,8 +154,8 @@ bool wxGauge::Create(
 #endif
     if (pParent)
         pParent->AddChild(this);
-    SetBackgroundColour(pParent->GetBackgroundColour()) ;
-    SetForegroundColour(pParent->GetForegroundColour()) ;
+    m_backgroundColour.Set(wxString("LIGHT GREY"));
+    m_foregroundColour.Set(wxString("NAVY"));
 
     m_nRangeMax   = nRange;
     m_nGaugePos   = 0;
@@ -155,8 +179,6 @@ bool wxGauge::Create(
     if (m_windowStyle & wxCLIP_SIBLINGS)
         lMsStyle |= WS_CLIPSIBLINGS;
 
-
-
     m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
                                        ,WC_ENTRYFIELD            // Window class
                                        ,(PSZ)NULL                // Initial Text
@@ -177,7 +199,12 @@ bool wxGauge::Create(
     ::WinQueryWindowPos(m_hWnd, &vSwp);
     SetXComp(vSwp.x);
     SetYComp(vSwp.y);
-    SetFont(pParent->GetFont());
+    wxFont*                          pTextFont = new wxFont( 10
+                                                            ,wxMODERN
+                                                            ,wxNORMAL
+                                                            ,wxNORMAL
+                                                           );
+    SetFont(*pTextFont);
     if (nWidth == -1L)
         nWidth = 50L;
     if (nHeight == -1L)
@@ -188,6 +215,7 @@ bool wxGauge::Create(
             ,nHeight
            );
     ::WinShowWindow((HWND)GetHWND(), TRUE);
+    delete pTextFont;
     return TRUE;
 } // end of wxGauge::Create