]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
added support for <bg> tag for toolbars in XRC
[wxWidgets.git] / src / gtk / window.cpp
index dc244f803ac6e912935fc9696c18d6ba5295104a..43673380dcd5605bf515548d060726a7c26f0d93 100644 (file)
@@ -47,6 +47,7 @@
 #include "wx/settings.h"
 #include "wx/log.h"
 #include "wx/fontutil.h"
+#include "wx/stattext.h"
 
 #ifdef __WXDEBUG__
     #include "wx/thread.h"
@@ -2954,7 +2955,10 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
 void wxWindowGTK::OnInternalIdle()
 {
     if ( m_dirtyTabOrder )
+    {
+        m_dirtyTabOrder = false;
         RealizeTabOrder();
+    }
 
     // Update style if the window was not yet realized
     // and SetBackgroundStyle(wxBG_STYLE_CUSTOM) was called
@@ -3537,14 +3541,42 @@ void wxWindowGTK::RealizeTabOrder()
 {
     if (m_wxwindow)
     {
-        if (m_children.size() > 0)
+        if ( !m_children.empty() )
         {
+#if wxUSE_STATTEXT
+            // we don't only construct the correct focus chain but also use
+            // this opportunity to update the mnemonic widgets for all labels
+            //
+            // it would be nice to extract this code from here and put it in
+            // stattext.cpp to reduce dependencies but there is no really easy
+            // way to do it unfortunately
+            wxStaticText *lastLabel = NULL;
+#endif // wxUSE_STATTEXT
+
             GList *chain = NULL;
 
-            for (wxWindowList::const_iterator i = m_children.begin();
-                    i != m_children.end(); ++i)
+            for ( wxWindowList::const_iterator i = m_children.begin();
+                  i != m_children.end();
+                  ++i )
             {
-                chain = g_list_prepend(chain, (*i)->m_widget);
+                wxWindowGTK *win = *i;
+#if wxUSE_STATTEXT
+                if ( lastLabel )
+                {
+                    if ( win->AcceptsFocusFromKeyboard() )
+                    {
+                        GtkLabel *l = GTK_LABEL(lastLabel->m_widget);
+                        gtk_label_set_mnemonic_widget(l, win->m_widget);
+                        lastLabel = NULL;
+                    }
+                }
+                else // check if this one is a label
+                {
+                    lastLabel = wxDynamicCast(win, wxStaticText);
+                }
+#endif // wxUSE_STATTEXT
+
+                chain = g_list_prepend(chain, win->m_widget);
             }
 
             chain = g_list_reverse(chain);
@@ -3552,13 +3584,11 @@ void wxWindowGTK::RealizeTabOrder()
             gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain);
             g_list_free(chain);
         }
-        else
+        else // no children
         {
             gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow));
         }
     }
-
-    m_dirtyTabOrder = false;
 }
 
 void wxWindowGTK::Raise()