+#endif
+}
+
+// Uses the theme to draw the border and fill for something like a wxTextCtrl
+void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags)
+{
+ wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc);
+ if (drawable == NULL)
+ return;
+
+ GtkWidget* entry = wxGTKPrivate::GetTextEntryWidget();
+
+ GtkStateType state = GTK_STATE_NORMAL;
+ if ( flags & wxCONTROL_DISABLED )
+ state = GTK_STATE_INSENSITIVE;
+
+ gtk_widget_set_can_focus(entry, (flags & wxCONTROL_CURRENT) != 0);
+
+#ifdef __WXGTK3__
+ GtkStyleContext* sc = gtk_widget_get_style_context(entry);
+ gtk_style_context_save(sc);
+ gtk_style_context_set_state(sc, stateTypeToFlags[state]);
+ gtk_render_background(sc, drawable, rect.x, rect.y, rect.width, rect.height);
+ gtk_render_frame(sc, drawable, rect.x, rect.y, rect.width, rect.height);
+ gtk_style_context_restore(sc);
+#else
+ gtk_paint_shadow
+ (
+ gtk_widget_get_style(entry),
+ drawable,
+ state,
+ GTK_SHADOW_OUT,
+ NULL_RECT
+ entry,
+ "entry",
+ dc.LogicalToDeviceX(rect.x),
+ dc.LogicalToDeviceY(rect.y),
+ rect.width,
+ rect.height
+ );
+#endif
+}
+
+// Draw the equivalent of a wxComboBox
+void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags)
+{
+ wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc);
+ if (drawable == NULL)
+ return;
+
+ GtkWidget* combo = wxGTKPrivate::GetComboBoxWidget();
+
+ GtkStateType state = GTK_STATE_NORMAL;
+ if ( flags & wxCONTROL_DISABLED )
+ state = GTK_STATE_INSENSITIVE;
+
+ gtk_widget_set_can_focus(combo, (flags & wxCONTROL_CURRENT) != 0);
+
+#ifdef __WXGTK3__
+ GtkStyleContext* sc = gtk_widget_get_style_context(combo);
+ gtk_style_context_save(sc);
+ gtk_style_context_set_state(sc, stateTypeToFlags[state]);
+ gtk_render_background(sc, drawable, rect.x, rect.y, rect.width, rect.height);
+ gtk_render_frame(sc, drawable, rect.x, rect.y, rect.width, rect.height);
+ gtk_style_context_restore(sc);
+ wxRect r = rect;
+ r.x += r.width - r.height;
+ r.width = r.height;
+ DrawComboBoxDropButton(win, dc, r, flags);
+#else
+ gtk_paint_shadow
+ (
+ gtk_widget_get_style(combo),
+ drawable,
+ state,
+ GTK_SHADOW_OUT,
+ NULL_RECT
+ combo,
+ "combobox",
+ dc.LogicalToDeviceX(rect.x),
+ dc.LogicalToDeviceY(rect.y),
+ rect.width,
+ rect.height
+ );
+
+ wxRect r = rect;
+ int extent = rect.height / 2;
+ r.x += rect.width - extent - extent/2;
+ r.y += extent/2;
+ r.width = extent;
+ r.height = extent;
+
+ gtk_paint_arrow
+ (
+ gtk_widget_get_style(combo),
+ drawable,
+ state,
+ GTK_SHADOW_OUT,
+ NULL_RECT
+ combo,
+ "arrow",
+ GTK_ARROW_DOWN,
+ TRUE,
+ dc.LogicalToDeviceX(r.x),
+ dc.LogicalToDeviceY(r.y),
+ r.width,
+ r.height
+ );
+
+ r = rect;
+ r.x += rect.width - 2*extent;
+ r.width = 2;
+
+ gtk_paint_box
+ (
+ gtk_widget_get_style(combo),
+ drawable,
+ state,
+ GTK_SHADOW_ETCHED_OUT,
+ NULL_RECT
+ combo,
+ "vseparator",
+ dc.LogicalToDeviceX(r.x),
+ dc.LogicalToDeviceY(r.y+1),
+ r.width,
+ r.height-2
+ );
+#endif
+}
+
+void wxRendererGTK::DrawChoice(wxWindow* win, wxDC& dc,
+ const wxRect& rect, int flags)
+{
+ DrawComboBox( win, dc, rect, flags );
+}
+
+
+// Draw a themed radio button
+void wxRendererGTK::DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags)
+{
+ wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc);
+ if (drawable == NULL)
+ return;
+
+ GtkWidget* button = wxGTKPrivate::GetRadioButtonWidget();
+
+#ifdef __WXGTK3__
+ int state = GTK_STATE_FLAG_NORMAL;
+ if (flags & wxCONTROL_CHECKED)
+ state = GTK_STATE_FLAG_ACTIVE;
+ else if (flags & wxCONTROL_UNDETERMINED)
+ state = GTK_STATE_FLAG_INCONSISTENT;
+ if (flags & wxCONTROL_DISABLED)
+ state |= GTK_STATE_FLAG_INSENSITIVE;
+
+ GtkStyleContext* sc = gtk_widget_get_style_context(button);
+ gtk_style_context_save(sc);
+ gtk_style_context_add_class(sc, GTK_STYLE_CLASS_RADIO);
+ gtk_style_context_set_state(sc, GtkStateFlags(state));
+ gtk_render_option(sc, drawable, rect.x, rect.y, rect.width, rect.height);
+ gtk_style_context_restore(sc);
+#else
+ GtkShadowType shadow_type = GTK_SHADOW_OUT;
+ if ( flags & wxCONTROL_CHECKED )
+ shadow_type = GTK_SHADOW_IN;
+ else if ( flags & wxCONTROL_UNDETERMINED )
+ shadow_type = GTK_SHADOW_ETCHED_IN;
+
+ GtkStateType state = GTK_STATE_NORMAL;
+ if ( flags & wxCONTROL_DISABLED )
+ state = GTK_STATE_INSENSITIVE;
+ if ( flags & wxCONTROL_PRESSED )
+ state = GTK_STATE_ACTIVE;
+/*
+ Don't know when to set this
+ state_type = GTK_STATE_PRELIGHT;
+*/
+
+ gtk_paint_option
+ (
+ gtk_widget_get_style(button),
+ drawable,
+ state,
+ shadow_type,
+ NULL_RECT
+ button,
+ "radiobutton",
+ dc.LogicalToDeviceX(rect.x),
+ dc.LogicalToDeviceY(rect.y),
+ rect.width, rect.height
+ );
+#endif