]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcbase.cpp
Remove apparently erroneous -1 from DrawBitmap() in wxMSW wxGC code.
[wxWidgets.git] / src / common / dcbase.cpp
index fdb0a2f1b7f6729d4dd9db5591aa3a6e76f17690..02f5ee8a3ee1a2d7e0c0a51943a52bfdaf409f36 100644 (file)
@@ -927,9 +927,9 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points )
     wx_spline_add_point(x1, y1);
 
     while ((node = node->GetNext())
-#if !wxUSE_STL
+#if !wxUSE_STD_CONTAINERS
            != NULL
-#endif // !wxUSE_STL
+#endif // !wxUSE_STD_CONTAINERS
           )
     {
         p = node->GetData();
@@ -1134,6 +1134,27 @@ void wxDCImpl::InheritAttributes(wxWindow *win)
     SetLayoutDirection(win->GetLayoutDirection());
 }
 
+void wxDCImpl::DoGetFontMetrics(int *height,
+                                int *ascent,
+                                int *descent,
+                                int *internalLeading,
+                                int *externalLeading,
+                                int *averageWidth) const
+{
+    // Average width is typically the same as width of 'x'.
+    wxCoord h, d;
+    DoGetTextExtent("x", averageWidth, &h, &d, externalLeading);
+
+    if ( height )
+        *height = h;
+    if ( ascent )
+        *ascent = h - d;
+    if ( descent )
+        *descent = d;
+    if ( internalLeading )
+        *internalLeading = 0;
+}
+
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -1296,7 +1317,14 @@ void wxDC::DrawLabel(const wxString& text,
         // it should be of the same colour as text
         SetPen(wxPen(GetTextForeground(), 0, wxPENSTYLE_SOLID));
 
-        yUnderscore--;
+        // This adjustment is relatively arbitrary: we need to draw the
+        // underline slightly higher to avoid overflowing the character cell
+        // but whether we should do it 1, 2 or 3 pixels higher is not clear.
+        //
+        // The currently used value seems to be compatible with native MSW
+        // behaviour, i.e. it results in the same appearance of the owner-drawn
+        // and normal labels.
+        yUnderscore -= 2;
 
         DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore);
     }
@@ -1574,7 +1602,7 @@ void wxDCImpl::CalculateEllipticPoints( wxPointList* points,
             y2 = y2-y-y+1;
             --y;
         }
-        // old y now to big: set point with old y, old x
+        // old y now too big: set point with old y, old x
         if( bNewPoint && x>1)
         {
             int x1 = x - 1;