]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/gtk/combo.py
fixed wxString iterators linked list corruption
[wxWidgets.git] / wxPython / src / gtk / combo.py
CommitLineData
84bc0d49
RD
1# This file was created automatically by SWIG 1.3.29.
2# Don't modify this file, modify the SWIG interface instead.
3
4"""
d359a380 5ComboCtrl class that can have any type of popup widget, and also an
84bc0d49
RD
6owner-drawn combobox control.
7"""
8
9import _combo
10import new
11new_instancemethod = new.instancemethod
12def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
13 if (name == "thisown"): return self.this.own(value)
14 if (name == "this"):
15 if type(value).__name__ == 'PySwigObject':
16 self.__dict__[name] = value
17 return
18 method = class_type.__swig_setmethods__.get(name,None)
19 if method: return method(self,value)
20 if (not static) or hasattr(self,name):
21 self.__dict__[name] = value
22 else:
23 raise AttributeError("You cannot add attributes to %s" % self)
24
25def _swig_setattr(self,class_type,name,value):
26 return _swig_setattr_nondynamic(self,class_type,name,value,0)
27
28def _swig_getattr(self,class_type,name):
29 if (name == "thisown"): return self.this.own()
30 method = class_type.__swig_getmethods__.get(name,None)
31 if method: return method(self)
32 raise AttributeError,name
33
34def _swig_repr(self):
35 try: strthis = "proxy of " + self.this.__repr__()
36 except: strthis = ""
37 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
38
39import types
40try:
41 _object = types.ObjectType
42 _newclass = 1
43except AttributeError:
44 class _object : pass
45 _newclass = 0
46del types
47
48
49def _swig_setattr_nondynamic_method(set):
50 def set_attr(self,name,value):
51 if (name == "thisown"): return self.this.own(value)
52 if hasattr(self,name) or (name == "this"):
53 set(self,name,value)
54 else:
55 raise AttributeError("You cannot add attributes to %s" % self)
56 return set_attr
57
58
59import _windows
60import _core
61wx = _core
62__docfilter__ = wx.__DocFilter(globals())
63#---------------------------------------------------------------------------
64
65CC_BUTTON_OUTSIDE_BORDER = _combo.CC_BUTTON_OUTSIDE_BORDER
66CC_POPUP_ON_MOUSE_UP = _combo.CC_POPUP_ON_MOUSE_UP
67CC_NO_TEXT_AUTO_SELECT = _combo.CC_NO_TEXT_AUTO_SELECT
cbfc9df6
RD
68CC_BUTTON_STAYS_DOWN = _combo.CC_BUTTON_STAYS_DOWN
69CC_FULL_BUTTON = _combo.CC_FULL_BUTTON
70CC_BUTTON_COVERS_BORDER = _combo.CC_BUTTON_COVERS_BORDER
84bc0d49
RD
71CC_MF_ON_BUTTON = _combo.CC_MF_ON_BUTTON
72CC_MF_ON_CLICK_AREA = _combo.CC_MF_ON_CLICK_AREA
73class ComboCtrlFeatures(object):
eccab1a7
RD
74 """
75 Namespace for `wx.combo.ComboCtrl` feature flags. See
76 `wx.combo.ComboCtrl.GetFeatures`.
77 """
84bc0d49
RD
78 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
79 def __init__(self): raise AttributeError, "No constructor defined"
80 __repr__ = _swig_repr
81 MovableButton = _combo.ComboCtrlFeatures_MovableButton
82 BitmapButton = _combo.ComboCtrlFeatures_BitmapButton
83 ButtonSpacing = _combo.ComboCtrlFeatures_ButtonSpacing
84 TextIndent = _combo.ComboCtrlFeatures_TextIndent
85 PaintControl = _combo.ComboCtrlFeatures_PaintControl
86 PaintWritable = _combo.ComboCtrlFeatures_PaintWritable
87 Borderless = _combo.ComboCtrlFeatures_Borderless
88 All = _combo.ComboCtrlFeatures_All
89_combo.ComboCtrlFeatures_swigregister(ComboCtrlFeatures)
90
91class ComboCtrl(_core.Control):
eccab1a7
RD
92 """
93 A combo control is a generic combobox that allows for a totally custom
94 popup. In addition it has other customization features. For instance,
95 position and size of the dropdown button can be changed.
96
97 To specify what to use for the popup control you need to derive a
98 class from `wx.combo.ComboPopup` and pass it to the ComboCtrl with
99 `SetPopupControl`. It doesn't derive from any widget class so it can
100 be used either as a mixin class combined with some standard or custom
101 widget, or you can use the derived ComboPopup to create and hold an
102 independent reference to the widget to be used for the popup.
103
104 """
84bc0d49
RD
105 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
106 __repr__ = _swig_repr
107 def __init__(self, *args, **kwargs):
108 """
109 __init__(self, Window parent, int id=ID_ANY, String value=wxEmptyString,
110 Point pos=DefaultPosition, Size size=DefaultSize,
111 long style=0, Validator validator=DefaultValidator,
112 String name=wxPyComboBoxNameStr) -> ComboCtrl
113 """
114 _combo.ComboCtrl_swiginit(self,_combo.new_ComboCtrl(*args, **kwargs))
115 self._setOORInfo(self);ComboCtrl._setCallbackInfo(self, self, ComboCtrl)
116
117 def _setCallbackInfo(*args, **kwargs):
118 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
119 return _combo.ComboCtrl__setCallbackInfo(*args, **kwargs)
120
121 def ShowPopup(*args, **kwargs):
eccab1a7
RD
122 """
123 ShowPopup(self)
124
125 Show the popup window.
126 """
84bc0d49
RD
127 return _combo.ComboCtrl_ShowPopup(*args, **kwargs)
128
129 def HidePopup(*args, **kwargs):
eccab1a7
RD
130 """
131 HidePopup(self)
132
133 Dismisses the popup window.
134 """
84bc0d49
RD
135 return _combo.ComboCtrl_HidePopup(*args, **kwargs)
136
137 def OnButtonClick(*args, **kwargs):
eccab1a7
RD
138 """
139 OnButtonClick(self)
140
141 Implement in a derived class to define what happens on dropdown button
142 click. Default action is to show the popup.
143 """
84bc0d49
RD
144 return _combo.ComboCtrl_OnButtonClick(*args, **kwargs)
145
146 def IsPopupShown(*args, **kwargs):
eccab1a7
RD
147 """
148 IsPopupShown(self) -> bool
149
150 Returns true if the popup is currently shown.
151 """
84bc0d49
RD
152 return _combo.ComboCtrl_IsPopupShown(*args, **kwargs)
153
154 def SetPopupControl(*args, **kwargs):
eccab1a7
RD
155 """
156 SetPopupControl(self, ComboPopup popup)
157
158 Set popup interface class derived from `wx.combo.ComboPopup`. This
159 method should be called as soon as possible after the control has been
160 created, unless `OnButtonClick` has been overridden.
161 """
84bc0d49
RD
162 return _combo.ComboCtrl_SetPopupControl(*args, **kwargs)
163
164 def GetPopupControl(*args, **kwargs):
eccab1a7
RD
165 """
166 GetPopupControl(self) -> ComboPopup
167
168 Returns the current popup interface that has been set with
169 `SetPopupControl`.
170 """
84bc0d49
RD
171 return _combo.ComboCtrl_GetPopupControl(*args, **kwargs)
172
173 def GetPopupWindow(*args, **kwargs):
eccab1a7
RD
174 """
175 GetPopupWindow(self) -> Window
176
177 Returns the popup window containing the popup control.
178 """
84bc0d49
RD
179 return _combo.ComboCtrl_GetPopupWindow(*args, **kwargs)
180
181 def GetTextCtrl(*args, **kwargs):
eccab1a7
RD
182 """
183 GetTextCtrl(self) -> wxTextCtrl
184
185 Get the text control which is part of the combo control.
186 """
84bc0d49
RD
187 return _combo.ComboCtrl_GetTextCtrl(*args, **kwargs)
188
189 def GetButton(*args, **kwargs):
eccab1a7
RD
190 """
191 GetButton(self) -> Window
192
193 Get the dropdown button which is part of the combobox. Note: it's not
194 necessarily a wx.Button or wx.BitmapButton.
195 """
84bc0d49
RD
196 return _combo.ComboCtrl_GetButton(*args, **kwargs)
197
198 def GetValue(*args, **kwargs):
eccab1a7
RD
199 """
200 GetValue(self) -> String
201
202 Returns text representation of the current value. For writable combo
203 control it always returns the value in the text field.
204 """
84bc0d49
RD
205 return _combo.ComboCtrl_GetValue(*args, **kwargs)
206
207 def SetValue(*args, **kwargs):
eccab1a7
RD
208 """
209 SetValue(self, String value)
210
211 Sets the text for the combo control text field. For a combo control
212 with wx.CB_READONLY style the string must be accepted by the popup (for
213 instance, exist in the dropdown list), otherwise the call to
214 SetValue is ignored.
215 """
84bc0d49
RD
216 return _combo.ComboCtrl_SetValue(*args, **kwargs)
217
218 def Copy(*args, **kwargs):
219 """Copy(self)"""
220 return _combo.ComboCtrl_Copy(*args, **kwargs)
221
222 def Cut(*args, **kwargs):
223 """Cut(self)"""
224 return _combo.ComboCtrl_Cut(*args, **kwargs)
225
226 def Paste(*args, **kwargs):
227 """Paste(self)"""
228 return _combo.ComboCtrl_Paste(*args, **kwargs)
229
230 def SetInsertionPoint(*args, **kwargs):
231 """SetInsertionPoint(self, long pos)"""
232 return _combo.ComboCtrl_SetInsertionPoint(*args, **kwargs)
233
234 def SetInsertionPointEnd(*args, **kwargs):
235 """SetInsertionPointEnd(self)"""
236 return _combo.ComboCtrl_SetInsertionPointEnd(*args, **kwargs)
237
238 def GetInsertionPoint(*args, **kwargs):
239 """GetInsertionPoint(self) -> long"""
240 return _combo.ComboCtrl_GetInsertionPoint(*args, **kwargs)
241
242 def GetLastPosition(*args, **kwargs):
243 """GetLastPosition(self) -> long"""
244 return _combo.ComboCtrl_GetLastPosition(*args, **kwargs)
245
246 def Replace(*args, **kwargs):
247 """Replace(self, long from, long to, String value)"""
248 return _combo.ComboCtrl_Replace(*args, **kwargs)
249
250 def Remove(*args, **kwargs):
251 """Remove(self, long from, long to)"""
252 return _combo.ComboCtrl_Remove(*args, **kwargs)
253
254 def Undo(*args, **kwargs):
255 """Undo(self)"""
256 return _combo.ComboCtrl_Undo(*args, **kwargs)
257
258 def SetMark(*args, **kwargs):
259 """SetMark(self, long from, long to)"""
260 return _combo.ComboCtrl_SetMark(*args, **kwargs)
261
262 def SetText(*args, **kwargs):
eccab1a7
RD
263 """
264 SetText(self, String value)
265
266 Sets the text for the text field without affecting the popup. Thus,
267 unlike `SetValue`, it works equally well with combo control using
268 wx.CB_READONLY style.
269 """
84bc0d49
RD
270 return _combo.ComboCtrl_SetText(*args, **kwargs)
271
272 def SetValueWithEvent(*args, **kwargs):
eccab1a7
RD
273 """
274 SetValueWithEvent(self, String value, bool withEvent=True)
275
276 Same as `SetValue`, but also sends a EVT_TEXT event if withEvent is true.
277 """
84bc0d49
RD
278 return _combo.ComboCtrl_SetValueWithEvent(*args, **kwargs)
279
280 def SetPopupMinWidth(*args, **kwargs):
eccab1a7
RD
281 """
282 SetPopupMinWidth(self, int width)
283
284 Sets minimum width of the popup. If wider than combo control, it will
285 extend to the left. A value of -1 indicates to use the default. The
286 popup implementation may choose to ignore this.
287 """
84bc0d49
RD
288 return _combo.ComboCtrl_SetPopupMinWidth(*args, **kwargs)
289
290 def SetPopupMaxHeight(*args, **kwargs):
eccab1a7
RD
291 """
292 SetPopupMaxHeight(self, int height)
293
294 Sets preferred maximum height of the popup. A value of -1 indicates to
295 use the default. The popup implementation may choose to ignore this.
296 """
84bc0d49
RD
297 return _combo.ComboCtrl_SetPopupMaxHeight(*args, **kwargs)
298
299 def SetPopupExtents(*args, **kwargs):
eccab1a7
RD
300 """
301 SetPopupExtents(self, int extLeft, int extRight)
302
303 Extends popup size horizontally, relative to the edges of the combo
304 control. Values are given in pixels, and the defaults are zero. It
f27895d2 305 is up to the popup to fully take these values into account.
eccab1a7 306 """
84bc0d49
RD
307 return _combo.ComboCtrl_SetPopupExtents(*args, **kwargs)
308
309 def SetCustomPaintWidth(*args, **kwargs):
eccab1a7
RD
310 """
311 SetCustomPaintWidth(self, int width)
312
313 Set width, in pixels, of custom painted area in control without
314 wx.CB_READONLY style. In read-only OwnerDrawnComboBox, this is used
315 to indicate the area that is not covered by the focus rectangle.
316 """
84bc0d49
RD
317 return _combo.ComboCtrl_SetCustomPaintWidth(*args, **kwargs)
318
319 def GetCustomPaintWidth(*args, **kwargs):
320 """GetCustomPaintWidth(self) -> int"""
321 return _combo.ComboCtrl_GetCustomPaintWidth(*args, **kwargs)
322
323 def SetPopupAnchor(*args, **kwargs):
eccab1a7
RD
324 """
325 SetPopupAnchor(self, int anchorSide)
326
327 Set side of the control to which the popup will align itself. Valid
328 values are wx.LEFT, wx.RIGHT and 0. The default value 0 means that the
329 most appropriate side is used (which, currently, is always wx.LEFT).
330 """
84bc0d49
RD
331 return _combo.ComboCtrl_SetPopupAnchor(*args, **kwargs)
332
333 def SetButtonPosition(*args, **kwargs):
eccab1a7
RD
334 """
335 SetButtonPosition(self, int width=-1, int height=-1, int side=RIGHT, int spacingX=0)
336
337 Set the position of the dropdown button.
338 """
84bc0d49
RD
339 return _combo.ComboCtrl_SetButtonPosition(*args, **kwargs)
340
341 def GetButtonSize(*args, **kwargs):
eccab1a7
RD
342 """
343 GetButtonSize(self) -> Size
344
345 Returns current size of the dropdown button.
346 """
84bc0d49
RD
347 return _combo.ComboCtrl_GetButtonSize(*args, **kwargs)
348
349 def SetButtonBitmaps(*args, **kwargs):
350 """
351 SetButtonBitmaps(self, Bitmap bmpNormal, bool pushButtonBg=False, Bitmap bmpPressed=wxNullBitmap,
352 Bitmap bmpHover=wxNullBitmap,
353 Bitmap bmpDisabled=wxNullBitmap)
eccab1a7
RD
354
355 Sets custom dropdown button graphics.
356
357 :param bmpNormal: Default button image
358 :param pushButtonBg: If ``True``, blank push button background is painted below the image.
359 :param bmpPressed: Depressed butotn image.
360 :param bmpHover: Button imate to use when the mouse hovers over it.
361 :param bmpDisabled: Disabled button image.
362
84bc0d49
RD
363 """
364 return _combo.ComboCtrl_SetButtonBitmaps(*args, **kwargs)
365
366 def SetTextIndent(*args, **kwargs):
eccab1a7
RD
367 """
368 SetTextIndent(self, int indent)
369
370 This will set the space in pixels between left edge of the control and
371 the text, regardless whether control is read-only or not. A value of -1 can
372 be given to indicate platform default.
373 """
84bc0d49
RD
374 return _combo.ComboCtrl_SetTextIndent(*args, **kwargs)
375
376 def GetTextIndent(*args, **kwargs):
eccab1a7
RD
377 """
378 GetTextIndent(self) -> int
379
380 Returns actual indentation in pixels.
381 """
84bc0d49
RD
382 return _combo.ComboCtrl_GetTextIndent(*args, **kwargs)
383
384 def GetTextRect(*args, **kwargs):
eccab1a7
RD
385 """
386 GetTextRect(self) -> Rect
387
388 Returns area covered by the text field (includes everything except
389 borders and the dropdown button).
390 """
84bc0d49
RD
391 return _combo.ComboCtrl_GetTextRect(*args, **kwargs)
392
393 def UseAltPopupWindow(*args, **kwargs):
eccab1a7
RD
394 """
395 UseAltPopupWindow(self, bool enable=True)
396
397 Enable or disable usage of an alternative popup window, which
398 guarantees ability to focus the popup control, and allows common
399 native controls to function normally. This alternative popup window is
400 usually a wxDialog, and as such, when it is shown, its parent
401 top-level window will appear as if the focus has been lost from it.
402 """
84bc0d49
RD
403 return _combo.ComboCtrl_UseAltPopupWindow(*args, **kwargs)
404
405 def EnablePopupAnimation(*args, **kwargs):
eccab1a7
RD
406 """
407 EnablePopupAnimation(self, bool enable=True)
408
409 Enables or disables popup animation, if any, depending on the value of
410 the argument.
411 """
84bc0d49
RD
412 return _combo.ComboCtrl_EnablePopupAnimation(*args, **kwargs)
413
414 def IsKeyPopupToggle(*args, **kwargs):
eccab1a7
RD
415 """
416 IsKeyPopupToggle(self, KeyEvent event) -> bool
417
418 Returns true if given key combination should toggle the popup.
419 """
84bc0d49
RD
420 return _combo.ComboCtrl_IsKeyPopupToggle(*args, **kwargs)
421
422 def PrepareBackground(*args, **kwargs):
eccab1a7
RD
423 """
424 PrepareBackground(self, DC dc, Rect rect, int flags)
425
426 Prepare background of combo control or an item in a dropdown list in a
427 way typical on platform. This includes painting the focus/disabled
428 background and setting the clipping region. Unless you plan to paint
429 your own focus indicator, you should always call this in your
430 wxComboPopup::PaintComboControl implementation. In addition, it sets
431 pen and text colour to what looks good and proper against the
432 background.
433
434 flags are the same as wx.RendererNative flags:
435
436 ====================== ============================================
437 wx.CONTROL_ISSUBMENU drawing a list item instead of combo control
438 wx.CONTROL_SELECTED list item is selected
439 wx.CONTROL_DISABLED control/item is disabled
440 ====================== ============================================
441
442 """
84bc0d49
RD
443 return _combo.ComboCtrl_PrepareBackground(*args, **kwargs)
444
445 def ShouldDrawFocus(*args, **kwargs):
eccab1a7
RD
446 """
447 ShouldDrawFocus(self) -> bool
448
449 Returns true if focus indicator should be drawn in the control.
450 """
84bc0d49
RD
451 return _combo.ComboCtrl_ShouldDrawFocus(*args, **kwargs)
452
453 def GetBitmapNormal(*args, **kwargs):
454 """GetBitmapNormal(self) -> Bitmap"""
455 return _combo.ComboCtrl_GetBitmapNormal(*args, **kwargs)
456
457 def GetBitmapPressed(*args, **kwargs):
458 """GetBitmapPressed(self) -> Bitmap"""
459 return _combo.ComboCtrl_GetBitmapPressed(*args, **kwargs)
460
461 def GetBitmapHover(*args, **kwargs):
462 """GetBitmapHover(self) -> Bitmap"""
463 return _combo.ComboCtrl_GetBitmapHover(*args, **kwargs)
464
465 def GetBitmapDisabled(*args, **kwargs):
466 """GetBitmapDisabled(self) -> Bitmap"""
467 return _combo.ComboCtrl_GetBitmapDisabled(*args, **kwargs)
468
469 def GetInternalFlags(*args, **kwargs):
470 """GetInternalFlags(self) -> unsigned int"""
471 return _combo.ComboCtrl_GetInternalFlags(*args, **kwargs)
472
473 def IsCreated(*args, **kwargs):
eccab1a7
RD
474 """
475 IsCreated(self) -> bool
476
477 Return true if Create has finished
478 """
84bc0d49
RD
479 return _combo.ComboCtrl_IsCreated(*args, **kwargs)
480
481 def OnPopupDismiss(*args, **kwargs):
eccab1a7
RD
482 """
483 OnPopupDismiss(self)
484
485 Common code to be called on popup hide/dismiss
486 """
84bc0d49
RD
487 return _combo.ComboCtrl_OnPopupDismiss(*args, **kwargs)
488
489 Hidden = _combo.ComboCtrl_Hidden
490 Animating = _combo.ComboCtrl_Animating
491 Visible = _combo.ComboCtrl_Visible
492 def IsPopupWindowState(*args, **kwargs):
493 """IsPopupWindowState(self, int state) -> bool"""
494 return _combo.ComboCtrl_IsPopupWindowState(*args, **kwargs)
495
496 def GetPopupWindowState(*args, **kwargs):
497 """GetPopupWindowState(self) -> int"""
498 return _combo.ComboCtrl_GetPopupWindowState(*args, **kwargs)
499
500 def SetCtrlMainWnd(*args, **kwargs):
501 """SetCtrlMainWnd(self, Window wnd)"""
502 return _combo.ComboCtrl_SetCtrlMainWnd(*args, **kwargs)
503
f27895d2
RD
504 def GetMainWindowOfCompositeControl(*args, **kwargs):
505 """GetMainWindowOfCompositeControl(self) -> Window"""
506 return _combo.ComboCtrl_GetMainWindowOfCompositeControl(*args, **kwargs)
507
84bc0d49 508 def GetFeatures(*args, **kwargs):
eccab1a7
RD
509 """
510 GetFeatures() -> int
511
512 Returns a bit-list of flags indicating which features of the ComboCtrl
513 functionality are implemented by this implemetation. See
514 `wx.combo.ComboCtrlFeatures`.
515 """
84bc0d49
RD
516 return _combo.ComboCtrl_GetFeatures(*args, **kwargs)
517
518 GetFeatures = staticmethod(GetFeatures)
519 ShowBelow = _combo.ComboCtrl_ShowBelow
520 ShowAbove = _combo.ComboCtrl_ShowAbove
521 CanDeferShow = _combo.ComboCtrl_CanDeferShow
522 def DoShowPopup(*args, **kwargs):
eccab1a7
RD
523 """
524 DoShowPopup(self, Rect rect, int flags)
525
526 Shows and positions the popup.
527
528 Flags:
529 ============ =====================================================
530 ShowBelow Showing popup below the control
531 ShowAbove Showing popup above the control
532 CanDeferShow Can only return true from AnimateShow if this is set
533 ============ =====================================================
534
535 """
84bc0d49
RD
536 return _combo.ComboCtrl_DoShowPopup(*args, **kwargs)
537
538 def AnimateShow(*args, **kwargs):
eccab1a7
RD
539 """
540 AnimateShow(self, Rect rect, int flags) -> bool
541
542 Implement in derived class to create a drop-down animation. Return
543 ``True`` if finished immediately. Otherwise the popup is only shown when the
544 derived class calls `DoShowPopup`. Flags are same as for `DoShowPopup`.
545
546 """
84bc0d49
RD
547 return _combo.ComboCtrl_AnimateShow(*args, **kwargs)
548
f27895d2
RD
549 PopupControl = property(GetPopupControl,SetPopupControl)
550 PopupWindow = property(GetPopupWindow)
551 TextCtrl = property(GetTextCtrl)
552 Button = property(GetButton)
553 Value = property(GetValue,SetValue)
554 InsertionPoint = property(GetInsertionPoint)
555 CustomPaintWidth = property(GetCustomPaintWidth,SetCustomPaintWidth)
556 ButtonSize = property(GetButtonSize)
557 TextIndent = property(GetTextIndent,SetTextIndent)
558 TextRect = property(GetTextRect)
559 BitmapNormal = property(GetBitmapNormal)
560 BitmapPressed = property(GetBitmapPressed)
561 BitmapHover = property(GetBitmapHover)
562 BitmapDisabled = property(GetBitmapDisabled)
563 PopupWindowState = property(GetPopupWindowState)
84bc0d49
RD
564_combo.ComboCtrl_swigregister(ComboCtrl)
565
566def PreComboCtrl(*args, **kwargs):
567 """PreComboCtrl() -> ComboCtrl"""
568 val = _combo.new_PreComboCtrl(*args, **kwargs)
569 return val
570
571def ComboCtrl_GetFeatures(*args):
eccab1a7
RD
572 """
573 ComboCtrl_GetFeatures() -> int
574
575 Returns a bit-list of flags indicating which features of the ComboCtrl
576 functionality are implemented by this implemetation. See
577 `wx.combo.ComboCtrlFeatures`.
578 """
84bc0d49
RD
579 return _combo.ComboCtrl_GetFeatures(*args)
580
581#---------------------------------------------------------------------------
582
583class ComboPopup(object):
eccab1a7
RD
584 """
585 In order to use a custom popup with `wx.combo.ComboCtrl` an interface
586 class derived from wx.combo.ComboPopup is used to manage the interface
587 between the popup control and the popup. You can either derive a new
588 class from both the widget class and this ComboPopup class, or the
589 derived class can have a reference to the widget used for the popup.
590 In either case you simply need to return the widget from the
591 `GetControl` method to allow the ComboCtrl to interact with it.
592
593 Nearly all of the methods of this class are overridable in Python.
594 """
84bc0d49
RD
595 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
596 __repr__ = _swig_repr
597 def __init__(self, *args, **kwargs):
eccab1a7
RD
598 """
599 __init__(self) -> ComboPopup
600
601 Constructor
602 """
84bc0d49
RD
603 _combo.ComboPopup_swiginit(self,_combo.new_ComboPopup(*args, **kwargs))
604 ComboPopup._setCallbackInfo(self, self, ComboPopup)
605
606 __swig_destroy__ = _combo.delete_ComboPopup
607 __del__ = lambda self : None;
608 def _setCallbackInfo(*args, **kwargs):
609 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
610 return _combo.ComboPopup__setCallbackInfo(*args, **kwargs)
611
612 def Init(*args, **kwargs):
eccab1a7
RD
613 """
614 Init(self)
615
616 This method is called after the popup is contructed and has been
617 assigned to the ComboCtrl. Derived classes can override this to do
618 extra inialization or whatever.
619 """
84bc0d49
RD
620 return _combo.ComboPopup_Init(*args, **kwargs)
621
622 def Create(*args, **kwargs):
eccab1a7
RD
623 """
624 Create(self, Window parent) -> bool
625
626 The derived class must implement this method to create the popup
627 control. It should be a child of the ``parent`` passed in, but other
628 than that there is much flexibility in what the widget can be, its
629 style, etc. Return ``True`` for success, ``False`` otherwise. (NOTE:
630 this return value is not currently checked...)
631 """
84bc0d49
RD
632 return _combo.ComboPopup_Create(*args, **kwargs)
633
634 def GetControl(*args, **kwargs):
eccab1a7
RD
635 """
636 GetControl(self) -> Window
637
638 The derived class must implement this method and it should return a
639 reference to the widget created in the `Create` method. If the
640 derived class inherits from both the widget class and ComboPopup then
641 the return value is probably just ``self``.
642 """
84bc0d49
RD
643 return _combo.ComboPopup_GetControl(*args, **kwargs)
644
645 def OnPopup(*args, **kwargs):
eccab1a7
RD
646 """
647 OnPopup(self)
648
649 The derived class may implement this to do special processing when
650 popup is shown.
651 """
84bc0d49
RD
652 return _combo.ComboPopup_OnPopup(*args, **kwargs)
653
654 def OnDismiss(*args, **kwargs):
eccab1a7
RD
655 """
656 OnDismiss(self)
657
658 The derived class may implement this to do special processing when
659 popup is hidden.
660 """
84bc0d49
RD
661 return _combo.ComboPopup_OnDismiss(*args, **kwargs)
662
663 def SetStringValue(*args, **kwargs):
eccab1a7
RD
664 """
665 SetStringValue(self, String value)
666
667 Called just prior to displaying the popup. The derived class can
668 implement this to "select" the item in the popup that coresponds to
669 the passed in string value, if appropriate. The default
670 implementation does nothing.
671 """
84bc0d49
RD
672 return _combo.ComboPopup_SetStringValue(*args, **kwargs)
673
674 def GetStringValue(*args, **kwargs):
eccab1a7
RD
675 """
676 GetStringValue(self) -> String
677
678 Gets the string representation of the currently selected value to be
679 used to display in the combo widget.
680 """
84bc0d49
RD
681 return _combo.ComboPopup_GetStringValue(*args, **kwargs)
682
683 def PaintComboControl(*args, **kwargs):
eccab1a7
RD
684 """
685 PaintComboControl(self, DC dc, Rect rect)
686
687 This is called to custom paint in the combo control itself (ie. not
688 the popup). Default implementation draws the current value as string.
689 """
84bc0d49
RD
690 return _combo.ComboPopup_PaintComboControl(*args, **kwargs)
691
692 def OnComboKeyEvent(*args, **kwargs):
eccab1a7
RD
693 """
694 OnComboKeyEvent(self, KeyEvent event)
695
696 Receives key events from the parent ComboCtrl. Events not handled
697 should be skipped, as usual.
698 """
84bc0d49
RD
699 return _combo.ComboPopup_OnComboKeyEvent(*args, **kwargs)
700
701 def OnComboDoubleClick(*args, **kwargs):
eccab1a7
RD
702 """
703 OnComboDoubleClick(self)
704
705 Implement this method in the derived class if you need to support
706 special actions when the user double-clicks on the parent ComboCtrl.
707 """
84bc0d49
RD
708 return _combo.ComboPopup_OnComboDoubleClick(*args, **kwargs)
709
710 def GetAdjustedSize(*args, **kwargs):
eccab1a7
RD
711 """
712 GetAdjustedSize(self, int minWidth, int prefHeight, int maxHeight) -> Size
713
714 The derived class may implement this method to return adjusted size
715 for the popup control, according to the variables given. It is called
716 on every popup, just prior to `OnPopup`.
717
718 :param minWidth: Preferred minimum width.
719 :param prefHeight: Preferred height. May be -1 to indicate no preference.
720 :maxWidth: Max height for window, as limited by screen size, and
721 should only be rounded down, if necessary.
722
723 """
84bc0d49
RD
724 return _combo.ComboPopup_GetAdjustedSize(*args, **kwargs)
725
726 def LazyCreate(*args, **kwargs):
eccab1a7
RD
727 """
728 LazyCreate(self) -> bool
729
730 The derived class may implement this to return ``True`` if it wants to
731 delay the call to `Create` until the popup is shown for the first
732 time. It is more efficient, but on the other hand it is often more
733 convenient to have the control created immediately. The default
734 implementation returns ``False``.
735 """
84bc0d49
RD
736 return _combo.ComboPopup_LazyCreate(*args, **kwargs)
737
738 def Dismiss(*args, **kwargs):
eccab1a7
RD
739 """
740 Dismiss(self)
741
742 Hides the popup
743 """
84bc0d49
RD
744 return _combo.ComboPopup_Dismiss(*args, **kwargs)
745
746 def IsCreated(*args, **kwargs):
eccab1a7
RD
747 """
748 IsCreated(self) -> bool
749
750 Returns true if `Create` has been called.
751 """
84bc0d49
RD
752 return _combo.ComboPopup_IsCreated(*args, **kwargs)
753
754 def DefaultPaintComboControl(*args, **kwargs):
eccab1a7
RD
755 """
756 DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
757
758 Default PaintComboControl behaviour
759 """
84bc0d49
RD
760 return _combo.ComboPopup_DefaultPaintComboControl(*args, **kwargs)
761
762 DefaultPaintComboControl = staticmethod(DefaultPaintComboControl)
763 def GetCombo(*args, **kwargs):
eccab1a7
RD
764 """
765 GetCombo(self) -> ComboCtrl
766
767 Returns a reference to the `wx.combo.ComboCtrl` this ComboPopup object
768 is associated with.
769 """
84bc0d49
RD
770 return _combo.ComboPopup_GetCombo(*args, **kwargs)
771
772_combo.ComboPopup_swigregister(ComboPopup)
773
774def ComboPopup_DefaultPaintComboControl(*args, **kwargs):
eccab1a7
RD
775 """
776 ComboPopup_DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
777
778 Default PaintComboControl behaviour
779 """
84bc0d49
RD
780 return _combo.ComboPopup_DefaultPaintComboControl(*args, **kwargs)
781
782#---------------------------------------------------------------------------
783
784ODCB_DCLICK_CYCLES = _combo.ODCB_DCLICK_CYCLES
785ODCB_STD_CONTROL_PAINT = _combo.ODCB_STD_CONTROL_PAINT
786ODCB_PAINTING_CONTROL = _combo.ODCB_PAINTING_CONTROL
787ODCB_PAINTING_SELECTED = _combo.ODCB_PAINTING_SELECTED
788class OwnerDrawnComboBox(ComboCtrl,_core.ItemContainer):
eccab1a7
RD
789 """
790 wx.combo.OwnerDrawnComboBox is a combobox with owner-drawn list
791 items. In essence, it is a `wx.combo.ComboCtrl` with a `wx.VListBox`
792 popup and a `wx.ControlWithItems` API.
793
794 Implementing item drawing and measuring is similar to wx.VListBox.
795 The application needs to subclass wx.combo.OwnerDrawnComboBox and
796 implement the `OnDrawItem`, `OnMeasureItem` and `OnMeasureItemWidth`
797 methods.
798 """
84bc0d49
RD
799 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
800 __repr__ = _swig_repr
801 def __init__(self, *args, **kwargs):
802 """
803 __init__(self, Window parent, int id=-1, String value=EmptyString,
804 Point pos=DefaultPosition, Size size=DefaultSize,
805 wxArrayString choices=wxPyEmptyStringArray,
806 long style=0, Validator validator=DefaultValidator,
807 String name=wxPyComboBoxNameStr) -> OwnerDrawnComboBox
eccab1a7
RD
808
809 Standard constructor.
84bc0d49
RD
810 """
811 _combo.OwnerDrawnComboBox_swiginit(self,_combo.new_OwnerDrawnComboBox(*args, **kwargs))
812 self._setOORInfo(self);OwnerDrawnComboBox._setCallbackInfo(self, self, OwnerDrawnComboBox)
813
eccab1a7
RD
814 def _setCallbackInfo(*args, **kwargs):
815 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
816 return _combo.OwnerDrawnComboBox__setCallbackInfo(*args, **kwargs)
817
84bc0d49
RD
818 def Create(*args, **kwargs):
819 """
820 Create(self, Window parent, int id=-1, String value=EmptyString,
821 Point pos=DefaultPosition, Size size=DefaultSize,
822 wxArrayString choices=wxPyEmptyStringArray,
823 long style=0, Validator validator=DefaultValidator,
824 String name=wxPyComboBoxNameStr) -> bool
eccab1a7
RD
825
826 Create the UI object, and other initialization.
84bc0d49
RD
827 """
828 return _combo.OwnerDrawnComboBox_Create(*args, **kwargs)
829
830 def GetWidestItemWidth(*args, **kwargs):
eccab1a7
RD
831 """
832 GetWidestItemWidth(self) -> int
833
834 Return the widest item width (recalculating it if necessary.)
835 """
84bc0d49
RD
836 return _combo.OwnerDrawnComboBox_GetWidestItemWidth(*args, **kwargs)
837
838 def GetWidestItem(*args, **kwargs):
eccab1a7
RD
839 """
840 GetWidestItem(self) -> int
841
842 Return the index of the widest item (recalculating it if necessary.)
843 """
84bc0d49
RD
844 return _combo.OwnerDrawnComboBox_GetWidestItem(*args, **kwargs)
845
846 def SetMark(*args, **kwargs):
847 """SetMark(self, long from, long to)"""
848 return _combo.OwnerDrawnComboBox_SetMark(*args, **kwargs)
849
eccab1a7
RD
850 def OnDrawItem(*args, **kwargs):
851 """
852 OnDrawItem(self, DC dc, Rect rect, int item, int flags)
853
854 The derived class may implement this function to actually draw the
855 item with the given index on the provided DC. If this method is not
856 overridden, the item text is simply drawn as if the control was a
857 normal combobox.
858
859 :param dc: The device context to use for drawing.
860 :param rect: The bounding rectangle for the item being drawn, the
861 DC's clipping region is set to this rectangle before
862 calling this method.
863 :param item: The index of the item to be drawn.
864
865 :param flags: ``wx.combo.ODCB_PAINTING_CONTROL`` (The Combo control itself
866 is being painted, instead of a list item. The ``item``
867 parameter may be ``wx.NOT_FOUND`` in this case.
868 ``wx.combo.ODCB_PAINTING_SELECTED`` (An item with
869 selection background is being painted. The DC's text colour
870 should already be correct.
871
872 """
873 return _combo.OwnerDrawnComboBox_OnDrawItem(*args, **kwargs)
874
875 def OnMeasureItem(*args, **kwargs):
876 """
877 OnMeasureItem(self, size_t item) -> int
878
879 The derived class may implement this method to return the height of
880 the specified item (in pixels). The default implementation returns
881 text height, as if this control was a normal combobox.
882 """
883 return _combo.OwnerDrawnComboBox_OnMeasureItem(*args, **kwargs)
884
885 def OnMeasureItemWidth(*args, **kwargs):
886 """
887 OnMeasureItemWidth(self, size_t item) -> int
888
889 The derived class may implement this method to return the width of the
890 specified item (in pixels). If -1 is returned, then the item text
891 width is used. The default implementation returns -1.
892 """
893 return _combo.OwnerDrawnComboBox_OnMeasureItemWidth(*args, **kwargs)
894
895 def OnDrawBackground(*args, **kwargs):
896 """
897 OnDrawBackground(self, DC dc, Rect rect, int item, int flags)
898
899 This method is used to draw the items background and, maybe, a border
900 around it.
901
902 The base class version implements a reasonable default behaviour which
903 consists in drawing the selected item with the standard background
904 colour and drawing a border around the item if it is either selected
905 or current. ``flags`` has the sam meaning as with `OnDrawItem`.
906 """
907 return _combo.OwnerDrawnComboBox_OnDrawBackground(*args, **kwargs)
908
84bc0d49
RD
909_combo.OwnerDrawnComboBox_swigregister(OwnerDrawnComboBox)
910
911def PreOwnerDrawnComboBox(*args, **kwargs):
eccab1a7
RD
912 """
913 PreOwnerDrawnComboBox() -> OwnerDrawnComboBox
914
915 2-phase create constructor.
916 """
84bc0d49
RD
917 val = _combo.new_PreOwnerDrawnComboBox(*args, **kwargs)
918 return val
919
f27895d2
RD
920class BitmapComboBox(OwnerDrawnComboBox):
921 """
922 A combobox that displays a bitmap in front of the list items. It
923 currently only allows using bitmaps of one size, and resizes itself so
924 that a bitmap can be shown next to the text field.
925 """
926 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
927 __repr__ = _swig_repr
928 def __init__(self, *args, **kwargs):
929 """
930 __init__(self, Window parent, int id=-1, String value=EmptyString,
931 Point pos=DefaultPosition, Size size=DefaultSize,
932 wxArrayString choices=wxPyEmptyStringArray,
933 long style=0, Validator validator=DefaultValidator,
934 String name=wxBitmapComboBoxNameStr) -> BitmapComboBox
935
936 Standard constructor
937 """
938 _combo.BitmapComboBox_swiginit(self,_combo.new_BitmapComboBox(*args, **kwargs))
939 self._setOORInfo(self);
940
941 def Create(*args, **kwargs):
942 """
943 Create(self, Window parent, int id=-1, String value=EmptyString,
944 Point pos=DefaultPosition, Size size=DefaultSize,
945 wxArrayString choices=wxPyEmptyStringArray,
946 long style=0, Validator validator=DefaultValidator,
947 String name=wxBitmapComboBoxNameStr) -> bool
948
949 Create the UI object, and other initialization.
950 """
951 return _combo.BitmapComboBox_Create(*args, **kwargs)
952
953 def Append(*args, **kwargs):
954 """
955 Append(self, String item, Bitmap bitmap=wxNullBitmap, PyObject clientData=None) -> int
956
957 Adds the item to the control, associating the given data with the item
958 if not None. The return value is the index of the newly added item.
959 """
960 return _combo.BitmapComboBox_Append(*args, **kwargs)
961
962 def GetItemBitmap(*args, **kwargs):
963 """
d359a380 964 GetItemBitmap(self, int n) -> Bitmap
f27895d2
RD
965
966 Returns the image of the item with the given index.
967 """
968 return _combo.BitmapComboBox_GetItemBitmap(*args, **kwargs)
969
970 def Insert(*args, **kwargs):
971 """
d359a380 972 Insert(self, String item, Bitmap bitmap, int pos, PyObject clientData=None) -> int
f27895d2
RD
973
974 Insert an item into the control before the item at the ``pos`` index,
975 optionally associating some data object with the item.
976 """
977 return _combo.BitmapComboBox_Insert(*args, **kwargs)
978
979 def SetItemBitmap(*args, **kwargs):
980 """
d359a380 981 SetItemBitmap(self, int n, Bitmap bitmap)
f27895d2
RD
982
983 Sets the image for the given item.
984 """
985 return _combo.BitmapComboBox_SetItemBitmap(*args, **kwargs)
986
987 def GetBitmapSize(*args, **kwargs):
988 """
989 GetBitmapSize(self) -> Size
990
991 Returns size of the image used in list.
992 """
993 return _combo.BitmapComboBox_GetBitmapSize(*args, **kwargs)
994
995_combo.BitmapComboBox_swigregister(BitmapComboBox)
996
997def PreBitmapComboBox(*args, **kwargs):
998 """
999 PreBitmapComboBox() -> BitmapComboBox
1000
1001 2-phase create constructor.
1002 """
1003 val = _combo.new_PreBitmapComboBox(*args, **kwargs)
1004 return val
1005
84bc0d49
RD
1006
1007