X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..a64f38d67431a068d6c08b54500527dde04ed703:/src/ribbon/art_msw.cpp diff --git a/src/ribbon/art_msw.cpp b/src/ribbon/art_msw.cpp index e659ed6bc6..312148f1c6 100644 --- a/src/ribbon/art_msw.cpp +++ b/src/ribbon/art_msw.cpp @@ -1144,12 +1144,27 @@ void wxRibbonMSWArtProvider::ReallyDrawTabSeparator(wxWindow* wnd, const wxRect& } void wxRibbonMSWArtProvider::DrawPartialPageBackground(wxDC& dc, - wxWindow* WXUNUSED(wnd), const wxRect& rect, wxRibbonPage* page, + wxWindow* wnd, const wxRect& rect, wxRibbonPage* page, wxPoint offset, bool hovered) { - wxRect background(page->GetSize()); - page->AdjustRectToIncludeScrollButtons(&background); - background.height -= 2; + wxRect background; + // Expanded panels need a background - the expanded panel at + // best size may have a greater Y dimension higher than when + // on the bar if it has a sizer. AUI art provider does not need this + // because it paints the panel without reference to its parent's size. + // Expanded panels use a wxFrame as parent (not a wxRibbonPage). + + if(wnd->GetSizer() && wnd->GetParent() != page) + { + background = wnd->GetParent()->GetSize(); + offset = wxPoint(0,0); + } + else + { + background = page->GetSize(); + page->AdjustRectToIncludeScrollButtons(&background); + background.height -= 2; + } // Page background isn't dependant upon the width of the page // (at least not the part of it intended to be painted by this // function). Set to wider than the page itself for when externally @@ -2006,6 +2021,13 @@ void wxRibbonMSWArtProvider::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)) { @@ -2240,6 +2262,12 @@ void wxRibbonMSWArtProvider::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) @@ -2310,7 +2338,7 @@ void wxRibbonMSWArtProvider::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) @@ -2612,6 +2640,7 @@ bool wxRibbonMSWArtProvider::GetButtonBarButtonSize( switch(kind) { case wxRIBBON_BUTTON_NORMAL: + case wxRIBBON_BUTTON_TOGGLE: *normal_region = wxRect(*button_size); *dropdown_region = wxRect(0, 0, 0, 0); break; @@ -2645,6 +2674,7 @@ bool wxRibbonMSWArtProvider::GetButtonBarButtonSize( dropdown_region->SetX(dropdown_region->GetX() + text_size); // no break case wxRIBBON_BUTTON_NORMAL: + case wxRIBBON_BUTTON_TOGGLE: normal_region->SetWidth(normal_region->GetWidth() + text_size); break; } @@ -2659,7 +2689,7 @@ bool wxRibbonMSWArtProvider::GetButtonBarButtonSize( wxCoord best_width; dc.GetTextExtent(label, &best_width, &label_height); int last_line_extra_width = 0; - if(kind != wxRIBBON_BUTTON_NORMAL) + if(kind != wxRIBBON_BUTTON_NORMAL && kind != wxRIBBON_BUTTON_TOGGLE) { last_line_extra_width += 8; } @@ -2696,6 +2726,7 @@ bool wxRibbonMSWArtProvider::GetButtonBarButtonSize( dropdown_region->height = icon_size.GetHeight() - normal_region->height; break; case wxRIBBON_BUTTON_NORMAL: + case wxRIBBON_BUTTON_TOGGLE: *normal_region = wxRect(icon_size); break; } @@ -2757,7 +2788,7 @@ wxSize wxRibbonMSWArtProvider::GetToolSize( size.IncBy(7, 6); if(is_last) size.IncBy(1, 0); - if(kind != wxRIBBON_BUTTON_NORMAL) + if(kind & wxRIBBON_BUTTON_DROPDOWN) { size.IncBy(8, 0); if(dropdown_region)