+ wxGauge* pGauge = (wxGauge *)::WinQueryWindowULong( hWnd
+ ,QWL_USER
+ );
+ wxWindowOS2* pWindow = NULL;
+ MRESULT rc = (MRESULT)0;
+ bool bProcessed = FALSE;
+ HPS hPS;
+ RECTL vRect;
+ RECTL vRect2;
+ double dPixelToRange = 0.0;
+ double dRange = 0.0;
+
+ switch (uMessage )
+ {
+ case WM_PAINT:
+ hPS = ::WinBeginPaint( hWnd
+ ,NULLHANDLE
+ ,&vRect
+ );
+ if(hPS)
+ {
+ ::WinQueryWindowRect(hWnd, &vRect);
+ ::GpiCreateLogColorTable( hPS
+ ,0L
+ ,LCOLF_CONSECRGB
+ ,0L
+ ,(LONG)wxTheColourDatabase->m_nSize
+ ,(PLONG)wxTheColourDatabase->m_palTable
+ );
+ ::GpiCreateLogColorTable( hPS
+ ,0L
+ ,LCOLF_RGB
+ ,0L
+ ,0L
+ ,NULL
+ );
+ if (pGauge->GetWindowStyleFlag() & wxGA_VERTICAL)
+ {
+ dRange = (double)(vRect.yTop - vRect.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());
+ ::WinFillRect(hPS, &vRect2, pGauge->GetForegroundColour().GetPixel());
+ }
+ else
+ {
+ dRange = (double)(vRect.xRight - vRect.xLeft);
+ dPixelToRange = dRange/(double)pGauge->GetRange();
+ vRect2.yTop = vRect.yTop;
+ vRect2.yBottom = vRect.yBottom;
+ vRect2.xLeft = vRect.xLeft;
+ vRect2.xRight = (int)(pGauge->GetValue() * dPixelToRange);
+ vRect.xLeft = vRect2.xRight;
+ ::WinFillRect(hPS, &vRect, pGauge->GetBackgroundColour().GetPixel());
+ ::WinFillRect(hPS, &vRect2, pGauge->GetForegroundColour().GetPixel());
+ }
+ ::WinEndPaint(hPS);
+ }
+ }
+ return (fnWndProcGauge( hWnd
+ ,(ULONG)uMessage
+ ,(MPARAM)wParam
+ ,(MPARAM)lParam
+ )
+ );
+} // end of wxGaugeWndProc
+
+bool wxGauge::Create(
+ wxWindowOS2* pParent
+, wxWindowID vId
+, int nRange
+, const wxPoint& rPos
+, const wxSize& rSize
+, long lStyle
+#if wxUSE_VALIDATORS
+, const wxValidator& rValidator
+#endif
+, const wxString& rsName
+)
+{
+ int nX = rPos.x;
+ int nY = rPos.y;
+ int nWidth = rSize.x;
+ int nHeight = rSize.y;
+ long lMsStyle = 0L;
+
+ SetName(rsName);
+#if wxUSE_VALIDATORS
+ SetValidator(rValidator);
+#endif
+ if (pParent)
+ pParent->AddChild(this);
+ SetBackgroundColour(pParent->GetBackgroundColour()) ;
+ SetForegroundColour(pParent->GetForegroundColour()) ;