GtkWidget *widget = window->m_wxwindow;
// Some controls don't have m_wxwindow - like wxStaticBox, but the user
- // code should still be able to create wxClientDCs for them, so we will
- // use the parent window here then.
+ // code should still be able to create wxClientDCs for them
if ( !widget )
{
- window = window->GetParent();
- if (window)
- widget = window->m_wxwindow;
- }
+ widget = window->m_widget;
+
+ wxCHECK_RET(widget, "DC needs a widget");
- wxASSERT_MSG( widget, wxT("DC needs a widget") );
+ if (GTK_WIDGET_NO_WINDOW(widget))
+ SetDeviceLocalOrigin(widget->allocation.x, widget->allocation.y);
+ }
- m_context = window->GtkGetPangoDefaultContext();
+ m_context = window->GTKGetPangoDefaultContext();
m_layout = pango_layout_new( m_context );
m_fontdesc = pango_font_description_copy( widget->style->font_desc );
return;
}
- m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
+ m_cmap = gtk_widget_get_colormap(widget);
SetUpDC();
wxCHECK_MSG( metrics, -1, _T("failed to get pango font metrics") );
wxCoord h = PANGO_PIXELS (pango_font_metrics_get_descent (metrics) +
- pango_font_metrics_get_ascent (metrics));
+ pango_font_metrics_get_ascent (metrics));
pango_font_metrics_unref (metrics);
return h;
}
{
PangoContext *oldContext = m_context;
- m_context = m_window->GtkGetPangoDefaultContext();
+ m_context = m_window->GTKGetPangoDefaultContext();
// If we switch back/forth between different contexts
// we also have to create a new layout. I think so,
case wxNO_OP: mode = GDK_NOOP; break;
case wxSRC_INVERT: mode = GDK_COPY_INVERT; break;
case wxNOR: mode = GDK_NOR; break;
+ default:
+ wxFAIL_MSG("unknown mode");
+ return;
}
m_logicalFunction = function;