]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ownerdrw.cpp
Added DoSetSize and DoMoveWindow to generic wxStaticLine.
[wxWidgets.git] / src / msw / ownerdrw.cpp
index 9e37e54adaf9bd9e994d6aae2f22407cdf0ce10e..1a01f87f3d7a69e9d4637b6b58ea11893834303f 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef WX_PRECOMP
   #include "wx/window.h"
-//  #include "wx/msw/private.h"
+  #include "wx/msw/private.h"
   #include "wx/font.h"
   #include "wx/bitmap.h"
   #include "wx/dcmemory.h"
@@ -94,13 +94,13 @@ bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight)
   {
       // Is BMP height larger then text height?
       size_t adjustedHeight = m_bmpChecked.GetHeight() +
-                              wxSystemSettings::GetSystemMetric(wxSYS_EDGE_Y);
+                              wxSystemSettings::GetMetric(wxSYS_EDGE_Y);
       if (*pheight < adjustedHeight)
           *pheight = adjustedHeight;
 
       // Does BMP encroach on default check menu position?
       size_t adjustedWidth = m_bmpChecked.GetWidth() +
-                             (wxSystemSettings::GetSystemMetric(wxSYS_EDGE_X) * 2);
+                             (wxSystemSettings::GetMetric(wxSYS_EDGE_X) * 2);
       if (ms_nDefaultMarginWidth < adjustedWidth)
           *pwidth += adjustedWidth - ms_nDefaultMarginWidth;
 
@@ -137,7 +137,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
     return TRUE;
 
   // wxColor <-> RGB
-  #define   ToRGB(col)  RGB(col.Red(), col.Green(), col.Blue())
+  #define   ToRGB(col)  PALETTERGB(col.Red(), col.Green(), col.Blue())
   #define   UnRGB(col)  GetRValue(col), GetGValue(col), GetBValue(col)
 
   // set the colors
@@ -190,10 +190,11 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
     }
 
     HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont);
-    DrawState(hdc, NULL, NULL,
-              (LPARAM)m_strName.c_str(), m_strName.length(),
-              x, rc.y, rc.GetWidth(), rc.GetHeight(),
-              DST_PREFIXTEXT | (st & wxODDisabled ? DSS_DISABLED : 0));
+
+    ::DrawState(hdc, NULL, NULL,
+                (LPARAM)m_strName.c_str(), m_strName.length(),
+                x, rc.y, rc.GetWidth(), rc.GetHeight(),
+                DST_PREFIXTEXT | (st & wxODDisabled ? DSS_DISABLED : 0));
 
     if ( !m_strAccel.empty() )
     {
@@ -233,9 +234,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
       RECT rect = { 0, 0, GetMarginWidth(), m_nHeight };
       if ( m_nHeight > 0 )
       {
-#ifndef __SC__
-        DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
-#endif
+        ::DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
       }
 
         // finally copy it to screen DC and clean up
@@ -264,21 +263,22 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
       // there should be enough place!
       wxASSERT((nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight()));
 
-      int heightDiff = (m_nHeight - nBmpHeight);
-//      if (heightDiff = -1)
-//        heightDiff = -2;
-
-      //MT: blit with mask enabled.
+      int heightDiff = m_nHeight - nBmpHeight;
       dc.Blit(rc.x + (GetMarginWidth() - nBmpWidth) / 2,
               rc.y + heightDiff / 2,
               nBmpWidth, nBmpHeight,
-              &dcMem, 0, 0, wxCOPY, TRUE);
+              &dcMem, 0, 0, wxCOPY, TRUE /* use mask */);
 
       if ( st & wxODSelected ) {
         #ifdef  O_DRAW_NATIVE_API
-          RECT rectBmp = { rc.GetLeft(), rc.GetTop(),
-                           rc.GetLeft() + GetMarginWidth(),
-                           rc.GetTop() + m_nHeight };
+          RECT rectBmp =
+          {
+              rc.GetLeft(),
+              rc.GetTop(),
+              rc.GetLeft() + GetMarginWidth() - 1,
+              rc.GetTop() + m_nHeight - 1
+          };
+
           SetBkColor(hdc, colBack);
           DrawEdge(hdc, &rectBmp, EDGE_RAISED, BF_SOFT | BF_RECT);
         #else