+ GtkWidget *tree = wxGTKPrivate::GetTreeWidget();
+
+ GtkStateType state;
+ if ( flags & wxCONTROL_CURRENT )
+ state = GTK_STATE_PRELIGHT;
+ else
+ state = GTK_STATE_NORMAL;
+
+ int x_diff = 0;
+ if (win->GetLayoutDirection() == wxLayout_RightToLeft)
+ x_diff = rect.width;
+
+#ifdef __WXGTK3__
+ cairo_t* cr = wxGetGTKDrawable(win, dc);
+ if (cr)
+ {
+ gtk_widget_set_state_flags(tree, stateTypeToFlags[state], true);
+ GtkStyleContext* sc = gtk_widget_get_style_context(tree);
+ gtk_render_expander(sc, cr, rect.x - x_diff, rect.y, rect.width, rect.height);
+ }
+#else
+ // x and y parameters specify the center of the expander
+ GdkWindow* gdk_window = wxGetGTKDrawable(win, dc);
+ if (gdk_window == NULL)
+ return;
+ gtk_paint_expander
+ (
+ gtk_widget_get_style(tree),
+ gdk_window,
+ state,
+ NULL,
+ tree,
+ "treeview",
+ dc.LogicalToDeviceX(rect.x) + rect.width / 2 - x_diff,
+ dc.LogicalToDeviceY(rect.y) + rect.height / 2,
+ flags & wxCONTROL_EXPANDED ? GTK_EXPANDER_EXPANDED
+ : GTK_EXPANDER_COLLAPSED
+ );
+#endif
+}
+
+
+// ----------------------------------------------------------------------------
+// splitter sash drawing
+// ----------------------------------------------------------------------------
+
+static int GetGtkSplitterFullSize(GtkWidget* widget)
+{
+ gint handle_size;
+ gtk_widget_style_get(widget, "handle_size", &handle_size, NULL);
+
+ return handle_size;
+}
+
+wxSplitterRenderParams
+wxRendererGTK::GetSplitterParams(const wxWindow *WXUNUSED(win))
+{
+ // we don't draw any border, hence 0 for the second field
+ return wxSplitterRenderParams
+ (
+ GetGtkSplitterFullSize(wxGTKPrivate::GetSplitterWidget()),
+ 0,
+ true // hot sensitive
+ );
+}
+
+void
+wxRendererGTK::DrawSplitterBorder(wxWindow * WXUNUSED(win),
+ wxDC& WXUNUSED(dc),
+ const wxRect& WXUNUSED(rect),
+ int WXUNUSED(flags))
+{
+ // nothing to do
+}
+
+void
+wxRendererGTK::DrawSplitterSash(wxWindow* win,
+ wxDC& dc,
+ const wxSize& size,
+ wxCoord position,
+ wxOrientation orient,
+ int flags)
+{
+ if (gtk_widget_get_window(win->m_wxwindow) == NULL)
+ {
+ // window not realized yet
+ return;
+ }
+
+ wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc);
+ if (drawable == NULL)
+ return;
+
+ // are we drawing vertical or horizontal splitter?
+ const bool isVert = orient == wxVERTICAL;
+
+ GtkWidget* widget = wxGTKPrivate::GetSplitterWidget(orient);
+ const int full_size = GetGtkSplitterFullSize(widget);
+
+ GdkRectangle rect;
+
+ if ( isVert )
+ {
+ rect.x = position;
+ rect.y = 0;
+ rect.width = full_size;
+ rect.height = size.y;
+ }
+ else // horz
+ {
+ rect.x = 0;
+ rect.y = position;
+ rect.height = full_size;
+ rect.width = size.x;
+ }
+
+ int x_diff = 0;
+ if (win->GetLayoutDirection() == wxLayout_RightToLeft)
+ x_diff = rect.width;
+
+#ifdef __WXGTK3__
+ cairo_t* cr = wxGetGTKDrawable(win, dc);
+ if (cr)
+ {
+ gtk_widget_set_state_flags(widget, stateTypeToFlags[flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL], true);
+ GtkStyleContext* sc = gtk_widget_get_style_context(widget);
+ gtk_render_handle(sc, cr, rect.x - x_diff, rect.y, rect.width, rect.height);
+ }
+#else
+ GdkWindow* gdk_window = wxGetGTKDrawable(win, dc);
+ if (gdk_window == NULL)
+ return;
+ gtk_paint_handle
+ (
+ gtk_widget_get_style(win->m_wxwindow),
+ gdk_window,
+ flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE,
+ NULL /* no clipping */,
+ win->m_wxwindow,
+ "paned",
+ dc.LogicalToDeviceX(rect.x) - x_diff,
+ dc.LogicalToDeviceY(rect.y),
+ rect.width,
+ rect.height,
+ isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
+ );
+#endif
+}
+
+void
+wxRendererGTK::DrawDropArrow(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ GtkWidget *button = wxGTKPrivate::GetButtonWidget();
+
+ // If we give WX_PIZZA(win->m_wxwindow)->bin_window as
+ // a window for gtk_paint_xxx function, then it won't
+ // work for wxMemoryDC. So that is why we assume wxDC
+ // is wxWindowDC (wxClientDC, wxMemoryDC and wxPaintDC
+ // are derived from it) and use its m_window.
+
+ // draw arrow so that there is even space horizontally
+ // on both sides
+ const int size = rect.width / 2;
+ const int x = rect.x + (size + 1) / 2;
+ const int y = rect.y + (rect.height - size + 1) / 2;
+
+ GtkStateType state;
+
+ if ( flags & wxCONTROL_PRESSED )
+ state = GTK_STATE_ACTIVE;
+ else if ( flags & wxCONTROL_DISABLED )
+ state = GTK_STATE_INSENSITIVE;
+ else if ( flags & wxCONTROL_CURRENT )
+ state = GTK_STATE_PRELIGHT;
+ else
+ state = GTK_STATE_NORMAL;
+
+#ifdef __WXGTK3__
+ cairo_t* cr = wxGetGTKDrawable(win, dc);
+ if (cr)
+ {
+ gtk_widget_set_state_flags(button, stateTypeToFlags[state], true);
+ GtkStyleContext* sc = gtk_widget_get_style_context(button);
+ gtk_render_arrow(sc, cr, G_PI, x, y, size);
+ }
+#else
+ GdkWindow* gdk_window = wxGetGTKDrawable(win, dc);
+ if (gdk_window == NULL)
+ return;
+ // draw arrow on button
+ gtk_paint_arrow
+ (
+ gtk_widget_get_style(button),
+ gdk_window,
+ state,
+ flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
+ NULL,
+ button,
+ "arrow",
+ GTK_ARROW_DOWN,
+ FALSE,
+ x, y,
+ size, size
+ );
+#endif
+}
+
+void
+wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ DrawPushButton(win,dc,rect,flags);
+ DrawDropArrow(win,dc,rect);
+}
+
+wxSize
+wxRendererGTK::GetCheckBoxSize(wxWindow *WXUNUSED(win))
+{
+ gint indicator_size, indicator_spacing;
+ gtk_widget_style_get(wxGTKPrivate::GetCheckButtonWidget(),
+ "indicator_size", &indicator_size,
+ "indicator_spacing", &indicator_spacing,
+ NULL);
+
+ int size = indicator_size + indicator_spacing * 2;
+ return wxSize(size, size);
+}
+
+void
+wxRendererGTK::DrawCheckBox(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags )
+{
+ GtkWidget *button = wxGTKPrivate::GetCheckButtonWidget();
+
+ gint indicator_size, indicator_spacing;
+ gtk_widget_style_get(button,
+ "indicator_size", &indicator_size,
+ "indicator_spacing", &indicator_spacing,
+ NULL);