yy += pizza->yoffset;
}
- wxNode *node = win->GetChildren().First();
+ wxWindowList::Node *node = win->GetChildren().GetFirst();
while (node)
{
- wxWindowGTK *child = (wxWindowGTK*)node->Data();
+ wxWindowGTK *child = node->GetData();
- node = node->Next();
+ node = node->GetNext();
if (!child->IsShown())
continue;
wxCHECK_MSG( m_font.Ok(), 12, wxT("invalid font") );
+#ifdef __WXGTK20__
+ PangoContext *context = NULL;
+ if (m_widget)
+ context = gtk_widget_get_pango_context( m_widget );
+
+ if (!context)
+ return 0;
+
+ PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
+ PangoLayout *layout = pango_layout_new(context);
+ pango_layout_set_font_description(layout, desc);
+ pango_layout_set_text(layout, "H", 1);
+ PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
+
+ PangoRectangle rect;
+ pango_layout_line_get_extents(line, NULL, &rect);
+
+ g_object_unref( G_OBJECT( layout ) );
+
+ return (int) (rect.height / PANGO_SCALE);
+#else
GdkFont *font = m_font.GetInternalFont( 1.0 );
return font->ascent + font->descent;
+#endif
}
int wxWindowGTK::GetCharWidth() const
wxCHECK_MSG( m_font.Ok(), 8, wxT("invalid font") );
+#ifdef __WXGTK20__
+ PangoContext *context = NULL;
+ if (m_widget)
+ context = gtk_widget_get_pango_context( m_widget );
+
+ if (!context)
+ return 0;
+
+ PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
+ PangoLayout *layout = pango_layout_new(context);
+ pango_layout_set_font_description(layout, desc);
+ pango_layout_set_text(layout, "H", 1);
+ PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
+
+ PangoRectangle rect;
+ pango_layout_line_get_extents(line, NULL, &rect);
+
+ g_object_unref( G_OBJECT( layout ) );
+
+ return (int) (rect.width / PANGO_SCALE);
+#else
GdkFont *font = m_font.GetInternalFont( 1.0 );
return gdk_string_width( font, "H" );
+#endif
}
void wxWindowGTK::GetTextExtent( const wxString& string,
if (m_font != wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ))
{
- SET_STYLE_FONT(style, m_font.GetInternalFont( 1.0 ));
+#ifdef __WXGTK20__
+ pango_font_description_free( style->font_desc );
+ pango_font_description_copy( m_font.GetNativeFontInfo()->description );
+#else
+ gdk_font_unref( style->font );
+ style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+#endif
}
if (m_foregroundColour.Ok())
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
- if (!windowAtPtr)
- return wxPoint(-999, -999);
- Display *display = GDK_WINDOW_XDISPLAY(windowAtPtr);
+ Display *display = windowAtPtr ? GDK_WINDOW_XDISPLAY(windowAtPtr) : GDK_DISPLAY();
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
Window rootReturn, childReturn;
int rootX, rootY, winX, winY;