]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcbase.cpp
really show the menubar (calling Show(TRUE) doesn't do it any more)
[wxWidgets.git] / src / common / dcbase.cpp
index 75b4c6ac7968aeceb0df3d0e46e0f550bdb1739c..88612bfdb10948ec573bfe2ee830dad90c7c2f86 100644 (file)
@@ -108,14 +108,14 @@ void wxDCBase::DrawPolygon(const wxList *list,
 
 void
 wxDCBase::DoDrawPolyPolygon(int n,
-                            int start[],
+                            int count[],
                             wxPoint points[],
                             wxCoord xoffset, wxCoord yoffset,
                             int fillStyle)
 {
     if ( n == 1 )
     {
-        DoDrawPolygon(start[0], points, xoffset, yoffset, fillStyle);
+        DoDrawPolygon(count[0], points, xoffset, yoffset, fillStyle);
         return;
     }
 
@@ -126,14 +126,14 @@ wxDCBase::DoDrawPolyPolygon(int n,
     for (i = j = lastOfs = 0; i < n; i++)
     {
         lastOfs = j;
-        j      += start[i];
+        j      += count[i];
     }
     pts = new wxPoint[j+n-1];
     for (i = 0; i < j; i++)
         pts[i] = points[i];
     for (i = 2; i <= n; i++)
     {
-        lastOfs -= start[n-i];
+        lastOfs -= count[n-i];
         pts[j++] = pts[lastOfs];
     }
 
@@ -143,10 +143,10 @@ wxDCBase::DoDrawPolyPolygon(int n,
     SetPen(pen);
     for (i = j = 0; i < n; i++)
     {
-        DoDrawLines(start[i], pts+j, xoffset, yoffset);
-        j += start[i];
+        DoDrawLines(count[i], pts+j, xoffset, yoffset);
+        j += count[i];
     }
-    delete pts;
+    delete[] pts;
 }
 
 // ----------------------------------------------------------------------------
@@ -365,6 +365,36 @@ void wxDCBase::DoDrawSpline( wxList *points )
 
 #endif // wxUSE_SPLINES
 
+// ----------------------------------------------------------------------------
+// Partial Text Extents
+// ----------------------------------------------------------------------------
+
+
+// Each element of the array will be the width of the string up to and
+// including the coresoponding character in text.  This is the generic
+// implementation, the port-specific classes should do this with native APIs
+// if available.
+
+bool wxDCBase::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
+{
+    int totalWidth = 0;
+    size_t i;
+
+    widths.Empty();
+    widths.Add(0, text.Length());
+    
+    // Calculate the position of each character based on the widths of
+    // the previous characters
+    for (i=0; i<text.Length(); i++) {
+        int w, h;
+        GetTextExtent(text[i], &w, &h);
+        totalWidth += w;
+        widths[i] = totalWidth;
+    }
+    return true;
+}
+
+
 // ----------------------------------------------------------------------------
 // enhanced text drawing
 // ----------------------------------------------------------------------------