File: commandlinkbutton.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 (172 lines) | stat: -rw-r--r-- 5,766 bytes parent folder | download | duplicates (10)
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
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/commandlinkbutton.h
// Purpose:     interface of wxCommandLinkButton
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxCommandLinkButton

    Objects of this class are similar in appearance to the normal wxButtons but
    are similar to the links in a web page in functionality.

    Pressing such button usually results in switching to another window of the
    program and so they can be used as a replacement for the "Next" button in a
    multi-page dialog (such as wxWizard), for example.

    Their advantage compared to the ordinary wxButtons is that they emphasize
    the action of switching the window and also that they allow to give more
    detailed explanation to the user because, in addition to the short button
    label, they also show a longer description string.

    The short, title-like, part of the label is called the <em>main label</em>
    and the longer description is the <em>note</em>. Both of them can be set
    and queried independently using wxCommandLinkButton-specific methods such
    as SetMainLabel() or GetNote() or also via SetLabel() and GetLabel()
    methods inherited from wxButton. When using the latter, the main label and
    the note are concatenated into a single string using a new line character
    between them (notice that the note part can have more new lines in it).

    wxCommandLinkButton generates the same event as wxButton but doesn't
    support any of wxButton-specific styles nor adds any new styles of its own.

    Currently this class uses native implementation under Windows Vista and
    later versions and a generic implementation for the other platforms and
    earlier Windows versions.

    @since 2.9.2

    @library{wxadv}
    @category{ctrl}
    @appearance{commandlinkbutton}

    @see wxButton, wxBitmapButton
*/
class wxCommandLinkButton : public wxButton
{
public:
    /**
        Default constructor.

        Use Create() to really create the control.
    */
    wxCommandLinkButton();

    /**
        Constructor really creating a command Link button.

        The button will be decorated with stock icons under GTK+ 2.

        @param parent
            Parent window. Must not be @NULL.
        @param id
            Button identifier. A value of wxID_ANY indicates a default value.
        @param mainLabel
            First line of text on the button, typically the label of an action
            that will be made when the button is pressed.
        @param note
            Second line of text describing the action performed when the button
            is pressed.
        @param pos
            Button position.
        @param size
            Button size. If the default size is specified then the button is sized
            appropriately for the text.
        @param style
            Window style. See wxButton class description.
        @param validator
            Window validator.
        @param name
            Window name.

        @see Create(), wxValidator
    */
    wxCommandLinkButton(wxWindow* parent, wxWindowID id,
                        const wxString& mainLabel = wxEmptyString,
                        const wxString& note = wxEmptyString,
                        const wxPoint& pos = wxDefaultPosition,
                        const wxSize& size = wxDefaultSize,
                        long style = 0,
                        const wxValidator& validator = wxDefaultValidator,
                        const wxString& name = wxButtonNameStr);

    /**
        Button creation function for two-step creation.
        For more details, see wxCommandLinkButton().
    */
    bool Create(wxWindow* parent, wxWindowID id,
                const wxString& mainLabel = wxEmptyString,
                const wxString& note = wxEmptyString,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0,
                const wxValidator& validator = wxDefaultValidator,
                const wxString& name = wxButtonNameStr);

    /**
        Sets a new main label and note for the button.

        Neither of the arguments can be empty, if you need to change just the
        label or just the note, use SetMainLabel() or SetNote() instead of this
        function.

        @param mainLabel
            New main label to use.
        @param note
            New note to use.
    */
    void SetMainLabelAndNote(const wxString& mainLabel, const wxString& note);

    /**
        Sets the string label and note for the button.

        @param label
            The label and note to set, with the two separated
            by the first newline or none to set a blank note.
    */
    virtual void SetLabel(const wxString& label);

    /**
        Returns the string label for the button.

        @see SetLabel()

        @return
            A string with the main label and note concatenated
            together with a newline separating them.
    */
    wxString GetLabel() const;

    /**
        Changes the main label.

        @param mainLabel
            New main label to use.
    */
    void SetMainLabel(const wxString& mainLabel);

    /**
        Changes the note.

        @param note
            New note to use.
    */
    void SetNote(const wxString& note);

    /**
        Returns the current main label.

        @return
            Main label currently displayed.
    */
    wxString GetMainLabel() const;

    /**
        Returns the currently used note.

        @return
            Note currently displayed.
    */
    wxString GetNote() const;
};