]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/art_aui.cpp
Fix --enable-webview_xxx options names in configure.
[wxWidgets.git] / src / ribbon / art_aui.cpp
index 1847f583c136d47753b09afac5968daccf8f46e8..a8fd9c2b3457644909669472b31e838720dbdcd9 100644 (file)
     #pragma hdrstop
 #endif
 
-#include "wx/dc.h"
-#include "wx/settings.h"
-#include "wx/ribbon/art.h"
-
 #if wxUSE_RIBBON
 
+#include "wx/ribbon/art.h"
 #include "wx/ribbon/art_internal.h"
 #include "wx/ribbon/bar.h"
 #include "wx/ribbon/buttonbar.h"
 #include "wx/ribbon/toolbar.h"
 
 #ifndef WX_PRECOMP
+#include "wx/dc.h"
+#include "wx/settings.h"
 #endif
 
 #ifdef __WXMSW__
 #include "wx/msw/private.h"
 #elif defined(__WXMAC__)
 #include "wx/osx/private.h"
-// only for kThemeBrushToolbarBackground
-#include <Carbon/Carbon.h>
 #endif
 
 wxRibbonAUIArtProvider::wxRibbonAUIArtProvider()
@@ -390,9 +387,12 @@ void wxRibbonAUIArtProvider::DrawTab(wxDC& dc,
         icon = tab.page->GetIcon();
         if((m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS) == 0)
         {
+            if(icon.IsOk())
+            {
             int x = tab.rect.x + (tab.rect.width - icon.GetWidth()) / 2;
             dc.DrawBitmap(icon, x, tab.rect.y + 1 + (tab.rect.height - 1 -
                 icon.GetHeight()) / 2, true);
+            }
         }
     }
     if(m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS)
@@ -642,6 +642,27 @@ wxSize wxRibbonAUIArtProvider::GetPanelClientSize(
     return size;
 }
 
+wxRect wxRibbonAUIArtProvider::GetPanelExtButtonArea(wxDC& dc,
+                        const wxRibbonPanel* wnd,
+                        wxRect rect)
+{
+    wxRect true_rect(rect);
+    RemovePanelPadding(&true_rect);
+
+    true_rect.x++;
+    true_rect.width -= 2;
+    true_rect.y++;
+
+    dc.SetFont(m_panel_label_font);
+    wxSize label_size = dc.GetTextExtent(wnd->GetLabel());
+    int label_height = label_size.GetHeight() + 5;
+    wxRect label_rect(true_rect);
+    label_rect.height = label_height - 1;
+
+    rect = wxRect(label_rect.GetRight()-13, label_rect.GetBottom()-13, 13, 13);
+    return rect;
+}
+
 void wxRibbonAUIArtProvider::DrawPanelBackground(
                         wxDC& dc,
                         wxRibbonPanel* wnd,
@@ -705,6 +726,19 @@ void wxRibbonAUIArtProvider::DrawPanelBackground(
 #endif
         dc.GradientFillLinear(gradient_rect, colour, gradient, wxSOUTH);
     }
+
+    if(wnd->HasExtButton())
+    {
+        if(wnd->IsExtButtonHovered())
+        {
+            dc.SetPen(m_panel_hover_button_border_pen);
+            dc.SetBrush(m_panel_hover_button_background_brush);
+            dc.DrawRoundedRectangle(label_rect.GetRight() - 13, label_rect.GetBottom() - 13, 13, 13, 1.0);
+            dc.DrawBitmap(m_panel_extension_bitmap[1], label_rect.GetRight() - 10, label_rect.GetBottom() - 10, true);
+        }
+        else
+            dc.DrawBitmap(m_panel_extension_bitmap[0], label_rect.GetRight() - 10, label_rect.GetBottom() - 10, true);
+    }
 }
 
 void wxRibbonAUIArtProvider::DrawMinimisedPanel(
@@ -864,7 +898,7 @@ void wxRibbonAUIArtProvider::DrawGalleryBackground(
     dc.SetPen(m_gallery_border_pen);
     dc.SetBrush(*wxTRANSPARENT_BRUSH);
     dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
-    
+
     DrawGalleryBackgroundCommon(dc, wnd, rect);
 }
 
@@ -959,6 +993,13 @@ void wxRibbonAUIArtProvider::DrawButtonBarButton(
                         const wxBitmap& bitmap_large,
                         const wxBitmap& bitmap_small)
 {
+    if(kind == wxRIBBON_BUTTON_TOGGLE)
+    {
+        kind = wxRIBBON_BUTTON_NORMAL;
+        if(state & wxRIBBON_BUTTONBAR_BUTTON_TOGGLED)
+            state ^= wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK;
+    }
+
     if(state & (wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK
         | wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK))
     {
@@ -1060,6 +1101,12 @@ void wxRibbonAUIArtProvider::DrawTool(
             wxRibbonButtonKind kind,
             long state)
 {
+    if(kind == wxRIBBON_BUTTON_TOGGLE)
+    {
+        if(state & wxRIBBON_TOOLBAR_TOOL_TOGGLED)
+            state ^= wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
+    }
+
     wxRect bg_rect(rect);
     bg_rect.Deflate(1);
     if((state & wxRIBBON_TOOLBAR_TOOL_LAST) == 0)
@@ -1117,12 +1164,12 @@ void wxRibbonAUIArtProvider::DrawTool(
 
     // Foreground
     int avail_width = bg_rect.GetWidth();
-    if(kind != wxRIBBON_BUTTON_NORMAL)
+    if(kind & wxRIBBON_BUTTON_DROPDOWN)
     {
         avail_width -= 8;
         if(is_split_hybrid)
         {
-            dc.DrawLine(rect.x + avail_width + 1, rect.y, 
+            dc.DrawLine(rect.x + avail_width + 1, rect.y,
                 rect.x + avail_width + 1, rect.y + rect.height);
         }
         dc.DrawBitmap(m_toolbar_drop_bitmap, bg_rect.x + avail_width + 2,