1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/ribbon/panel.h
3 // Purpose: Ribbon-style container for a group of related tools / controls
4 // Author: Peter Cawley
8 // Copyright: (C) Peter Cawley
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_RIBBON_PANEL_H_
12 #define _WX_RIBBON_PANEL_H_
18 #include "wx/bitmap.h"
19 #include "wx/ribbon/control.h"
21 enum wxRibbonPanelOption
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,
29 wxRIBBON_PANEL_DEFAULT_STYLE
= 0
32 class WXDLLIMPEXP_RIBBON wxRibbonPanel
: public wxRibbonControl
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
);
45 virtual ~wxRibbonPanel();
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
);
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;
65 void SetArtProvider(wxRibbonArtProvider
* art
);
67 virtual bool Realize();
68 virtual bool Layout();
69 virtual wxSize
GetMinSize() const;
71 virtual bool IsSizingContinuous() const;
73 virtual void AddChild(wxWindowBase
*child
);
74 virtual void RemoveChild(wxWindowBase
*child
);
76 wxRibbonPanel
* GetExpandedDummy();
77 wxRibbonPanel
* GetExpandedPanel();
79 // Finds the best width and height given the parent's width and height
80 virtual wxSize
GetBestSizeForParentSize(const wxSize
& parentSize
) const;
82 long GetFlags() { return m_flags
; }
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;
91 virtual wxSize
DoGetNextSmallerSize(wxOrientation direction
,
92 wxSize relative_to
) const;
93 virtual wxSize
DoGetNextLargerSize(wxOrientation direction
,
94 wxSize relative_to
) const;
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
);
108 void TestPositionForHover(const wxPoint
& pos
);
109 bool ShouldSendEventToDummy(wxEvent
& evt
);
110 virtual bool TryAfter(wxEvent
& evt
);
112 void CommonInit(const wxString
& label
, const wxBitmap
& icon
, long style
);
113 static wxRect
GetExpandedPosition(wxRect panel
,
114 wxSize expanded_size
,
115 wxDirection direction
);
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
;
130 DECLARE_CLASS(wxRibbonPanel
)
131 DECLARE_EVENT_TABLE()
135 #endif // wxUSE_RIBBON
137 #endif // _WX_RIBBON_PANEL_H_