]>
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, | |
26 | ||
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; |
3c3ead1d PC |
79 | wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } |
80 | wxSize GetMinNotMinimisedSize() const; | |
81 | ||
82 | virtual wxSize DoGetNextSmallerSize(wxOrientation direction, | |
83 | wxSize relative_to) const; | |
84 | virtual wxSize DoGetNextLargerSize(wxOrientation direction, | |
85 | wxSize relative_to) const; | |
86 | ||
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); | |
98 | ||
99 | void TestPositionForHover(const wxPoint& pos); | |
100 | bool ShouldSendEventToDummy(wxEvent& evt); | |
101 | virtual bool TryAfter(wxEvent& evt); | |
102 | ||
103 | void CommonInit(const wxString& label, const wxBitmap& icon, long style); | |
104 | static wxRect GetExpandedPosition(wxRect panel, | |
105 | wxSize expanded_size, | |
106 | wxDirection direction); | |
107 | ||
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; | |
116 | long m_flags; | |
117 | bool m_minimised; | |
118 | bool m_hovered; | |
119 | ||
120 | #ifndef SWIG | |
121 | DECLARE_CLASS(wxRibbonPanel) | |
122 | DECLARE_EVENT_TABLE() | |
123 | #endif | |
124 | }; | |
125 | ||
126 | #endif // wxUSE_RIBBON | |
127 | ||
128 | #endif // _WX_RIBBON_PANEL_H_ |