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;
68 virtual wxSize
DoGetBestSize() 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 wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
80 wxSize
GetMinNotMinimisedSize() const;
82 virtual wxSize
DoGetNextSmallerSize(wxOrientation direction
,
83 wxSize relative_to
) const;
84 virtual wxSize
DoGetNextLargerSize(wxOrientation direction
,
85 wxSize relative_to
) const;
87 void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
88 void OnSize(wxSizeEvent
& evt
);
89 void OnEraseBackground(wxEraseEvent
& evt
);
90 void OnPaint(wxPaintEvent
& evt
);
91 void OnMouseEnter(wxMouseEvent
& evt
);
92 void OnMouseEnterChild(wxMouseEvent
& evt
);
93 void OnMouseLeave(wxMouseEvent
& evt
);
94 void OnMouseLeaveChild(wxMouseEvent
& evt
);
95 void OnMouseClick(wxMouseEvent
& evt
);
96 void OnKillFocus(wxFocusEvent
& evt
);
97 void OnChildKillFocus(wxFocusEvent
& evt
);
99 void TestPositionForHover(const wxPoint
& pos
);
100 bool ShouldSendEventToDummy(wxEvent
& evt
);
101 virtual bool TryAfter(wxEvent
& evt
);
103 void CommonInit(const wxString
& label
, const wxBitmap
& icon
, long style
);
104 static wxRect
GetExpandedPosition(wxRect panel
,
105 wxSize expanded_size
,
106 wxDirection direction
);
108 wxBitmap m_minimised_icon
;
109 wxBitmap m_minimised_icon_resized
;
110 wxSize m_smallest_unminimised_size
;
111 wxSize m_minimised_size
;
112 wxDirection m_preferred_expand_direction
;
113 wxRibbonPanel
* m_expanded_dummy
;
114 wxRibbonPanel
* m_expanded_panel
;
115 wxWindow
* m_child_with_focus
;
121 DECLARE_CLASS(wxRibbonPanel
)
122 DECLARE_EVENT_TABLE()
126 #endif // wxUSE_RIBBON
128 #endif // _WX_RIBBON_PANEL_H_