]>
Commit | Line | Data |
---|---|---|
0dfff674 WS |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: comboctrl.tex | |
3 | %% Purpose: wxComboCtrl docs | |
4 | %% Author: Jaakko Salli | |
5 | %% Modified by: | |
6 | %% Created: | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) Jaakko Salli | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
12 | \section{\class{wxComboCtrl}}\label{wxcomboctrl} | |
13 | ||
14 | A combo control is a generic combobox that allows totally | |
15 | custom popup. In addition it has other customization features. | |
16 | For instance, position and size of the dropdown button | |
17 | can be changed. | |
18 | ||
19 | \wxheading{Setting Custom Popup for wxComboCtrl} | |
20 | ||
21 | wxComboCtrl needs to be told somehow which control to use | |
22 | and this is done by SetPopupControl(). However, we need | |
23 | something more than just a wxControl in this method as, | |
24 | for example, we need to call SetStringValue("initial text value") | |
25 | and wxControl doesn't have such method. So we also need a | |
26 | \helpref{wxComboPopup}{wxcombopopup} which is an interface which | |
27 | must be implemented by a control to be usable as a popup. | |
28 | ||
29 | We couldn't derive wxComboPopup from wxControl as this would make it | |
30 | impossible to have a class deriving from a wxWidgets control and from | |
31 | it, so instead it is just a mix-in. | |
32 | ||
33 | Here's a minimal sample of \helpref{wxListView}{wxlistview} popup: | |
34 | ||
35 | \begin{verbatim} | |
36 | ||
37 | #include <wx/combo.h> | |
38 | #include <wx/listctrl.h> | |
a7af285d VZ |
39 | \wxheading{Library} |
40 | ||
41 | \helpref{wxCore}{librarieslist} | |
42 | ||
0dfff674 WS |
43 | |
44 | class wxListViewComboPopup : public wxListView, | |
45 | public wxComboPopup | |
46 | { | |
47 | public: | |
48 | ||
49 | // Initialize member variables | |
50 | virtual void Init() | |
51 | { | |
52 | m_value = -1; | |
53 | } | |
54 | ||
55 | // Create popup control | |
56 | virtual bool Create(wxWindow* parent) | |
57 | { | |
58 | return wxListView::Create(parent,1,wxPoint(0,0),wxDefaultSize); | |
59 | } | |
60 | ||
61 | // Return pointer to the created control | |
62 | virtual wxWindow *GetControl() { return this; } | |
63 | ||
64 | // Translate string into a list selection | |
65 | virtual void SetStringValue(const wxString& s) | |
66 | { | |
67 | int n = wxListView::FindItem(-1,s); | |
68 | if ( n >= 0 && n < wxListView::GetItemCount() ) | |
69 | wxListView::Select(n); | |
70 | } | |
71 | ||
72 | // Get list selection as a string | |
73 | virtual wxString GetStringValue() const | |
74 | { | |
75 | if ( m_value >= 0 ) | |
76 | return wxListView::GetItemText(m_value); | |
77 | return wxEmptyString; | |
78 | } | |
79 | ||
80 | // Do mouse hot-tracking (which is typical in list popups) | |
81 | void OnMouseMove(wxMouseEvent& event) | |
82 | { | |
83 | // TODO: Move selection to cursor | |
84 | } | |
85 | ||
86 | // On mouse left up, set the value and close the popup | |
87 | void OnMouseClick(wxMouseEvent& WXUNUSED(event)) | |
88 | { | |
89 | m_value = wxListView::GetFirstSelected(); | |
90 | ||
91 | // TODO: Send event as well | |
92 | ||
93 | Dismiss(); | |
94 | } | |
95 | ||
96 | protected: | |
97 | ||
98 | int m_value; // current item index | |
99 | ||
100 | private: | |
101 | DECLARE_EVENT_TABLE() | |
102 | }; | |
103 | ||
104 | BEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView) | |
105 | EVT_MOTION(wxListViewComboPopup::OnMouseMove) | |
106 | EVT_LEFT_UP(wxListViewComboPopup::OnMouseClick) | |
107 | END_EVENT_TABLE() | |
108 | ||
109 | \end{verbatim} | |
110 | ||
111 | Here's how you would create and populate it in a dialog constructor: | |
112 | ||
113 | \begin{verbatim} | |
114 | ||
115 | wxComboCtrl* comboCtrl = new wxComboCtrl(this,wxID_ANY,wxEmptyString); | |
116 | ||
117 | wxListViewComboPopup* popupCtrl = new wxListViewComboPopup(); | |
118 | ||
119 | comboCtrl->SetPopupControl(popupCtrl); | |
120 | ||
121 | // Populate using wxListView methods | |
122 | popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("First Item")); | |
123 | popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("Second Item")); | |
124 | popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("Third Item")); | |
125 | ||
126 | \end{verbatim} | |
127 | ||
128 | \wxheading{Derived from} | |
129 | ||
130 | \helpref{wxControl}{wxcontrol}\\ | |
131 | \helpref{wxWindow}{wxwindow}\\ | |
132 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
133 | \helpref{wxObject}{wxobject} | |
134 | ||
135 | \wxheading{Include files} | |
136 | ||
991ad6cd | 137 | <wx/combo.h> |
0dfff674 WS |
138 | |
139 | \wxheading{Window styles} | |
140 | ||
141 | \begin{twocollist}\itemsep=0pt | |
142 | \twocolitem{\windowstyle{wxCB\_READONLY}}{Text will not be editable.} | |
143 | \twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries in the list alphabetically.} | |
591087ed | 144 | \twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate |
0dfff674 WS |
145 | the event wxEVT\_COMMAND\_TEXT\_ENTER (otherwise pressing Enter key |
146 | is either processed internally by the control or used for navigation between | |
147 | dialog controls). Windows only.} | |
148 | \twocolitem{\windowstyle{wxCC\_SPECIAL\_DCLICK}}{Double-clicking triggers a call | |
149 | to popup's OnComboDoubleClick. Actual behaviour is defined by a derived | |
150 | class. For instance, wxOwnerDrawnComboBox will cycle an item. This style only | |
151 | applies if wxCB\_READONLY is used as well.} | |
0dfff674 WS |
152 | \twocolitem{\windowstyle{wxCC\_STD\_BUTTON}}{Drop button will behave |
153 | more like a standard push button.} | |
154 | \end{twocollist} | |
155 | ||
156 | See also \helpref{window styles overview}{windowstyles}. | |
157 | ||
158 | \wxheading{Event handling} | |
159 | ||
160 | \twocolwidtha{7cm} | |
161 | \begin{twocollist}\itemsep=0pt | |
162 | \twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event, | |
163 | when the text changes.} | |
164 | \twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_ENTER event, | |
165 | when <RETURN> is pressed in the combo control.} | |
166 | \end{twocollist} | |
167 | ||
168 | \wxheading{See also} | |
169 | ||
170 | \helpref{wxComboBox}{wxcombobox}, \helpref{wxChoice}{wxchoice}, | |
171 | \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}, | |
172 | \rtfsp\helpref{wxComboPopup}{wxcombopopup}, \helpref{wxCommandEvent}{wxcommandevent} | |
173 | ||
174 | \latexignore{\rtfignore{\wxheading{Members}}} | |
175 | ||
176 | ||
177 | \membersection{wxComboCtrl::wxComboCtrl}\label{wxcomboctrlctor} | |
178 | ||
179 | \func{}{wxComboCtrl}{\void} | |
180 | ||
181 | Default constructor. | |
182 | ||
183 | \func{}{wxComboCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp | |
184 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp | |
185 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboCtrl"}} | |
186 | ||
187 | Constructor, creating and showing a combo control. | |
188 | ||
189 | \wxheading{Parameters} | |
190 | ||
191 | \docparam{parent}{Parent window. Must not be NULL.} | |
192 | ||
193 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
194 | ||
195 | \docparam{value}{Initial selection string. An empty string indicates no selection.} | |
196 | ||
197 | \docparam{pos}{Window position.} | |
198 | ||
199 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized | |
200 | appropriately.} | |
201 | ||
202 | \docparam{style}{Window style. See \helpref{wxComboCtrl}{wxcomboctrl}.} | |
203 | ||
204 | \docparam{validator}{Window validator.} | |
205 | ||
206 | \docparam{name}{Window name.} | |
207 | ||
208 | \wxheading{See also} | |
209 | ||
210 | \helpref{wxComboCtrl::Create}{wxcomboctrlcreate}, \helpref{wxValidator}{wxvalidator} | |
211 | ||
212 | ||
213 | \membersection{wxComboCtrl::\destruct{wxComboCtrl}}\label{wxcomboctrldtor} | |
214 | ||
215 | \func{}{\destruct{wxComboCtrl}}{\void} | |
216 | ||
217 | Destructor, destroying the combo control. | |
218 | ||
219 | ||
974a12f8 RR |
220 | \membersection{wxComboCtrl::AnimateShow}\label{wxcomboctrlanimateshow} |
221 | ||
222 | \func{virtual bool}{AnimateShow}{\param{const wxRect\& }{rect}, \param{int }{flags}} | |
223 | ||
224 | This member function is not normally called in application code. | |
225 | Instead, it can be implemented in a derived class to create a | |
226 | custom popup animation. | |
227 | ||
228 | \wxheading{Parameters} | |
229 | ||
230 | Same as in \helpref{DoShowPopup}{wxcomboctrldoshowpopup}. | |
231 | ||
232 | \wxheading{Return value} | |
233 | ||
234 | \true if animation finishes before the function returns. | |
235 | \false otherwise. In the latter case you need to manually call DoShowPopup | |
236 | after the animation ends. | |
237 | ||
238 | ||
0dfff674 WS |
239 | \membersection{wxComboCtrl::Create}\label{wxcomboctrlcreate} |
240 | ||
241 | \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp | |
242 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp | |
243 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboCtrl"}} | |
244 | ||
245 | Creates the combo control for two-step construction. Derived classes | |
246 | should call or replace this function. See \helpref{wxComboCtrl::wxComboCtrl}{wxcomboctrlctor}\rtfsp | |
247 | for further details. | |
248 | ||
249 | ||
250 | \membersection{wxComboCtrl::Copy}\label{wxcomboctrlcopy} | |
251 | ||
252 | \func{void}{Copy}{\void} | |
253 | ||
254 | Copies the selected text to the clipboard. | |
255 | ||
256 | ||
257 | \membersection{wxComboCtrl::Cut}\label{wxcomboctrlcut} | |
258 | ||
259 | \func{void}{Cut}{\void} | |
260 | ||
261 | Copies the selected text to the clipboard and removes the selection. | |
262 | ||
263 | ||
df348ff8 RR |
264 | \membersection{wxComboCtrl::DoSetPopupControl}\label{wxcomboctrldosetpopupcontrol} |
265 | ||
266 | \func{void}{DoSetPopupControl}{\param{wxComboPopup* }{popup}} | |
267 | ||
268 | This member function is not normally called in application code. | |
269 | Instead, it can be implemented in a derived class to return | |
270 | default wxComboPopup, incase {\tt popup} is NULL. | |
271 | ||
272 | \textbf{Note:} If you have implemented OnButtonClick to do | |
273 | something else than show the popup, then DoSetPopupControl | |
274 | must always return NULL. | |
275 | ||
276 | ||
974a12f8 RR |
277 | \membersection{wxComboCtrl::DoShowPopup}\label{wxcomboctrldoshowpopup} |
278 | ||
279 | \func{virtual void}{DoShowPopup}{\param{const wxRect\& }{rect}, \param{int }{flags}} | |
280 | ||
281 | This member function is not normally called in application code. | |
282 | Instead, it must be called in a derived class to make sure popup | |
283 | is properly shown after a popup animation has finished (but only | |
284 | if \helpref{AnimateShow}{wxcomboctrlanimateshow} did not finish | |
285 | the animation within it's function scope). | |
286 | ||
287 | \wxheading{Parameters} | |
288 | ||
289 | \docparam{rect}{Position to show the popup window at, in screen coordinates.} | |
290 | ||
291 | \docparam{flags}{Combination of any of the following:} | |
292 | \twocolwidtha{8cm}% | |
293 | \begin{twocollist}\itemsep=0pt | |
294 | \twocolitem{{\tt wxComboCtrl::ShowAbove}}{Popup is shown above the control instead | |
295 | of below.} | |
296 | \twocolitem{{\tt wxComboCtrl::CanDeferShow}}{Showing the popup can be deferred | |
297 | to happen sometime after \helpref{ShowPopup}{wxcomboctrlshowpopup} has finished. | |
298 | In this case, \helpref{AnimateShow}{wxcomboctrlanimateshow} must return \false.} | |
299 | \end{twocollist} | |
300 | ||
301 | ||
30be036c RR |
302 | \membersection{wxComboCtrl::EnablePopupAnimation}\label{wxcomboctrlenablepopupanimation} |
303 | ||
304 | \func{void}{EnablePopupAnimation}{\param{bool }{enable = true}} | |
305 | ||
306 | Enables or disables popup animation, if any, depending on the value of | |
307 | the argument. | |
308 | ||
309 | ||
0dfff674 WS |
310 | \membersection{wxComboCtrl::GetBitmapDisabled}\label{wxcomboctrlgetbitmapdisabled} |
311 | ||
312 | \constfunc{const wxBitmap\&}{GetBitmapDisabled}{\void} | |
313 | ||
314 | Returns disabled button bitmap that has been set with | |
315 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
316 | ||
317 | \wxheading{Return value} | |
318 | ||
319 | A reference to the disabled state bitmap. | |
320 | ||
321 | ||
322 | \membersection{wxComboCtrl::GetBitmapHover}\label{wxcomboctrlgetbitmaphover} | |
323 | ||
324 | \constfunc{const wxBitmap\&}{GetBitmapHover}{\void} | |
325 | ||
326 | Returns button mouse hover bitmap that has been set with | |
327 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
328 | ||
329 | \wxheading{Return value} | |
330 | ||
331 | A reference to the mouse hover state bitmap. | |
332 | ||
333 | ||
334 | \membersection{wxComboCtrl::GetBitmapNormal}\label{wxcomboctrlgetbitmapnormal} | |
335 | ||
336 | \constfunc{const wxBitmap\&}{GetBitmapNormal}{\void} | |
337 | ||
338 | Returns default button bitmap that has been set with | |
339 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
340 | ||
341 | \wxheading{Return value} | |
342 | ||
343 | A reference to the normal state bitmap. | |
344 | ||
345 | ||
346 | \membersection{wxComboCtrl::GetBitmapPressed}\label{wxcomboctrlgetbitmappressed} | |
347 | ||
348 | \constfunc{const wxBitmap\&}{GetBitmapPressed}{\void} | |
349 | ||
350 | Returns depressed button bitmap that has been set with | |
351 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
352 | ||
353 | \wxheading{Return value} | |
354 | ||
355 | A reference to the depressed state bitmap. | |
356 | ||
357 | ||
7dc234d6 WS |
358 | \membersection{wxComboCtrl::GetButtonSize}\label{wxcomboctrlgetbuttonsize} |
359 | ||
360 | \func{wxSize}{GetButtonSize}{\void} | |
361 | ||
362 | Returns current size of the dropdown button. | |
363 | ||
364 | ||
0dfff674 WS |
365 | \membersection{wxComboCtrl::GetCustomPaintWidth}\label{wxcomboctrlgetcustompaintwidth} |
366 | ||
367 | \constfunc{int}{GetCustomPaintWidth}{\void} | |
368 | ||
369 | Returns custom painted area in control. | |
370 | ||
371 | \wxheading{See also} | |
372 | ||
373 | \helpref{wxComboCtrl::SetCustomPaintWidth}{wxcomboctrlsetcustompaintwidth}. | |
374 | ||
375 | ||
376 | \membersection{wxComboCtrl::GetFeatures}\label{wxcomboctrlgetfeatures} | |
377 | ||
378 | \func{static int}{GetFeatures}{\void} | |
379 | ||
380 | Returns features supported by wxComboCtrl. If needed feature is missing, | |
381 | you need to instead use wxGenericComboCtrl, which however may lack | |
382 | native look and feel (but otherwise sports identical API). | |
383 | ||
384 | \wxheading{Return value} | |
385 | ||
386 | Value returned is a combination of following flags: | |
387 | ||
388 | \twocolwidtha{8cm}% | |
389 | \begin{twocollist}\itemsep=0pt | |
390 | \twocolitem{{\tt wxComboCtrlFeatures::MovableButton}}{Button can | |
391 | be on either side of the control.} | |
392 | \twocolitem{{\tt wxComboCtrlFeatures::BitmapButton}}{Button may | |
393 | be replaced with bitmap.} | |
394 | \twocolitem{{\tt wxComboCtrlFeatures::ButtonSpacing}}{Button can | |
395 | have spacing.} | |
396 | \twocolitem{{\tt wxComboCtrlFeatures::TextIndent}}{SetTextIndent | |
397 | works.} | |
398 | \twocolitem{{\tt wxComboCtrlFeatures::PaintControl}}{Combo control | |
399 | itself can be custom painted.} | |
400 | \twocolitem{{\tt wxComboCtrlFeatures::PaintWritable}}{A variable- | |
401 | width area in front of writable combo control's textctrl can | |
402 | be custom painted.} | |
0a42e3b6 | 403 | \twocolitem{{\tt wxComboCtrlFeatures::Borderless}}{wxBORDER\_NONE window style works.} |
0dfff674 WS |
404 | \twocolitem{{\tt wxComboCtrlFeatures::All}}{All of the |
405 | above.} | |
406 | \end{twocollist} | |
407 | ||
408 | ||
409 | \membersection{wxComboCtrl::GetInsertionPoint}\label{wxcomboctrlgetinsertionpoint} | |
410 | ||
411 | \constfunc{long}{GetInsertionPoint}{\void} | |
412 | ||
413 | Returns the insertion point for the combo control's text field. | |
414 | ||
415 | \textbf{Note:} Under wxMSW, this function always returns $0$ if the combo control | |
416 | doesn't have the focus. | |
417 | ||
418 | ||
974a12f8 RR |
419 | \membersection{wxComboCtrl::IsPopupWindowState}\label{wxcomboctrlispopupwindowstate} |
420 | ||
421 | \constfunc{bool}{IsPopupWindowState}{\param{int }{state}} | |
422 | ||
423 | Returns \true if the popup window is in the given state. | |
424 | Possible values are: | |
425 | \twocolwidtha{8cm}% | |
426 | \begin{twocollist}\itemsep=0pt | |
427 | \twocolitem{{\tt wxComboCtrl::Hidden}}{Popup window is hidden.} | |
428 | \twocolitem{{\tt wxComboCtrl::Animating}}{Popup window is being shown, but the | |
429 | popup animation has not yet finished.} | |
430 | \twocolitem{{\tt wxComboCtrl::Visible}}{Popup window is fully visible.} | |
431 | \end{twocollist} | |
432 | ||
433 | ||
434 | ||
0dfff674 WS |
435 | \membersection{wxComboCtrl::GetLastPosition}\label{wxcomboctrlgetlastposition} |
436 | ||
437 | \constfunc{long}{GetLastPosition}{\void} | |
438 | ||
439 | Returns the last position in the combo control text field. | |
440 | ||
441 | ||
442 | \membersection{wxComboCtrl::GetPopupControl}\label{wxcomboctrlgetpopupcontrol} | |
443 | ||
444 | \func{wxComboPopup*}{GetPopupControl}{\void} | |
445 | ||
446 | Returns current popup interface that has been set with SetPopupControl. | |
447 | ||
448 | ||
449 | \membersection{wxComboCtrl::GetPopupWindow}\label{wxcomboctrlgetpopupwindow} | |
450 | ||
451 | \constfunc{wxWindow*}{GetPopupWindow}{\void} | |
452 | ||
453 | Returns popup window containing the popup control. | |
454 | ||
455 | ||
456 | \membersection{wxComboCtrl::GetTextCtrl}\label{wxcomboctrlgettextctrl} | |
457 | ||
458 | \constfunc{wxTextCtrl*}{GetTextCtrl}{\void} | |
459 | ||
460 | Get the text control which is part of the combo control. | |
461 | ||
462 | ||
463 | \membersection{wxComboCtrl::GetTextIndent}\label{wxcomboctrlgettextindent} | |
464 | ||
465 | \constfunc{wxCoord}{GetTextIndent}{\void} | |
466 | ||
467 | Returns actual indentation in pixels. | |
468 | ||
469 | ||
df348ff8 RR |
470 | \membersection{wxComboCtrl::GetTextRect}\label{wxcomboctrlgettextrect} |
471 | ||
472 | \constfunc{const wxRect\&}{GetTextRect}{\void} | |
473 | ||
474 | Returns area covered by the text field (includes everything except | |
475 | borders and the dropdown button). | |
476 | ||
477 | ||
0dfff674 WS |
478 | \membersection{wxComboCtrl::GetValue}\label{wxcomboctrlgetvalue} |
479 | ||
480 | \constfunc{wxString}{GetValue}{\void} | |
481 | ||
482 | Returns text representation of the current value. For writable | |
483 | combo control it always returns the value in the text field. | |
484 | ||
485 | ||
486 | \membersection{wxComboCtrl::HidePopup}\label{wxcomboctrlhidepopup} | |
487 | ||
488 | \func{void}{HidePopup}{\void} | |
489 | ||
490 | Dismisses the popup window. | |
491 | ||
492 | ||
493 | \membersection{wxComboCtrl::IsPopupShown}\label{wxcomboctrlispopupshown} | |
494 | ||
495 | \constfunc{bool}{IsPopupShown}{\void} | |
496 | ||
497 | Returns \true if the popup is currently shown | |
498 | ||
499 | ||
500 | \membersection{wxComboCtrl::OnButtonClick}\label{wxcomboctrlonbuttonclick} | |
501 | ||
502 | \func{void}{OnButtonClick}{\void} | |
503 | ||
504 | Implement in a derived class to define what happens on | |
505 | dropdown button click. | |
506 | ||
507 | Default action is to show the popup. | |
508 | ||
df348ff8 RR |
509 | \textbf{Note:} If you implement this to do something else than |
510 | show the popup, you must then also implement | |
511 | \helpref{DoSetPopupControl}{wxcomboctrldosetpopupcontrol} to always | |
512 | return NULL. | |
513 | ||
0dfff674 WS |
514 | |
515 | \membersection{wxComboCtrl::Paste}\label{wxcomboctrlpaste} | |
516 | ||
517 | \func{void}{Paste}{\void} | |
518 | ||
519 | Pastes text from the clipboard to the text field. | |
520 | ||
521 | ||
522 | \membersection{wxComboCtrl::Remove}\label{wxcomboctrlremove} | |
523 | ||
524 | \func{void}{Remove}{\param{long }{from}, \param{long }{to}} | |
525 | ||
526 | Removes the text between the two positions in the combo control text field. | |
527 | ||
528 | \wxheading{Parameters} | |
529 | ||
530 | \docparam{from}{The first position.} | |
531 | ||
532 | \docparam{to}{The last position.} | |
533 | ||
534 | ||
535 | \membersection{wxComboCtrl::Replace}\label{wxcomboctrlreplace} | |
536 | ||
537 | \func{void}{Replace}{\param{long }{from}, \param{long }{to}, \param{const wxString\& }{value}} | |
538 | ||
539 | Replaces the text between two positions with the given text, in the combo control text field. | |
540 | ||
541 | \wxheading{Parameters} | |
542 | ||
543 | \docparam{from}{The first position.} | |
544 | ||
545 | \docparam{to}{The second position.} | |
546 | ||
547 | \docparam{text}{The text to insert.} | |
548 | ||
549 | ||
550 | \membersection{wxComboCtrl::SetButtonBitmaps}\label{wxcomboctrlsetbuttonbitmaps} | |
551 | ||
552 | \func{void}{SetButtonBitmaps}{\param{const wxBitmap\& }{bmpNormal}, \param{bool }{pushButtonBg = false}, \param{const wxBitmap\& }{bmpPressed = wxNullBitmap}, \param{const wxBitmap\& }{bmpHover = wxNullBitmap}, \param{const wxBitmap\& }{bmpDisabled = wxNullBitmap}} | |
553 | ||
554 | Sets custom dropdown button graphics. | |
555 | ||
556 | \wxheading{Parameters} | |
557 | ||
558 | \docparam{bmpNormal}{Default button image.} | |
559 | \docparam{pushButtonBg}{If \true, blank push button background is painted | |
560 | below the image.} | |
561 | \docparam{bmpPressed}{Depressed button image.} | |
562 | \docparam{bmpHover}{Button image when mouse hovers above it. This | |
563 | should be ignored on platforms and themes that do not generally draw | |
564 | different kind of button on mouse hover.} | |
565 | \docparam{bmpDisabled}{Disabled button image.} | |
566 | ||
567 | ||
568 | \membersection{wxComboCtrl::SetButtonPosition}\label{wxcomboctrlsetbuttonposition} | |
569 | ||
7dc234d6 | 570 | \func{void}{SetButtonPosition}{\param{int }{width = -1}, \param{int }{height = -1}, \param{int }{side = wxRIGHT}, \param{int }{spacingX = 0}} |
0dfff674 WS |
571 | |
572 | Sets size and position of dropdown button. | |
573 | ||
574 | \wxheading{Parameters} | |
575 | ||
7dc234d6 WS |
576 | \docparam{width}{Button width. Value <= $0$ specifies default.} |
577 | \docparam{height}{Button height. Value <= $0$ specifies default.} | |
0dfff674 WS |
578 | \docparam{side}{Indicates which side the button will be placed. |
579 | Value can be {\tt wxLEFT} or {\tt wxRIGHT}.} | |
580 | \docparam{spacingX}{Horizontal spacing around the button. Default is $0$.} | |
581 | ||
582 | ||
583 | \membersection{wxComboCtrl::SetCustomPaintWidth}\label{wxcomboctrlsetcustompaintwidth} | |
584 | ||
585 | \func{void}{SetCustomPaintWidth}{\param{int }{width}} | |
586 | ||
587 | Set width, in pixels, of custom painted area in control without {\tt wxCB\_READONLY} | |
588 | style. In read-only \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}, this is used | |
589 | to indicate area that is not covered by the focus rectangle. | |
590 | ||
591 | ||
592 | \membersection{wxComboCtrl::SetInsertionPoint}\label{wxcomboctrlsetinsertionpoint} | |
593 | ||
594 | \func{void}{SetInsertionPoint}{\param{long }{pos}} | |
595 | ||
596 | Sets the insertion point in the text field. | |
597 | ||
598 | \wxheading{Parameters} | |
599 | ||
600 | \docparam{pos}{The new insertion point.} | |
601 | ||
602 | ||
603 | \membersection{wxComboCtrl::SetInsertionPointEnd}\label{wxcomboctrlsetinsertionpointend} | |
604 | ||
605 | \func{void}{SetInsertionPointEnd}{\void} | |
606 | ||
607 | Sets the insertion point at the end of the combo control text field. | |
608 | ||
609 | ||
610 | \membersection{wxComboCtrl::SetPopupAnchor}\label{wxcomboctrlsetpopupanchor} | |
611 | ||
612 | \func{void}{SetPopupAnchor}{\param{int }{anchorSide}} | |
613 | ||
614 | Set side of the control to which the popup will align itself. Valid values are | |
615 | {\tt wxLEFT}, {\tt wxRIGHT} and $0$. The default value $0$ means that the most appropriate | |
616 | side is used (which, currently, is always {\tt wxLEFT}). | |
617 | ||
618 | ||
619 | \membersection{wxComboCtrl::SetPopupControl}\label{wxcomboctrlsetpopupcontrol} | |
620 | ||
621 | \func{void}{SetPopupControl}{\param{wxComboPopup* }{popup}} | |
622 | ||
623 | Set popup interface class derived from wxComboPopup. | |
624 | This method should be called as soon as possible after the control | |
625 | has been created, unless \helpref{OnButtonClick}{wxcomboctrlonbuttonclick} | |
626 | has been overridden. | |
627 | ||
628 | ||
629 | \membersection{wxComboCtrl::SetPopupExtents}\label{wxcomboctrlsetpopupextents} | |
630 | ||
631 | \func{void}{SetPopupExtents}{\param{int }{extLeft}, \param{int }{extRight}} | |
632 | ||
633 | Extends popup size horizontally, relative to the edges of the combo control. | |
634 | ||
635 | \wxheading{Parameters} | |
636 | ||
637 | \docparam{extLeft}{How many pixel to extend beyond the left edge of the | |
638 | control. Default is $0$.} | |
639 | \docparam{extRight}{How many pixel to extend beyond the right edge of the | |
640 | control. Default is $0$.} | |
641 | ||
642 | \wxheading{Remarks} | |
643 | ||
644 | Popup minimum width may override arguments. | |
645 | ||
646 | It is up to the popup to fully take this into account. | |
647 | ||
648 | ||
649 | \membersection{wxComboCtrl::SetPopupMaxHeight}\label{wxcomboctrlsetpopupmaxheight} | |
650 | ||
651 | \func{void}{SetPopupMaxHeight}{\param{int }{height}} | |
652 | ||
653 | Sets preferred maximum height of the popup. | |
654 | ||
655 | \wxheading{Remarks} | |
656 | ||
657 | Value -1 indicates the default. | |
658 | ||
659 | Also, popup implementation may choose to ignore this. | |
660 | ||
661 | ||
662 | \membersection{wxComboCtrl::SetPopupMinWidth}\label{wxcomboctrlsetpopupminwidth} | |
663 | ||
664 | \func{void}{SetPopupMinWidth}{\param{int }{width}} | |
665 | ||
666 | Sets minimum width of the popup. If wider than combo control, it will extend to the left. | |
667 | ||
668 | \wxheading{Remarks} | |
669 | ||
670 | Value -1 indicates the default. | |
671 | ||
672 | Also, popup implementation may choose to ignore this. | |
673 | ||
674 | ||
675 | \membersection{wxComboCtrl::SetSelection}\label{wxcomboctrlsetselection} | |
676 | ||
677 | \func{void}{SetSelection}{\param{long }{from}, \param{long }{to}} | |
678 | ||
679 | Selects the text between the two positions, in the combo control text field. | |
680 | ||
681 | \wxheading{Parameters} | |
682 | ||
683 | \docparam{from}{The first position.} | |
684 | ||
685 | \docparam{to}{The second position.} | |
686 | ||
687 | ||
688 | \membersection{wxComboCtrl::SetText}\label{wxcomboctrlsettext} | |
689 | ||
690 | \func{void}{SetText}{\param{const wxString\& }{value}} | |
691 | ||
692 | Sets the text for the text field without affecting the | |
693 | popup. Thus, unlike \helpref{SetValue}{wxcomboctrlsetvalue}, it works | |
694 | equally well with combo control using {\tt wxCB\_READONLY} style. | |
695 | ||
696 | ||
697 | \membersection{wxComboCtrl::SetTextIndent}\label{wxcomboctrlsettextindent} | |
698 | ||
699 | \func{void}{SetTextIndent}{\param{int }{indent}} | |
700 | ||
701 | This will set the space in pixels between left edge of the control and the | |
702 | text, regardless whether control is read-only or not. Value -1 can be | |
703 | given to indicate platform default. | |
704 | ||
705 | ||
706 | \membersection{wxComboCtrl::SetValue}\label{wxcomboctrlsetvalue} | |
707 | ||
708 | \func{void}{SetValue}{\param{const wxString\& }{value}} | |
709 | ||
710 | Sets the text for the combo control text field. | |
711 | ||
712 | {\bf NB:} For a combo control with {\tt wxCB\_READONLY} style the | |
713 | string must be accepted by the popup (for instance, exist in the dropdown | |
714 | list), otherwise the call to SetValue() is ignored | |
715 | ||
716 | ||
df348ff8 RR |
717 | \membersection{wxComboCtrl::SetValueWithEvent}\label{wxcomboctrlsetvaluewithevent} |
718 | ||
719 | \func{void}{SetValueWithEvent}{\param{const wxString\& }{value}, \param{bool }{withEvent = true}} | |
720 | ||
721 | Same as SetValue, but also sends wxCommandEvent of type wxEVT\_COMMAND\_TEXT\_UPDATED | |
722 | if {\tt withEvent} is \true. | |
723 | ||
724 | ||
0dfff674 WS |
725 | \membersection{wxComboCtrl::ShowPopup}\label{wxcomboctrlshowpopup} |
726 | ||
727 | \func{void}{ShowPopup}{\void} | |
728 | ||
729 | Show the popup. | |
730 | ||
731 | ||
732 | \membersection{wxComboCtrl::Undo}\label{wxcomboctrlundo} | |
733 | ||
734 | \func{void}{Undo}{\void} | |
735 | ||
736 | Undoes the last edit in the text field. Windows only. | |
b67a86d5 | 737 | |
06077aaf VZ |
738 | |
739 | \membersection{wxComboCtrl::UseAltPopupWindow}\label{wxcomboctrlusealtpopupwindow} | |
740 | ||
741 | \func{void}{UseAltPopupWindow}{\param{bool }{enable = true}} | |
742 | ||
743 | Enable or disable usage of an alternative popup window, which guarantees | |
744 | ability to focus the popup control, and allows common native controls to | |
745 | function normally. This alternative popup window is usually a wxDialog, | |
746 | and as such, when it is shown, its parent top-level window will appear | |
747 | as if the focus has been lost from it. | |
748 | ||
749 |