X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/24714ea3c5289d3d8a87bd7e529eafc7850ce10b..c127177f8dc31dbe99764852b8dbcc047d3ad826:/src/gtk/dcclient.cpp diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 3a4c1a9a74..918e0a52db 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -109,10 +109,23 @@ wxWindowDC::wxWindowDC( wxWindow *window ) m_owner = (wxWindow *)NULL; if (!window) return; + GtkWidget *widget = window->m_wxwindow; if (!widget) return; + m_window = widget->window; + + /* not realized ? */ + if (!m_window) + { + /* force realization */ + gtk_widget_realize( widget ); + m_window = widget->window; + } + + /* still not realized ? */ if (!m_window) return; + if (window->m_wxwindow) m_cmap = gtk_widget_get_colormap( window->m_wxwindow ); else @@ -825,8 +838,6 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh long *descent, long *externalLeading, wxFont *theFont, bool WXUNUSED(use16) ) { - wxCHECK_RET( Ok(), _T("invalid window dc") ); - wxFont fontToUse = m_font; if (theFont) fontToUse = *theFont; @@ -839,16 +850,12 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh long wxWindowDC::GetCharWidth() { - wxCHECK_MSG( Ok(), 0, _T("invalid window dc") ); - GdkFont *font = m_font.GetInternalFont( m_scaleY ); return long(gdk_string_width( font, "H" ) / m_scaleX); } long wxWindowDC::GetCharHeight() { - wxCHECK_MSG( Ok(), 0, _T("invalid window dc") ); - GdkFont *font = m_font.GetInternalFont( m_scaleY ); return long((font->ascent + font->descent) / m_scaleY); } @@ -883,8 +890,6 @@ void wxWindowDC::Clear() void wxWindowDC::SetFont( const wxFont &font ) { - wxCHECK_RET( Ok(), _T("invalid window dc") ); - m_font = font; } @@ -1036,8 +1041,21 @@ void wxWindowDC::SetLogicalFunction( int function ) GdkFunction mode = GDK_COPY; switch (function) { - case wxXOR: mode = GDK_INVERT; break; - case wxINVERT: mode = GDK_INVERT; break; + case wxXOR: mode = GDK_INVERT; break; + case wxINVERT: mode = GDK_INVERT; break; +#if (GDK_MINOR_VERSION > 0) + case wxOR_REVERSE: mode = GDK_OR_REVERSE; break; + case wxAND_REVERSE: mode = GDK_AND_REVERSE; break; + case wxCLEAR: mode = GDK_CLEAR; break; + case wxSET: mode = GDK_SET; break; + case wxOR_INVERT: mode = GDK_OR_INVERT; break; + case wxAND: mode = GDK_AND; break; + case wxOR: mode = GDK_OR; break; + case wxEQUIV: mode = GDK_EQUIV; break; + case wxNAND: mode = GDK_NAND; break; + case wxAND_INVERT: mode = GDK_AND_INVERT; break; +/* ? wxSRC_INVERT GDK_AND_REVERSE, GDK_OR_REVERSE, GDK_OR_INVERT */ +#endif default: break; }