]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/control.h
Applied minor documentation corrections to wxRegKey from charles (fixes #10407).
[wxWidgets.git] / interface / wx / control.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.h
e54c96f1 3// Purpose: interface of wxControl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
5c87527c
FM
9/**
10 The different ellipsization modes supported by the
11 wxControl::Ellipsize function.
12*/
13enum wxEllipsizeMode
14{
15 wxELLIPSIZE_START,
16 wxELLIPSIZE_MIDDLE,
17 wxELLIPSIZE_END
18};
19
23324ae1
FM
20/**
21 @class wxControl
7c913512 22
cdbcf4c2 23 This is the base class for a control or "widget".
7c913512 24
23324ae1
FM
25 A control is generally a small window which processes user input and/or
26 displays one or more item of data.
7c913512 27
23324ae1
FM
28 @library{wxcore}
29 @category{ctrl}
7c913512 30
e54c96f1 31 @see wxValidator
23324ae1
FM
32*/
33class wxControl : public wxWindow
34{
35public:
36 /**
bd0812fe
BP
37 Simulates the effect of the user issuing a command to the item.
38
39 @see wxCommandEvent
23324ae1 40 */
b7e94bd7 41 virtual void Command(wxCommandEvent& event);
23324ae1 42
5c87527c
FM
43 /**
44 Replaces parts of the @a label string with ellipsis, if needed, so
45 that it doesn't exceed @a maxWidth.
46
47 @param label
48 The string to ellipsize
49 @param dc
50 The DC used to retrieve the character widths through the
51 wxDC::GetPartialTextExtents() function.
52 @param mode
53 The ellipsization modes. See ::wxEllipsizeMode.
54 @param maxWidth
55 The maximum width of the returned string in pixels.
56 */
57 static wxString Ellipsize(const wxString& label, const wxDC& dc,
58 wxEllipsizeMode mode, int maxWidth);
59
23324ae1
FM
60 /**
61 Returns the control's text.
bd0812fe
BP
62
63 @note The returned string contains mnemonics ("&" characters) if it has
64 any, use GetLabelText() if they are undesired.
23324ae1 65 */
328f5751 66 wxString GetLabel() const;
23324ae1 67
23324ae1 68 /**
bd0812fe 69 Returns the control's label without mnemonics.
23324ae1 70 */
4707b84c 71 wxString GetLabelText() const;
bd0812fe
BP
72
73 /**
4520d583 74 Returns the given @a label string without mnemonics ("&" characters).
bd0812fe
BP
75 */
76 static wxString GetLabelText(const wxString& label);
23324ae1 77
4520d583
FM
78 /**
79 Removes the mnemonics ("&" characters) from the given string.
80 */
81 static wxString RemoveMnemonics(const wxString& str);
82
5b8b2c84
VZ
83 /**
84 Escape the special mnemonics characters ("&") in the given string.
85
86 This function can be helpful if you need to set the controls label to a
87 user-provided string. If the string contains ampersands, they wouldn't
88 appear on the display but be used instead to indicate that the
89 character following the first of them can be used as a control mnemonic.
90 While this can sometimes be desirable (e.g. to allow the user to
91 configure mnemonics of the controls), more often you will want to use
92 this function before passing a user-defined string to SetLabel().
93 Alternatively, if the label is entirely user-defined, you can just call
94 SetLabelText() directly -- but this function must be used if the label
95 is a combination of a part defined by program containing the control
96 mnemonics and a user-defined part.
97
98 @param text
99 The string such as it should appear on the display.
100 @return
101 The same string with the ampersands in it doubled.
102 */
103 static wxString EscapeMnemonics(const wxString& text);
104
23324ae1
FM
105 /**
106 Sets the item's text.
bd0812fe
BP
107
108 Any "&" characters in the @a label are special and indicate that the
4520d583 109 following character is a @e mnemonic for this control and can be used to
bd0812fe 110 activate it from the keyboard (typically by using @e Alt key in
5b8b2c84
VZ
111 combination with it). To insert a literal ampersand character, you need
112 to double it, i.e. use use "&&". If this behaviour is undesirable, use
113 SetLabelText() instead.
23324ae1
FM
114 */
115 void SetLabel(const wxString& label);
5b8b2c84
VZ
116
117 /**
118 Sets the item's text to exactly the given string.
119
120 Unlike SetLabel(), this function shows exactly the @a text passed to it
121 in the control, without interpreting ampersands in it in any way.
122 Notice that it means that the control can't have any mnemonic defined
123 for it using this function.
124
125 @see EscapeMnemonics()
126 */
127 void SetLabelText(const wxString& text);
23324ae1 128};
e54c96f1 129