]> git.saurik.com Git - wxWidgets.git/blob - include/wx/ribbon/panel.h
Added wxRIBBON_PANEL_FLEXIBLE flag to allow toolbars to wrap, taking up the optimum...
[wxWidgets.git] / include / wx / ribbon / panel.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/ribbon/panel.h
3 // Purpose: Ribbon-style container for a group of related tools / controls
4 // Author: Peter Cawley
5 // Modified by:
6 // Created: 2009-05-25
7 // RCS-ID: $Id$
8 // Copyright: (C) Peter Cawley
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_RIBBON_PANEL_H_
12 #define _WX_RIBBON_PANEL_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_RIBBON
17
18 #include "wx/bitmap.h"
19 #include "wx/ribbon/control.h"
20
21 enum wxRibbonPanelOption
22 {
23 wxRIBBON_PANEL_NO_AUTO_MINIMISE = 1 << 0,
24 wxRIBBON_PANEL_EXT_BUTTON = 1 << 3,
25 wxRIBBON_PANEL_MINIMISE_BUTTON = 1 << 4,
26 wxRIBBON_PANEL_STRETCH = 1 << 5,
27 wxRIBBON_PANEL_FLEXIBLE = 1 << 6,
28
29 wxRIBBON_PANEL_DEFAULT_STYLE = 0
30 };
31
32 class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl
33 {
34 public:
35 wxRibbonPanel();
36
37 wxRibbonPanel(wxWindow* parent,
38 wxWindowID id = wxID_ANY,
39 const wxString& label = wxEmptyString,
40 const wxBitmap& minimised_icon = wxNullBitmap,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxRIBBON_PANEL_DEFAULT_STYLE);
44
45 virtual ~wxRibbonPanel();
46
47 bool Create(wxWindow* parent,
48 wxWindowID id = wxID_ANY,
49 const wxString& label = wxEmptyString,
50 const wxBitmap& icon = wxNullBitmap,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxRIBBON_PANEL_DEFAULT_STYLE);
54
55 wxBitmap& GetMinimisedIcon() {return m_minimised_icon;}
56 const wxBitmap& GetMinimisedIcon() const {return m_minimised_icon;}
57 bool IsMinimised() const;
58 bool IsMinimised(wxSize at_size) const;
59 bool IsHovered() const;
60 bool CanAutoMinimise() const;
61
62 bool ShowExpanded();
63 bool HideExpanded();
64
65 void SetArtProvider(wxRibbonArtProvider* art);
66
67 virtual bool Realize();
68 virtual bool Layout();
69 virtual wxSize GetMinSize() const;
70
71 virtual bool IsSizingContinuous() const;
72
73 virtual void AddChild(wxWindowBase *child);
74 virtual void RemoveChild(wxWindowBase *child);
75
76 wxRibbonPanel* GetExpandedDummy();
77 wxRibbonPanel* GetExpandedPanel();
78
79 // Finds the best width and height given the parent's width and height
80 virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const;
81
82 long GetFlags() { return m_flags; }
83
84 protected:
85 virtual wxSize DoGetBestSize() const;
86 virtual wxSize GetPanelSizerBestSize() const;
87 wxSize GetPanelSizerMinSize() const;
88 wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
89 wxSize GetMinNotMinimisedSize() const;
90
91 virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
92 wxSize relative_to) const;
93 virtual wxSize DoGetNextLargerSize(wxOrientation direction,
94 wxSize relative_to) const;
95
96 void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
97 void OnSize(wxSizeEvent& evt);
98 void OnEraseBackground(wxEraseEvent& evt);
99 void OnPaint(wxPaintEvent& evt);
100 void OnMouseEnter(wxMouseEvent& evt);
101 void OnMouseEnterChild(wxMouseEvent& evt);
102 void OnMouseLeave(wxMouseEvent& evt);
103 void OnMouseLeaveChild(wxMouseEvent& evt);
104 void OnMouseClick(wxMouseEvent& evt);
105 void OnKillFocus(wxFocusEvent& evt);
106 void OnChildKillFocus(wxFocusEvent& evt);
107
108 void TestPositionForHover(const wxPoint& pos);
109 bool ShouldSendEventToDummy(wxEvent& evt);
110 virtual bool TryAfter(wxEvent& evt);
111
112 void CommonInit(const wxString& label, const wxBitmap& icon, long style);
113 static wxRect GetExpandedPosition(wxRect panel,
114 wxSize expanded_size,
115 wxDirection direction);
116
117 wxBitmap m_minimised_icon;
118 wxBitmap m_minimised_icon_resized;
119 wxSize m_smallest_unminimised_size;
120 wxSize m_minimised_size;
121 wxDirection m_preferred_expand_direction;
122 wxRibbonPanel* m_expanded_dummy;
123 wxRibbonPanel* m_expanded_panel;
124 wxWindow* m_child_with_focus;
125 long m_flags;
126 bool m_minimised;
127 bool m_hovered;
128
129 #ifndef SWIG
130 DECLARE_CLASS(wxRibbonPanel)
131 DECLARE_EVENT_TABLE()
132 #endif
133 };
134
135 #endif // wxUSE_RIBBON
136
137 #endif // _WX_RIBBON_PANEL_H_