wxDC new virtual function

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 1999-12-06 23:47:52 +00:00
parent 1b055864b6
commit c8ce6bccc3
2 changed files with 58 additions and 0 deletions

View File

@ -162,6 +162,8 @@ protected:
bool useMask = FALSE); bool useMask = FALSE);
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); 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, virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, wxDC *source, wxCoord xsrc, wxCoord ysrc,

View 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
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------