File: panel.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (275 lines) | stat: -rw-r--r-- 9,137 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
///////////////////////////////////////////////////////////////////////////////
// Name:        ribbon/panel.h
// Purpose:     interface of wxRibbonPage
// Author:      Peter Cawley
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

/**
    @class wxRibbonPanelEvent

    Event used to indicate various actions relating to a wxRibbonPanel.

    See wxRibbonPanel for available event types.

    @since 2.9.4

    @library{wxribbon}
    @category{events,ribbon}

    @see wxRibbonPanel
*/
class wxRibbonPanelEvent : public wxCommandEvent
{
public:
    /**
        Constructor.
    */
    wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL,
                       int win_id = 0,
                       wxRibbonPanel* panel = NULL)

    /**
        Returns the panel relating to this event.
    */
    wxRibbonPanel* GetPanel();

    /**
        Sets the page relating to this event.
    */
    void SetPanel(wxRibbonPanel* page);
};

/**
    @class wxRibbonPanel

    Serves as a container for a group of (ribbon) controls. A wxRibbonPage will
    typically have panels for children, with the controls for that page placed
    on the panels.

    A panel adds a border and label to a group of controls, and can be
    minimised (either automatically to conserve space, or manually by the user).

    Non ribbon controls can be placed on a panel using wxSizers to manage
    layout. Panel size is governed by the sizer's minimum calculated size and
    the parent wxRibbonPage's dimensions. For functional and aesthetic reasons
    it is recommended that ribbon and non ribbon controls are not mixed in one
    panel.

    @sa wxRibbonPage

    @beginStyleTable
    @style{wxRIBBON_PANEL_DEFAULT_STYLE}
        Defined as no other flags set.
    @style{wxRIBBON_PANEL_NO_AUTO_MINIMISE}
        Prevents the panel from automatically minimising to conserve screen
        space.
    @style{wxRIBBON_PANEL_EXT_BUTTON}
        Causes an extension button to be shown in the panel's chrome (if the
        bar in which it is contained has wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
        set). The behaviour of this button is application controlled, but
        typically will show an extended drop-down menu relating to the
        panel.
    @style{wxRIBBON_PANEL_MINIMISE_BUTTON}
        Causes a (de)minimise button to be shown in the panel's chrome (if
        the bar in which it is contained has the
        wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS style set). This flag is
        typically combined with wxRIBBON_PANEL_NO_AUTO_MINIMISE to make a
        panel which the user always has manual control over when it
        minimises.
    @style{wxRIBBON_PANEL_STRETCH}
        Stretches a single panel to fit the parent page.
    @style{wxRIBBON_PANEL_FLEXIBLE}
        Allows the panel to size in both directions; currently only useful
        when a single wxRibbonToolBar is the child of the panel, particularly
        in vertical orientation where the number of rows is dependent on the
        amount of horizontal space available. Set the minimum and maximum
        toolbar rows to take full advantage of this wrapping behaviour.
    @endStyleTable

    @beginEventEmissionTable{wxRibbonPanelEvent}
    @event{EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(id, func)}
        Triggered when the user activate the panel extension button.
    @endEventTable

    @library{wxribbon}
    @category{ribbon}
*/
class wxRibbonPanel : public wxRibbonControl
{
public:
    /**
        Default constructor.
        With this constructor, Create() should be called in order to create
        the ribbon panel.
    */
    wxRibbonPanel();

    /**
        Constructs a ribbon panel.

        @param parent
            Pointer to a parent window, which is typically a wxRibbonPage,
            though it can be any window.
        @param id
            Window identifier.
        @param label
            Label to be used in the wxRibbonPanel's chrome.
        @param minimised_icon
            Icon to be used in place of the panel's children when the panel
            is minimised.
        @param pos
            The initial position of the panel. Not relevant when the parent is
            a ribbon page, as the position and size of the panel will be
            dictated by the page.
        @param size
            The initial size of the panel. Not relevant when the parent is a
            ribbon page, as the position and size of the panel will be
            dictated by the page.
        @param style
            Style flags for the panel.
    */
    wxRibbonPanel(wxWindow* parent,
                  wxWindowID id = wxID_ANY,
                  const wxString& label = wxEmptyString,
                  const wxBitmap& minimised_icon = wxNullBitmap,
                  const wxPoint& pos = wxDefaultPosition,
                  const wxSize& size = wxDefaultSize,
                  long style = wxRIBBON_PANEL_DEFAULT_STYLE);

    /**
        Create a ribbon panel in two-step ribbon panel construction.
        Should only be called when the default constructor is used, and
        arguments have the same meaning as in the full constructor.
    */
    bool Create(wxWindow* parent,
                wxWindowID id = wxID_ANY,
                const wxString& label = wxEmptyString,
                const wxBitmap& icon = wxNullBitmap,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = wxRIBBON_PANEL_DEFAULT_STYLE);

    /**
        Destructor.
    */
    virtual ~wxRibbonPanel();

    /**
        Get the bitmap to be used in place of the panel children when it is
        minimised.
    */
    wxBitmap& GetMinimisedIcon();
    const wxBitmap& GetMinimisedIcon() const;

    /**
        Test if the panel has an extension button.

        Such button is shown in the top right corner of the panel if
        @c wxRIBBON_PANEL_EXT_BUTTON style is used for it.

        @since 2.9.4

        @return @true if the panel and its wxRibbonBar allow it in their styles.
    */
    virtual bool HasExtButton() const;

    /**
        Query if the panel is currently minimised.
    */
    bool IsMinimised() const;

    /**
        Query if the panel would be minimised at a given size.
    */
    bool IsMinimised(wxSize at_size) const;

    /**
        Query is the mouse is currently hovered over the panel.
        @return @true if the cursor is within the bounds of the panel (i.e.
            hovered over the panel or one of its children), @false otherwise.
    */
    bool IsHovered() const;

    /**
        Query if the mouse is currently hovered over the extension button.

        Extension button is only shown for panels with @c
        wxRIBBON_PANEL_EXT_BUTTON style.

        @since 2.9.4
    */
    bool IsExtButtonHovered() const;

    /**
        Query if the panel can automatically minimise itself at small sizes.
    */
    bool CanAutoMinimise() const;

    /**
        Show the panel externally expanded.

        When a panel is minimised, it can be shown full-size in a pop-out
        window, which is referred to as being (externally) expanded. Note that
        when a panel is expanded, there exist two panels - the original panel
        (which is referred to as the dummy panel) and the expanded panel. The
        original is termed a dummy as it sits in the ribbon bar doing nothing,
        while the expanded panel holds the panel children.

        @return @true if the panel was expanded, @false if it was not (possibly
            due to it not being minimised, or already being expanded).

        @see HideExpanded()
        @see GetExpandedPanel()
    */
    bool ShowExpanded();

    /**
        Hide the panel's external expansion.

        @return @true if the panel was un-expanded, @false if it was not
            (normally due to it not being expanded in the first place).

        @see HideExpanded()
        @see GetExpandedPanel()
    */
    bool HideExpanded();

    /**
        Set the art provider to be used. Normally called automatically by
        wxRibbonPage when the panel is created, or the art provider changed on the
        page.

        The new art provider will be propagated to the children of the panel.
    */
    void SetArtProvider(wxRibbonArtProvider* art);

    /**
        Realize all children of the panel.
    */
    bool Realize();

    /**
        Get the dummy panel of an expanded panel.

        Note that this should be called on an expanded panel to get the dummy
        associated with it - it will return NULL when called on the dummy
        itself.

        @see ShowExpanded()
        @see GetExpandedPanel()
    */
    wxRibbonPanel* GetExpandedDummy();

    /**
        Get the expanded panel of a dummy panel.

        Note that this should be called on a dummy panel to get the expanded
        panel associated with it - it will return NULL when called on the
        expanded panel itself.

        @see ShowExpanded()
        @see GetExpandedDummy()
    */
    wxRibbonPanel* GetExpandedPanel();
};