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