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,
28 wxRIBBON_PANEL_DEFAULT_STYLE
= 0
31 class WXDLLIMPEXP_RIBBON wxRibbonPanel
: public wxRibbonControl
36 wxRibbonPanel(wxWindow
* parent
,
37 wxWindowID id
= wxID_ANY
,
38 const wxString
& label
= wxEmptyString
,
39 const wxBitmap
& minimised_icon
= wxNullBitmap
,
40 const wxPoint
& pos
= wxDefaultPosition
,
41 const wxSize
& size
= wxDefaultSize
,
42 long style
= wxRIBBON_PANEL_DEFAULT_STYLE
);
44 virtual ~wxRibbonPanel();
46 bool Create(wxWindow
* parent
,
47 wxWindowID id
= wxID_ANY
,
48 const wxString
& label
= wxEmptyString
,
49 const wxBitmap
& icon
= wxNullBitmap
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
52 long style
= wxRIBBON_PANEL_DEFAULT_STYLE
);
54 wxBitmap
& GetMinimisedIcon() {return m_minimised_icon
;}
55 const wxBitmap
& GetMinimisedIcon() const {return m_minimised_icon
;}
56 bool IsMinimised() const;
57 bool IsMinimised(wxSize at_size
) const;
58 bool IsHovered() const;
59 bool CanAutoMinimise() const;
64 void SetArtProvider(wxRibbonArtProvider
* art
);
66 virtual bool Realize();
67 virtual bool Layout();
68 virtual wxSize
GetMinSize() const;
70 virtual bool IsSizingContinuous() const;
72 virtual void AddChild(wxWindowBase
*child
);
73 virtual void RemoveChild(wxWindowBase
*child
);
75 wxRibbonPanel
* GetExpandedDummy();
76 wxRibbonPanel
* GetExpandedPanel();
79 virtual wxSize
DoGetBestSize() const;
80 virtual wxSize
GetPanelSizerBestSize() const;
81 wxSize
GetPanelSizerMinSize() const;
82 wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
83 wxSize
GetMinNotMinimisedSize() const;
85 virtual wxSize
DoGetNextSmallerSize(wxOrientation direction
,
86 wxSize relative_to
) const;
87 virtual wxSize
DoGetNextLargerSize(wxOrientation direction
,
88 wxSize relative_to
) const;
90 void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
91 void OnSize(wxSizeEvent
& evt
);
92 void OnEraseBackground(wxEraseEvent
& evt
);
93 void OnPaint(wxPaintEvent
& evt
);
94 void OnMouseEnter(wxMouseEvent
& evt
);
95 void OnMouseEnterChild(wxMouseEvent
& evt
);
96 void OnMouseLeave(wxMouseEvent
& evt
);
97 void OnMouseLeaveChild(wxMouseEvent
& evt
);
98 void OnMouseClick(wxMouseEvent
& evt
);
99 void OnKillFocus(wxFocusEvent
& evt
);
100 void OnChildKillFocus(wxFocusEvent
& evt
);
102 void TestPositionForHover(const wxPoint
& pos
);
103 bool ShouldSendEventToDummy(wxEvent
& evt
);
104 virtual bool TryAfter(wxEvent
& evt
);
106 void CommonInit(const wxString
& label
, const wxBitmap
& icon
, long style
);
107 static wxRect
GetExpandedPosition(wxRect panel
,
108 wxSize expanded_size
,
109 wxDirection direction
);
111 wxBitmap m_minimised_icon
;
112 wxBitmap m_minimised_icon_resized
;
113 wxSize m_smallest_unminimised_size
;
114 wxSize m_minimised_size
;
115 wxDirection m_preferred_expand_direction
;
116 wxRibbonPanel
* m_expanded_dummy
;
117 wxRibbonPanel
* m_expanded_panel
;
118 wxWindow
* m_child_with_focus
;
124 DECLARE_CLASS(wxRibbonPanel
)
125 DECLARE_EVENT_TABLE()
129 #endif // wxUSE_RIBBON
131 #endif // _WX_RIBBON_PANEL_H_