1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: wx/ribbon/page.h 3 // Purpose: Container for ribbon-bar-style interface panels 4 // Author: Peter Cawley 5 // Modified by: 6 // Created: 2009-05-25 7 // Copyright: (C) Peter Cawley 8 // Licence: wxWindows licence 9 /////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef _WX_RIBBON_PAGE_H_ 12 #define _WX_RIBBON_PAGE_H_ 13 14 #include "wx/defs.h" 15 16 #if wxUSE_RIBBON 17 18 #include "wx/ribbon/control.h" 19 #include "wx/ribbon/panel.h" 20 #include "wx/bitmap.h" 21 22 class wxRibbonBar; 23 class wxRibbonPageScrollButton; 24 25 class WXDLLIMPEXP_RIBBON wxRibbonPage : public wxRibbonControl 26 { 27 public: 28 wxRibbonPage(); 29 30 wxRibbonPage(wxRibbonBar* parent, 31 wxWindowID id = wxID_ANY, 32 const wxString& label = wxEmptyString, 33 const wxBitmap& icon = wxNullBitmap, 34 long style = 0); 35 36 virtual ~wxRibbonPage(); 37 38 bool Create(wxRibbonBar* parent, 39 wxWindowID id = wxID_ANY, 40 const wxString& label = wxEmptyString, 41 const wxBitmap& icon = wxNullBitmap, 42 long style = 0); 43 44 void SetArtProvider(wxRibbonArtProvider* art); 45 GetIcon()46 wxBitmap& GetIcon() {return m_icon;} 47 virtual wxSize GetMinSize() const; 48 void SetSizeWithScrollButtonAdjustment(int x, int y, int width, int height); 49 void AdjustRectToIncludeScrollButtons(wxRect* rect) const; 50 51 bool DismissExpandedPanel(); 52 53 virtual bool Realize(); 54 virtual bool Show(bool show = true); 55 virtual bool Layout(); 56 virtual bool ScrollLines(int lines); 57 bool ScrollPixels(int pixels); 58 bool ScrollSections(int sections); 59 60 wxOrientation GetMajorAxis() const; 61 62 virtual void RemoveChild(wxWindowBase *child); 63 64 void HideIfExpanded(); 65 66 protected: 67 virtual wxSize DoGetBestSize() const; GetDefaultBorder()68 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } 69 70 void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); 71 bool DoActualLayout(); 72 void OnEraseBackground(wxEraseEvent& evt); 73 void OnPaint(wxPaintEvent& evt); 74 void OnSize(wxSizeEvent& evt); 75 76 bool ExpandPanels(wxOrientation direction, int maximum_amount); 77 bool CollapsePanels(wxOrientation direction, int minimum_amount); 78 void ShowScrollButtons(); 79 #if wxABI_VERSION >= 30004 80 bool ShowScrollButtons1(); 81 #endif 82 void HideScrollButtons(); 83 84 void CommonInit(const wxString& label, const wxBitmap& icon); 85 void PopulateSizeCalcArray(wxSize (wxWindow::*get_size)(void) const); 86 87 wxArrayRibbonControl m_collapse_stack; 88 wxBitmap m_icon; 89 wxSize m_old_size; 90 // NB: Scroll button windows are siblings rather than children (to get correct clipping of children) 91 wxRibbonPageScrollButton* m_scroll_left_btn; 92 wxRibbonPageScrollButton* m_scroll_right_btn; 93 wxSize* m_size_calc_array; 94 size_t m_size_calc_array_size; 95 int m_scroll_amount; 96 int m_scroll_amount_limit; 97 int m_size_in_major_axis_for_children; 98 bool m_scroll_buttons_visible; 99 100 #ifndef SWIG 101 DECLARE_CLASS(wxRibbonPage) 102 DECLARE_EVENT_TABLE() 103 #endif 104 }; 105 106 #endif // wxUSE_RIBBON 107 108 #endif // _WX_RIBBON_PAGE_H_ 109