X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a310c91c7c51703f88cbcf4f2c6975e7c0db3cda..977c53206a4be411999140b514507e161e1f0a04:/src/aui/dockart.cpp?ds=sidebyside diff --git a/src/aui/dockart.cpp b/src/aui/dockart.cpp index eabee0f202..17f7083874 100644 --- a/src/aui/dockart.cpp +++ b/src/aui/dockart.cpp @@ -43,6 +43,11 @@ #ifdef __WXGTK__ #include #include "wx/renderer.h" +#if GTK_CHECK_VERSION(2,0,0) + #include "wx/gtk/private/gtk2-compat.h" +#else + #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE +#endif #endif @@ -190,6 +195,28 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt() m_caption_font = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE); #endif + // default metric values +#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON + SInt32 height; + GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height ); + m_sash_size = height; +#elif defined(__WXGTK__) + m_sash_size = wxRendererNative::Get().GetSplitterParams(NULL).widthSash; +#else + m_sash_size = 4; +#endif + m_caption_size = 17; + m_border_size = 1; + m_button_size = 14; + m_gripper_size = 9; + m_gradient_type = wxAUI_GRADIENT_VERTICAL; + + InitBitmaps(); +} + +void +wxAuiDefaultDockArt::InitBitmaps () +{ // some built in bitmaps #if defined( __WXMAC__ ) static const unsigned char close_bits[]={ @@ -256,22 +283,6 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt() m_inactive_pin_bitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour); m_active_pin_bitmap = wxAuiBitmapFromBits(pin_bits, 16, 16, m_active_caption_text_colour); - - // default metric values -#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - SInt32 height; - GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height ); - m_sash_size = height; -#elif defined(__WXGTK__) - m_sash_size = wxRendererNative::Get().GetSplitterParams(NULL).widthSash; -#else - m_sash_size = 4; -#endif - m_caption_size = 17; - m_border_size = 1; - m_button_size = 14; - m_gripper_size = 9; - m_gradient_type = wxAUI_GRADIENT_VERTICAL; } int wxAuiDefaultDockArt::GetMetric(int id) @@ -344,6 +355,8 @@ void wxAuiDefaultDockArt::SetColour(int id, const wxColor& colour) break; default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break; } + + InitBitmaps(); } void wxAuiDefaultDockArt::SetFont(int id, const wxFont& font) @@ -402,11 +415,11 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, if (!window) return; if (!window->m_wxwindow) return; - if (!GTK_WIDGET_DRAWABLE(window->m_wxwindow)) return; + if (!gtk_widget_is_drawable(window->m_wxwindow)) return; gtk_paint_handle ( - window->m_wxwindow->style, + gtk_widget_get_style(window->m_wxwindow), window->GTKGetDrawingWindow(), // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, GTK_STATE_NORMAL, @@ -539,6 +552,14 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window), DrawCaptionBackground(dc, rect, (pane.state & wxAuiPaneInfo::optionActive)?true:false); + int caption_offset = 0; + if ( pane.icon.IsOk() ) + { + DrawIcon(dc, rect, pane); + + caption_offset += pane.icon.GetWidth() + 3; + } + if (pane.state & wxAuiPaneInfo::optionActive) dc.SetTextForeground(m_active_caption_text_colour); else @@ -561,10 +582,19 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window), wxString draw_text = wxAuiChopText(dc, text, clip_rect.width); dc.SetClippingRegion(clip_rect); - dc.DrawText(draw_text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1); + dc.DrawText(draw_text, rect.x+3 + caption_offset, rect.y+(rect.height/2)-(h/2)-1); dc.DestroyClippingRegion(); } +void +wxAuiDefaultDockArt::DrawIcon(wxDC& dc, const wxRect& rect, wxAuiPaneInfo& pane) +{ + // Draw the icon centered vertically + dc.DrawBitmap(pane.icon, + rect.x+2, rect.y+(rect.height-pane.icon.GetHeight())/2, + true); +} + void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window), const wxRect& rect, wxAuiPaneInfo& pane)