]> git.saurik.com Git - wxWidgets.git/blame - include/wx/ribbon/panel.h
Force wide char environment version initialization in wxGetEnvMap().
[wxWidgets.git] / include / wx / ribbon / panel.h
CommitLineData
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
21enum wxRibbonPanelOption
22{
8d3d5f06
JS
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,
98742322 27 wxRIBBON_PANEL_FLEXIBLE = 1 << 6,
ce00f59b 28
8d3d5f06 29 wxRIBBON_PANEL_DEFAULT_STYLE = 0
3c3ead1d
PC
30};
31
32class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl
33{
34public:
35 wxRibbonPanel();
36
37 wxRibbonPanel(wxWindow* parent,
38 wxWindowID id = wxID_ANY,
39 const wxString& label = wxEmptyString,
40 const wxBitmap& minimised_icon = wxNullBitmap,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxRIBBON_PANEL_DEFAULT_STYLE);
44
45 virtual ~wxRibbonPanel();
46
47 bool Create(wxWindow* parent,
48 wxWindowID id = wxID_ANY,
49 const wxString& label = wxEmptyString,
50 const wxBitmap& icon = wxNullBitmap,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxRIBBON_PANEL_DEFAULT_STYLE);
54
55 wxBitmap& GetMinimisedIcon() {return m_minimised_icon;}
56 const wxBitmap& GetMinimisedIcon() const {return m_minimised_icon;}
57 bool IsMinimised() const;
58 bool IsMinimised(wxSize at_size) const;
59 bool IsHovered() const;
0a7ee6e0 60 bool IsExtButtonHovered() const;
3c3ead1d
PC
61 bool CanAutoMinimise() const;
62
63 bool ShowExpanded();
64 bool HideExpanded();
65
66 void SetArtProvider(wxRibbonArtProvider* art);
67
68 virtual bool Realize();
69 virtual bool Layout();
70 virtual wxSize GetMinSize() const;
3c3ead1d
PC
71
72 virtual bool IsSizingContinuous() const;
73
74 virtual void AddChild(wxWindowBase *child);
75 virtual void RemoveChild(wxWindowBase *child);
76
0a7ee6e0
VZ
77 virtual bool HasExtButton() const;
78
3c3ead1d
PC
79 wxRibbonPanel* GetExpandedDummy();
80 wxRibbonPanel* GetExpandedPanel();
81
98742322
JS
82 // Finds the best width and height given the parent's width and height
83 virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const;
84
85 long GetFlags() { return m_flags; }
86
3c3ead1d 87protected:
cff9681b 88 virtual wxSize DoGetBestSize() const;
140091e5
PC
89 virtual wxSize GetPanelSizerBestSize() const;
90 wxSize GetPanelSizerMinSize() const;
3c3ead1d
PC
91 wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
92 wxSize GetMinNotMinimisedSize() const;
93
94 virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
95 wxSize relative_to) const;
96 virtual wxSize DoGetNextLargerSize(wxOrientation direction,
97 wxSize relative_to) const;
98
99 void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
100 void OnSize(wxSizeEvent& evt);
101 void OnEraseBackground(wxEraseEvent& evt);
102 void OnPaint(wxPaintEvent& evt);
103 void OnMouseEnter(wxMouseEvent& evt);
104 void OnMouseEnterChild(wxMouseEvent& evt);
105 void OnMouseLeave(wxMouseEvent& evt);
106 void OnMouseLeaveChild(wxMouseEvent& evt);
107 void OnMouseClick(wxMouseEvent& evt);
0a7ee6e0 108 void OnMotion(wxMouseEvent& evt);
3c3ead1d
PC
109 void OnKillFocus(wxFocusEvent& evt);
110 void OnChildKillFocus(wxFocusEvent& evt);
111
112 void TestPositionForHover(const wxPoint& pos);
113 bool ShouldSendEventToDummy(wxEvent& evt);
114 virtual bool TryAfter(wxEvent& evt);
115
116 void CommonInit(const wxString& label, const wxBitmap& icon, long style);
117 static wxRect GetExpandedPosition(wxRect panel,
118 wxSize expanded_size,
119 wxDirection direction);
120
121 wxBitmap m_minimised_icon;
122 wxBitmap m_minimised_icon_resized;
123 wxSize m_smallest_unminimised_size;
124 wxSize m_minimised_size;
125 wxDirection m_preferred_expand_direction;
126 wxRibbonPanel* m_expanded_dummy;
127 wxRibbonPanel* m_expanded_panel;
128 wxWindow* m_child_with_focus;
129 long m_flags;
130 bool m_minimised;
131 bool m_hovered;
0a7ee6e0
VZ
132 bool m_ext_button_hovered;
133 wxRect m_ext_button_rect;
3c3ead1d
PC
134
135#ifndef SWIG
136 DECLARE_CLASS(wxRibbonPanel)
137 DECLARE_EVENT_TABLE()
138#endif
139};
140
0a7ee6e0
VZ
141
142class WXDLLIMPEXP_RIBBON wxRibbonPanelEvent : public wxCommandEvent
143{
144public:
145 wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL,
146 int win_id = 0,
147 wxRibbonPanel* panel = NULL)
148 : wxCommandEvent(command_type, win_id)
149 , m_panel(panel)
150 {
151 }
152#ifndef SWIG
153 wxRibbonPanelEvent(const wxRibbonPanelEvent& e) : wxCommandEvent(e)
154 {
155 m_panel = e.m_panel;
156 }
157#endif
158 wxEvent *Clone() const { return new wxRibbonPanelEvent(*this); }
159
160 wxRibbonPanel* GetPanel() {return m_panel;}
161 void SetPanel(wxRibbonPanel* panel) {m_panel = panel;}
162
163protected:
164 wxRibbonPanel* m_panel;
165
166#ifndef SWIG
167private:
168 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonPanelEvent)
169#endif
170};
171
172#ifndef SWIG
173
174wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, wxRibbonPanelEvent);
175
176typedef void (wxEvtHandler::*wxRibbonPanelEventFunction)(wxRibbonPanelEvent&);
177
178#define wxRibbonPanelEventHandler(func) \
179 wxEVENT_HANDLER_CAST(wxRibbonPanelEventFunction, func)
180
181#define EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(winid, fn) \
182 wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, winid, wxRibbonPanelEventHandler(fn))
183#else
184
185// wxpython/swig event work
186%constant wxEventType wxEVT_COMMAND_RIBBONPANEL_ACTIVATED;
187
188%pythoncode {
189 EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, 1 )
190}
191#endif
192
3c3ead1d
PC
193#endif // wxUSE_RIBBON
194
195#endif // _WX_RIBBON_PANEL_H_