File: control.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 (180 lines) | stat: -rw-r--r-- 6,656 bytes parent folder | download | duplicates (14)
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
///////////////////////////////////////////////////////////////////////////////
// Name:        ribbon/control.h
// Purpose:     interface of wxRibbonControl
// Author:      Peter Cawley
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

/**
    @class wxRibbonControl

    wxRibbonControl serves as a base class for all controls which share the
    ribbon characteristics of having a ribbon art provider, and (optionally)
    non-continuous resizing. Despite what the name may imply, it is not the
    top-level control for creating a ribbon interface - that is wxRibbonBar.

    Ribbon controls often have a region which is "transparent", and shows the
    contents of the ribbon page or panel behind it. If implementing a new
    ribbon control, then it may be useful to realise that this effect is done
    by the art provider when painting the background of the control, and hence
    in the paint handler for the new control, you should call a draw background
    method on the art provider (wxRibbonArtProvider::DrawButtonBarBackground()
    and wxRibbonArtProvider::DrawToolBarBackground() typically just redraw what
    is behind the rectangle being painted) if you want transparent regions.

    @library{wxribbon}
    @category{ribbon}
*/
class wxRibbonControl : public wxControl
{
public:
    /**
        Constructor.
    */
    wxRibbonControl();

    /**
        Constructor.

        If @a parent is a wxRibbonControl with a non-NULL art provider, then
        the art provider of new control is set to that of @a parent.
    */
    wxRibbonControl(wxWindow *parent, wxWindowID id,
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize& size = wxDefaultSize, long style = 0,
                    const wxValidator& validator = wxDefaultValidator,
                    const wxString& name = wxControlNameStr);

    /**
        Set the art provider to be used. In many cases, setting the art provider
        will also set the art provider on all child windows which extend
        wxRibbonControl.

        In most cases, controls will not take ownership of the given pointer,
        with the notable exception being wxRibbonBar::SetArtProvider().
    */
    virtual void SetArtProvider(wxRibbonArtProvider* art);

    /**
        Get the art provider to be used. Note that until an art provider has
        been set in some way, this function may return NULL.
    */
    wxRibbonArtProvider* GetArtProvider() const;

    /**
        @return @true if this window can take any size (greater than its minimum
        size), @false if it can only take certain sizes.

        @see GetNextSmallerSize()
        @see GetNextLargerSize()
    */
    virtual bool IsSizingContinuous() const;

    /**
        If sizing is not continuous, then return a suitable size for the control
        which is smaller than the current size.

        @param direction
            The direction(s) in which the size should reduce.
        @return
            The current size if there is no smaller size, otherwise a suitable
            size which is smaller in the given direction(s), and the same as the
            current size in the other direction (if any).

        @see IsSizingContinuous()
    */
    wxSize GetNextSmallerSize(wxOrientation direction) const;

    /**
        If sizing is not continuous, then return a suitable size for the control
        which is smaller than the given size.

        @param direction
            The direction(s) in which the size should reduce.
        @param relative_to
            The size for which a smaller size should be found.
        @return
            @a relative_to if there is no smaller size, otherwise a suitable
            size which is smaller in the given direction(s), and the same as
            @a relative_to in the other direction (if any).

        @see IsSizingContinuous()
        @see DoGetNextSmallerSize()
    */
    wxSize GetNextSmallerSize(wxOrientation direction, wxSize relative_to) const;

    /**
        If sizing is not continuous, then return a suitable size for the control
        which is larger than the current size.

        @param direction
            The direction(s) in which the size should increase.
        @return
            The current size if there is no larger size, otherwise a suitable
            size which is larger in the given direction(s), and the same as the
            current size in the other direction (if any).

        @see IsSizingContinuous()
    */
    wxSize GetNextLargerSize(wxOrientation direction) const;

    /**
        If sizing is not continuous, then return a suitable size for the control
        which is larger than the given size.

        @param direction
            The direction(s) in which the size should increase.
        @param relative_to
            The size for which a larger size should be found.
        @return
            @a relative_to if there is no larger size, otherwise a suitable
            size which is larger in the given direction(s), and the same as
            @a relative_to in the other direction (if any).

        @see IsSizingContinuous()
        @see DoGetNextLargerSize()
    */
    wxSize GetNextLargerSize(wxOrientation direction, wxSize relative_to) const;

    /**
        Perform initial size and layout calculations after children have been
        added, and/or realize children.
    */
    virtual bool Realize();

    /**
        Alias for Realize().
    */
    bool Realise();

    /**
        Get the first ancestor which is a wxRibbonBar (or derived) or NULL
        if not having such parent.

        @since 2.9.4
     */
    virtual wxRibbonBar* GetAncestorRibbonBar()const;


    /**
        Finds the best width and height given the parent's width and height.
        Used to implement the wxRIBBON_PANEL_FLEXIBLE panel style.
    */
    virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const;
protected:
    /**
        Implementation of GetNextSmallerSize().
        Controls which have non-continuous sizing must override this virtual
        function rather than GetNextSmallerSize().
    */
    virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
                                        wxSize relative_to) const;

    /**
        Implementation of GetNextLargerSize().
        Controls which have non-continuous sizing must override this virtual
        function rather than GetNextLargerSize().
    */
    virtual wxSize DoGetNextLargerSize(wxOrientation direction,
                                       wxSize relative_to) const;
};