page.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #ifndef _WX_RIBBON_PAGE_H_
  11. #define _WX_RIBBON_PAGE_H_
  12. #include "wx/defs.h"
  13. #if wxUSE_RIBBON
  14. #include "wx/ribbon/control.h"
  15. #include "wx/ribbon/panel.h"
  16. #include "wx/bitmap.h"
  17. class wxRibbonBar;
  18. class wxRibbonPageScrollButton;
  19. class WXDLLIMPEXP_RIBBON wxRibbonPage : public wxRibbonControl
  20. {
  21. public:
  22. wxRibbonPage();
  23. wxRibbonPage(wxRibbonBar* parent,
  24. wxWindowID id = wxID_ANY,
  25. const wxString& label = wxEmptyString,
  26. const wxBitmap& icon = wxNullBitmap,
  27. long style = 0);
  28. virtual ~wxRibbonPage();
  29. bool Create(wxRibbonBar* parent,
  30. wxWindowID id = wxID_ANY,
  31. const wxString& label = wxEmptyString,
  32. const wxBitmap& icon = wxNullBitmap,
  33. long style = 0);
  34. void SetArtProvider(wxRibbonArtProvider* art);
  35. wxBitmap& GetIcon() {return m_icon;}
  36. virtual wxSize GetMinSize() const;
  37. void SetSizeWithScrollButtonAdjustment(int x, int y, int width, int height);
  38. void AdjustRectToIncludeScrollButtons(wxRect* rect) const;
  39. bool DismissExpandedPanel();
  40. virtual bool Realize();
  41. virtual bool Show(bool show = true);
  42. virtual bool Layout();
  43. virtual bool ScrollLines(int lines);
  44. bool ScrollPixels(int pixels);
  45. bool ScrollSections(int sections);
  46. wxOrientation GetMajorAxis() const;
  47. virtual void RemoveChild(wxWindowBase *child);
  48. void HideIfExpanded();
  49. protected:
  50. virtual wxSize DoGetBestSize() const;
  51. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  52. void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
  53. bool DoActualLayout();
  54. void OnEraseBackground(wxEraseEvent& evt);
  55. void OnPaint(wxPaintEvent& evt);
  56. void OnSize(wxSizeEvent& evt);
  57. bool ExpandPanels(wxOrientation direction, int maximum_amount);
  58. bool CollapsePanels(wxOrientation direction, int minimum_amount);
  59. void ShowScrollButtons();
  60. void HideScrollButtons();
  61. void CommonInit(const wxString& label, const wxBitmap& icon);
  62. void PopulateSizeCalcArray(wxSize (wxWindow::*get_size)(void) const);
  63. wxArrayRibbonControl m_collapse_stack;
  64. wxBitmap m_icon;
  65. wxSize m_old_size;
  66. // NB: Scroll button windows are siblings rather than children (to get correct clipping of children)
  67. wxRibbonPageScrollButton* m_scroll_left_btn;
  68. wxRibbonPageScrollButton* m_scroll_right_btn;
  69. wxSize* m_size_calc_array;
  70. size_t m_size_calc_array_size;
  71. int m_scroll_amount;
  72. int m_scroll_amount_limit;
  73. int m_size_in_major_axis_for_children;
  74. bool m_scroll_buttons_visible;
  75. #ifndef SWIG
  76. DECLARE_CLASS(wxRibbonPage)
  77. DECLARE_EVENT_TABLE()
  78. #endif
  79. };
  80. #endif // wxUSE_RIBBON
  81. #endif // _WX_RIBBON_PAGE_H_