]> git.saurik.com Git - wxWidgets.git/commitdiff
wxDC new virtual function
authorDavid Webster <Dave.Webster@bhmi.com>
Mon, 6 Dec 1999 23:47:52 +0000 (23:47 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Mon, 6 Dec 1999 23:47:52 +0000 (23:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/dc.h
src/os2/dc.cpp

index 434082c111470573ce3ca42dc36ad39fd92e36ec..2df64604bc96fa668742c672bf7a218c3091efbd 100644 (file)
@@ -162,6 +162,8 @@ protected:
                               bool useMask = FALSE);
 
     virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
                               bool useMask = FALSE);
 
     virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
+    virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
+                                   double angle);
 
     virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                         wxDC *source, wxCoord xsrc, wxCoord ysrc,
 
     virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                         wxDC *source, wxCoord xsrc, wxCoord ysrc,
index 14f009b007a66a1c1b57c5d5221e4260e7615571..8983710b325038683f759ba39ccb5eeab09328c1 100644 (file)
@@ -282,6 +282,62 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
    // TODO
 }
 
    // TODO
 }
 
+void wxDC::DoDrawRotatedText(const wxString& text,
+                             wxCoord x, wxCoord y,
+                             double angle)
+{
+   // TODO:
+   /*
+    if ( angle == 0.0 )
+    {
+        DoDrawText(text, x, y);
+    }
+    else
+    {
+        LOGFONT lf;
+        wxFillLogFont(&lf, &m_font);
+
+        // GDI wants the angle in tenth of degree
+        long angle10 = (long)(angle * 10);
+        lf.lfEscapement = angle10;
+        lf. lfOrientation = angle10;
+
+        HFONT hfont = ::CreateFontIndirect(&lf);
+        if ( !hfont )
+        {
+            wxLogLastError("CreateFont");
+        }
+        else
+        {
+            HFONT hfontOld = ::SelectObject(GetHdc(), hfont);
+
+            DrawAnyText(text, x, y);
+
+            (void)::SelectObject(GetHdc(), hfontOld);
+        }
+
+        // call the bounding box by adding all four vertices of the rectangle
+        // containing the text to it (simpler and probably not slower than
+        // determining which of them is really topmost/leftmost/...)
+        wxCoord w, h;
+        GetTextExtent(text, &w, &h);
+
+        double rad = DegToRad(angle);
+
+        // "upper left" and "upper right"
+        CalcBoundingBox(x, y);
+        CalcBoundingBox(x + w*cos(rad), y - h*sin(rad));
+        CalcBoundingBox(x + h*sin(rad), y + h*cos(rad));
+
+        // "bottom left" and "bottom right"
+        x += (wxCoord)(h*sin(rad));
+        y += (wxCoord)(h*cos(rad));
+        CalcBoundingBox(x, y);
+        CalcBoundingBox(x + h*sin(rad), y + h*cos(rad));
+    }
+*/
+}
+
 // ---------------------------------------------------------------------------
 // set GDI objects
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // set GDI objects
 // ---------------------------------------------------------------------------