X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f69e200970580080565c8aadc10893c29e46abeb..1ab36908f93242d578b42d314e93dec6a2e2819a:/src/gtk1/window.cpp?ds=sidebyside diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 2aa4d322f3..8947ad7008 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2655,6 +2655,7 @@ void wxWindowGTK::Init() #ifdef __WXGTK20__ m_imData = NULL; m_x11Context = NULL; + m_dirtyTabOrder = false; #else #ifdef HAVE_XIM m_ic = (GdkIC*) NULL; @@ -3116,6 +3117,11 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags void wxWindowGTK::OnInternalIdle() { +#ifdef __WXGTK20__ + if ( m_dirtyTabOrder ) + RealizeTabOrder(); +#endif + // Update invalidated regions. GtkUpdate(); @@ -3569,10 +3575,9 @@ void wxWindowGTK::GetTextExtent( const wxString& string, pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data )); #endif } - PangoLayoutLine *line = pango_layout_get_line(layout, 0); PangoRectangle rect; - pango_layout_line_get_extents(line, NULL, &rect); + pango_layout_get_extents(layout, NULL, &rect); if (x) (*x) = (wxCoord) PANGO_PIXELS(rect.width); if (y) (*y) = (wxCoord) PANGO_PIXELS(rect.height); @@ -3705,6 +3710,62 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child) (*m_insertCallback)(this, child); } +#ifdef __WXGTK20__ + +void wxWindowGTK::AddChild(wxWindowBase *child) +{ + wxWindowBase::AddChild(child); + m_dirtyTabOrder = true; + if (g_isIdle) + wxapp_install_idle_handler(); +} + +void wxWindowGTK::RemoveChild(wxWindowBase *child) +{ + wxWindowBase::RemoveChild(child); + m_dirtyTabOrder = true; + if (g_isIdle) + wxapp_install_idle_handler(); +} + +void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move) +{ + wxWindowBase::DoMoveInTabOrder(win, move); + m_dirtyTabOrder = true; + if (g_isIdle) + wxapp_install_idle_handler(); +} + +void wxWindowGTK::RealizeTabOrder() +{ + if (m_wxwindow) + { + if (m_children.size() > 0) + { + GList *chain = NULL; + + for (wxWindowList::const_iterator i = m_children.begin(); + i != m_children.end(); ++i) + { + chain = g_list_prepend(chain, (*i)->m_widget); + } + + chain = g_list_reverse(chain); + + gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain); + g_list_free(chain); + } + else + { + gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow)); + } + } + + m_dirtyTabOrder = false; +} + +#endif // __WXGTK20__ + void wxWindowGTK::Raise() { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );