From c1a1a1303218a3b1560f92d245e25cbde3e8de00 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 28 Jun 2016 17:11:37 -0700 Subject: [PATCH] Add more stuff missing from the ribbon interface --- interface/wx/ribbon/art.h | 341 ++++++++++++++++++++++++++++++++ interface/wx/ribbon/buttonbar.h | 7 +- interface/wx/ribbon/panel.h | 3 + 3 files changed, 350 insertions(+), 1 deletion(-) diff --git a/interface/wx/ribbon/art.h b/interface/wx/ribbon/art.h index 2bd68d44d5..67da487650 100644 --- a/interface/wx/ribbon/art.h +++ b/interface/wx/ribbon/art.h @@ -1024,3 +1024,344 @@ public: */ virtual wxRect GetRibbonHelpButtonArea(const wxRect& rect) = 0; }; + + + +class wxRibbonMSWArtProvider : public wxRibbonArtProvider +{ +public: + wxRibbonMSWArtProvider(bool set_colour_scheme = true); + virtual ~wxRibbonMSWArtProvider(); + + wxRibbonArtProvider* Clone() const; + void SetFlags(long flags); + long GetFlags() const; + + int GetMetric(int id) const; + void SetMetric(int id, int new_val); + void SetFont(int id, const wxFont& font); + wxFont GetFont(int id) const; + wxColour GetColour(int id) const; + void SetColour(int id, const wxColour& colour); + void GetColourScheme(wxColour* primary, + wxColour* secondary, + wxColour* tertiary) const; + void SetColourScheme(const wxColour& primary, + const wxColour& secondary, + const wxColour& tertiary); + + int GetTabCtrlHeight( + wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfoArray& pages); + + void DrawTabCtrlBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfo& tab); + + void DrawTabSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + double visibility); + + void DrawPageBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawScrollButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + long style); + + void DrawPanelBackground( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect); + + void DrawGalleryBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect); + + void DrawGalleryItemBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect, + wxRibbonGalleryItem* item); + + void DrawMinimisedPanel( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect, + wxBitmap& bitmap); + + void DrawButtonBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawButtonBarButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + wxRibbonButtonKind kind, + long state, + const wxString& label, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_small); + + void DrawToolBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawToolGroupBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawTool( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + const wxBitmap& bitmap, + wxRibbonButtonKind kind, + long state); + + void DrawToggleButton( + wxDC& dc, + wxRibbonBar* wnd, + const wxRect& rect, + wxRibbonDisplayMode mode); + + void DrawHelpButton(wxDC& dc, + wxRibbonBar* wnd, + const wxRect& rect); + + void GetBarTabWidth( + wxDC& dc, + wxWindow* wnd, + const wxString& label, + const wxBitmap& bitmap, + int* ideal, + int* small_begin_need_separator, + int* small_must_have_separator, + int* minimum); + + wxSize GetScrollButtonMinimumSize( + wxDC& dc, + wxWindow* wnd, + long style); + + wxSize GetPanelSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize client_size, + wxPoint* client_offset); + + wxSize GetPanelClientSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize size, + wxPoint* client_offset); + + wxRect GetPanelExtButtonArea( + wxDC& dc, + const wxRibbonPanel* wnd, + wxRect rect); + + wxSize GetGallerySize( + wxDC& dc, + const wxRibbonGallery* wnd, + wxSize client_size); + + wxSize GetGalleryClientSize( + wxDC& dc, + const wxRibbonGallery* wnd, + wxSize size, + wxPoint* client_offset, + wxRect* scroll_up_button, + wxRect* scroll_down_button, + wxRect* extension_button); + + wxRect GetPageBackgroundRedrawArea( + wxDC& dc, + const wxRibbonPage* wnd, + wxSize page_old_size, + wxSize page_new_size); + + bool GetButtonBarButtonSize( + wxDC& dc, + wxWindow* wnd, + wxRibbonButtonKind kind, + wxRibbonButtonBarButtonState size, + const wxString& label, + wxSize bitmap_size_large, + wxSize bitmap_size_small, + wxSize* button_size, + wxRect* normal_region, + wxRect* dropdown_region); + + wxSize GetMinimisedPanelMinimumSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize* desired_bitmap_size, + wxDirection* expanded_panel_direction); + + wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + wxSize bitmap_size, + wxRibbonButtonKind kind, + bool is_first, + bool is_last, + wxRect* dropdown_region); + + wxRect GetBarToggleButtonArea(const wxRect& rect); + + wxRect GetRibbonHelpButtonArea(const wxRect& rect); +}; + + +class wxRibbonAUIArtProvider : public wxRibbonMSWArtProvider +{ +public: + wxRibbonAUIArtProvider(); + virtual ~wxRibbonAUIArtProvider(); + + wxRibbonArtProvider* Clone() const; + + wxColour GetColour(int id) const; + void SetColour(int id, const wxColour& colour); + void SetColourScheme(const wxColour& primary, + const wxColour& secondary, + const wxColour& tertiary); + void SetFont(int id, const wxFont& font); + + wxSize GetScrollButtonMinimumSize( + wxDC& dc, + wxWindow* wnd, + long style); + + void DrawScrollButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + long style); + + wxSize GetPanelSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize client_size, + wxPoint* client_offset); + + wxSize GetPanelClientSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize size, + wxPoint* client_offset); + + wxRect GetPanelExtButtonArea( + wxDC& dc, + const wxRibbonPanel* wnd, + wxRect rect); + + void DrawTabCtrlBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + int GetTabCtrlHeight( + wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfoArray& pages); + + void GetBarTabWidth( + wxDC& dc, + wxWindow* wnd, + const wxString& label, + const wxBitmap& bitmap, + int* ideal, + int* small_begin_need_separator, + int* small_must_have_separator, + int* minimum); + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfo& tab); + + void DrawTabSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + double visibility); + + void DrawPageBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawPanelBackground( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect); + + void DrawMinimisedPanel( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect, + wxBitmap& bitmap); + + void DrawGalleryBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect); + + void DrawGalleryItemBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect, + wxRibbonGalleryItem* item); + + void DrawButtonBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawButtonBarButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + wxRibbonButtonKind kind, + long state, + const wxString& label, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_small); + + void DrawToolBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawToolGroupBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect); + + void DrawTool( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + const wxBitmap& bitmap, + wxRibbonButtonKind kind, + long state); + +}; diff --git a/interface/wx/ribbon/buttonbar.h b/interface/wx/ribbon/buttonbar.h index 7d6c754032..5386c25357 100644 --- a/interface/wx/ribbon/buttonbar.h +++ b/interface/wx/ribbon/buttonbar.h @@ -69,7 +69,12 @@ enum wxRibbonButtonBarButtonState Only applicable to dropdown and hybrid buttons. */ wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE = 1 << 6, - + + /** + A mask to extract active flags + */ + wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE, + /** The button is disabled. Hover flags may still be set when a button is disabled, but should be ignored during drawing if the button is diff --git a/interface/wx/ribbon/panel.h b/interface/wx/ribbon/panel.h index a4a0e6ee22..f4fabf56b1 100644 --- a/interface/wx/ribbon/panel.h +++ b/interface/wx/ribbon/panel.h @@ -52,6 +52,9 @@ public: void SetPanel(wxRibbonPanel* page); }; +wxEventType wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED; + + /** @class wxRibbonPanel