]>
Commit | Line | Data |
---|---|---|
3c3ead1d PC |
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, | |
ce00f59b | 26 | |
3c3ead1d PC |
27 | wxRIBBON_PANEL_DEFAULT_STYLE = 0, |
28 | }; | |
29 | ||
30 | class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl | |
31 | { | |
32 | public: | |
33 | wxRibbonPanel(); | |
34 | ||
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); | |
42 | ||
43 | virtual ~wxRibbonPanel(); | |
44 | ||
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); | |
52 | ||
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; | |
59 | ||
60 | bool ShowExpanded(); | |
61 | bool HideExpanded(); | |
62 | ||
63 | void SetArtProvider(wxRibbonArtProvider* art); | |
64 | ||
65 | virtual bool Realize(); | |
66 | virtual bool Layout(); | |
67 | virtual wxSize GetMinSize() const; | |
3c3ead1d PC |
68 | |
69 | virtual bool IsSizingContinuous() const; | |
70 | ||
71 | virtual void AddChild(wxWindowBase *child); | |
72 | virtual void RemoveChild(wxWindowBase *child); | |
73 | ||
74 | wxRibbonPanel* GetExpandedDummy(); | |
75 | wxRibbonPanel* GetExpandedPanel(); | |
76 | ||
77 | protected: | |
cff9681b | 78 | virtual wxSize DoGetBestSize() const; |
140091e5 PC |
79 | virtual wxSize GetPanelSizerBestSize() const; |
80 | wxSize GetPanelSizerMinSize() const; | |
3c3ead1d PC |
81 | wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } |
82 | wxSize GetMinNotMinimisedSize() const; | |
83 | ||
84 | virtual wxSize DoGetNextSmallerSize(wxOrientation direction, | |
85 | wxSize relative_to) const; | |
86 | virtual wxSize DoGetNextLargerSize(wxOrientation direction, | |
87 | wxSize relative_to) const; | |
88 | ||
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); | |
100 | ||
101 | void TestPositionForHover(const wxPoint& pos); | |
102 | bool ShouldSendEventToDummy(wxEvent& evt); | |
103 | virtual bool TryAfter(wxEvent& evt); | |
104 | ||
105 | void CommonInit(const wxString& label, const wxBitmap& icon, long style); | |
106 | static wxRect GetExpandedPosition(wxRect panel, | |
107 | wxSize expanded_size, | |
108 | wxDirection direction); | |
109 | ||
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; | |
118 | long m_flags; | |
119 | bool m_minimised; | |
120 | bool m_hovered; | |
121 | ||
122 | #ifndef SWIG | |
123 | DECLARE_CLASS(wxRibbonPanel) | |
124 | DECLARE_EVENT_TABLE() | |
125 | #endif | |
126 | }; | |
127 | ||
128 | #endif // wxUSE_RIBBON | |
129 | ||
130 | #endif // _WX_RIBBON_PANEL_H_ |