]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcbase.cpp
Compilation fix for Innotek gcc.
[wxWidgets.git] / src / common / dcbase.cpp
index 75b4c6ac7968aeceb0df3d0e46e0f550bdb1739c..7f1b5170ec5ae8db0b75218d44e14f05e81ed330 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------