X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3cbab64109b007fa1d939fe588f5e79f9105b915..ca9047f7ad39a108ad7d71cffdf933c947c91554:/src/gtk1/renderer.cpp?ds=sidebyside diff --git a/src/gtk1/renderer.cpp b/src/gtk1/renderer.cpp index 65efb88eae..04cd173fd4 100644 --- a/src/gtk1/renderer.cpp +++ b/src/gtk1/renderer.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: gtk/renderer.cpp +// Name: src/gtk1/renderer.cpp // Purpose: implementation of wxRendererNative for wxGTK // Author: Vadim Zeitlin // Modified by: @@ -25,12 +25,15 @@ #endif #include "wx/renderer.h" + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/dc.h" +#endif + #include #include "wx/gtk1/win_gtk.h" - -#include "wx/window.h" -#include "wx/dc.h" -#include "wx/dcclient.h" +#include "wx/gtk1/dcclient.h" // RR: After a correction to the orientation of the sash // this doesn't seem to be required anymore and it @@ -45,10 +48,12 @@ class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererNative { public: // draw the header control button (used by wxListCtrl) - virtual void DrawHeaderButton(wxWindow *win, - wxDC& dc, - const wxRect& rect, - int flags = 0); + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params=NULL); virtual void DrawSplitterBorder(wxWindow *win, wxDC& dc, @@ -118,11 +123,13 @@ wxRendererGTK::GetButtonWidget() // list/tree controls drawing // ---------------------------------------------------------------------------- -void +int wxRendererGTK::DrawHeaderButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags) + int flags, + wxHeaderSortIconType WXUNUSED(sortArrow), + wxHeaderButtonParams* WXUNUSED(params)) { GtkWidget *button = GetButtonWidget(); @@ -138,8 +145,10 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, NULL, button, "button", - dc.XLOG2DEV(rect.x) -1, rect.y -1, rect.width +2, rect.height +2 + dc.LogicalToDeviceX(rect.x) -1, rect.y -1, rect.width +2, rect.height +2 ); + + return rect.width + 2; } // ---------------------------------------------------------------------------- @@ -180,7 +189,7 @@ wxRendererGTK::DrawSplitterBorder(wxWindow * WXUNUSED(win), void wxRendererGTK::DrawSplitterSash(wxWindow *win, - wxDC& dc, + wxDC& WXUNUSED(dc), const wxSize& size, wxCoord position, wxOrientation orient, @@ -284,7 +293,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, GTK_PIZZA(win->m_wxwindow)->bin_window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - (GdkRectangle*) NULL, + NULL, win->m_wxwindow, (char *)"paned", // const_cast isVert ? position : size.x - 2*SASH_SIZE, @@ -294,7 +303,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win, } void -wxRendererGTK::DrawDropArrow(wxWindow *win, +wxRendererGTK::DrawDropArrow(wxWindow *WXUNUSED(win), wxDC& dc, const wxRect& rect, int flags) @@ -306,11 +315,10 @@ wxRendererGTK::DrawDropArrow(wxWindow *win, // 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. - wxWindowDC& wdc = (wxWindowDC&)dc; + wxWindowDCImpl * const impl = wxDynamicCast(dc.GetImpl(), wxWindowDCImpl); + wxCHECK_RET( impl, "must have a window DC" ); - // only doing debug-time checking here (it should - // probably be enough) - wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) ); + GdkWindow* gdk_window = impl->GetGDKWindow(); // draw arrow so that there is even space horizontally // on both sides @@ -337,7 +345,7 @@ wxRendererGTK::DrawDropArrow(wxWindow *win, gtk_paint_arrow ( button->style, - wdc.m_window, + gdk_window, state, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT, NULL, @@ -361,8 +369,10 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win, GtkWidget *button = GetButtonWidget(); // for reason why we do this, see DrawDropArrow - wxWindowDC& wdc = (wxWindowDC&)dc; - wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) ); + wxWindowDCImpl * const impl = wxDynamicCast(dc.GetImpl(), wxWindowDCImpl); + wxCHECK_RET( impl, "must have a window DC" ); + + GdkWindow* gdk_window = impl->GetGDKWindow(); // draw button GtkStateType state; @@ -379,7 +389,7 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win, gtk_paint_box ( button->style, - wdc.m_window, + gdk_window, state, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT, NULL,