Allow wxTextMeasure to work with non-native wxDC objects too.

Just forward back to wxDC itself in this case instead of using the
platform-specific code in wxTextMeasure that only works with native DCs.

See #14781.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72801 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-27 12:27:56 +00:00
parent 5fd78a8e6f
commit 1bce253a23
5 changed files with 90 additions and 8 deletions

View File

@@ -28,6 +28,7 @@
#include "wx/fontutil.h"
#include "wx/gtk/private.h"
#include "wx/gtk/dc.h"
#ifndef __WXGTK3__
#include "wx/gtk/dcclient.h"
@@ -41,11 +42,24 @@ void wxTextMeasure::Init()
{
wxASSERT_MSG( m_font, wxT("wxTextMeasure needs a valid wxFont") );
#ifndef __WXGTK3__
m_wdc = NULL;
#endif // GTK+ < 3
m_context = NULL;
m_layout = NULL;
#ifndef __WXGTK3__
m_wdc = NULL;
if ( m_dc )
{
wxClassInfo* const ci = m_dc->GetImpl()->GetClassInfo();
// Currently the code here only works with wxWindowDCImpl and only in
// wxGTK2 as wxGTK3 uses Cairo and not Pango for all its DCs.
if ( ci->IsKindOf(wxCLASSINFO(wxWindowDCImpl)))
{
m_useDCImpl = false;
}
}
#endif // GTK+ < 3
}
// Get Gtk needed elements, if we have not them yet.