]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/control.cpp
disable select root menu command when the root is hidden
[wxWidgets.git] / src / gtk / control.cpp
index 4368959b6c8bf116e789e6d05bdddc9f3a472a91..7af2a52fc83209698e5f0b1de0342ff9929b0410 100644 (file)
 
 #if wxUSE_CONTROLS
 
-#include "wx/log.h"
 #include "wx/control.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/settings.h"
+#endif
+
 #include "wx/fontutil.h"
-#include "wx/settings.h"
 #include "wx/gtk/private.h"
 
 // ============================================================================
@@ -30,7 +34,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
 
 wxControl::wxControl()
 {
-    m_needParent = TRUE;
+    m_needParent = true;
 }
 
 bool wxControl::Create( wxWindow *parent,
@@ -78,7 +82,7 @@ void wxControl::PostCreation(const wxSize& size)
     gtk_widget_ensure_style(m_widget);
 
     ApplyWidgetStyle();
-    SetInitialBestSize(size);
+    SetInitialSize(size);
 }
 
 // ----------------------------------------------------------------------------
@@ -126,7 +130,7 @@ GtkWidget* wxControl::GTKCreateFrame(const wxString& label)
     GtkWidget* framewidget = gtk_frame_new(NULL);
     gtk_frame_set_label_widget(GTK_FRAME(framewidget), labelwidget);
 
-    return framewidget; //note that the label is already set so you'll 
+    return framewidget; //note that the label is already set so you'll
                         //only need to call wxControl::SetLabel afterwards
 }
 
@@ -248,9 +252,6 @@ wxVisualAttributes wxControl::GetDefaultAttributes() const
                                              UseGTKStyleBase());
 }
 
-
-#define SHIFT (8*(sizeof(short int)-sizeof(char)))
-
 // static
 wxVisualAttributes
 wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
@@ -273,17 +274,11 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
         state = GTK_STATE_NORMAL;
 
     // get the style's colours
-    attr.colFg = wxColour(style->fg[state].red   >> SHIFT,
-                          style->fg[state].green >> SHIFT,
-                          style->fg[state].blue  >> SHIFT);
+    attr.colFg = wxColour(style->fg[state]);
     if (useBase)
-        attr.colBg = wxColour(style->base[state].red   >> SHIFT,
-                              style->base[state].green >> SHIFT,
-                              style->base[state].blue  >> SHIFT);
+        attr.colBg = wxColour(style->base[state]);
     else
-        attr.colBg = wxColour(style->bg[state].red   >> SHIFT,
-                              style->bg[state].green >> SHIFT,
-                              style->bg[state].blue  >> SHIFT);
+        attr.colBg = wxColour(style->bg[state]);
 
     // get the style's font
     if ( !style->font_desc )
@@ -362,5 +357,24 @@ wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t widget_new,
     return attr;
 }
 
-#endif // wxUSE_CONTROLS
+// ----------------------------------------------------------------------------
+// idle handling
+// ----------------------------------------------------------------------------
 
+void wxControl::OnInternalIdle()
+{
+    if ( GtkShowFromOnIdle() )
+        return;
+
+    if ( GTK_WIDGET_REALIZED(m_widget) )
+    {
+        GTKUpdateCursor();
+
+        GTKSetDelayedFocusIfNeeded();
+    }
+
+    if ( wxUpdateUIEvent::CanUpdate(this) )
+        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
+}
+
+#endif // wxUSE_CONTROLS