1 # This file was created automatically by SWIG 1.3.29.
2 # Don't modify this file, modify the SWIG interface instead.
5 ComboCtrl class that can have any type of popup widget, and also an
6 owner-drawn combobox control.
11 new_instancemethod
= new
.instancemethod
12 def _swig_setattr_nondynamic(self
,class_type
,name
,value
,static
=1):
13 if (name
== "thisown"): return self
.this
.own(value
)
15 if type(value
).__name
__ == 'PySwigObject':
16 self
.__dict
__[name
] = value
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
23 raise AttributeError("You cannot add attributes to %s" % self
)
25 def _swig_setattr(self
,class_type
,name
,value
):
26 return _swig_setattr_nondynamic(self
,class_type
,name
,value
,0)
28 def _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
35 try: strthis
= "proxy of " + self
.this
.__repr
__()
37 return "<%s.%s; %s >" % (self
.__class
__.__module
__, self
.__class
__.__name
__, strthis
,)
41 _object
= types
.ObjectType
43 except AttributeError:
49 def _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"):
55 raise AttributeError("You cannot add attributes to %s" % self
)
62 __docfilter__
= wx
.__DocFilter
(globals())
63 #---------------------------------------------------------------------------
65 CC_BUTTON_OUTSIDE_BORDER
= _combo
.CC_BUTTON_OUTSIDE_BORDER
66 CC_POPUP_ON_MOUSE_UP
= _combo
.CC_POPUP_ON_MOUSE_UP
67 CC_NO_TEXT_AUTO_SELECT
= _combo
.CC_NO_TEXT_AUTO_SELECT
68 CC_MF_ON_BUTTON
= _combo
.CC_MF_ON_BUTTON
69 CC_MF_ON_CLICK_AREA
= _combo
.CC_MF_ON_CLICK_AREA
70 class ComboCtrlFeatures(object):
72 Namespace for `wx.combo.ComboCtrl` feature flags. See
73 `wx.combo.ComboCtrl.GetFeatures`.
75 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
76 def __init__(self
): raise AttributeError, "No constructor defined"
78 MovableButton
= _combo
.ComboCtrlFeatures_MovableButton
79 BitmapButton
= _combo
.ComboCtrlFeatures_BitmapButton
80 ButtonSpacing
= _combo
.ComboCtrlFeatures_ButtonSpacing
81 TextIndent
= _combo
.ComboCtrlFeatures_TextIndent
82 PaintControl
= _combo
.ComboCtrlFeatures_PaintControl
83 PaintWritable
= _combo
.ComboCtrlFeatures_PaintWritable
84 Borderless
= _combo
.ComboCtrlFeatures_Borderless
85 All
= _combo
.ComboCtrlFeatures_All
86 _combo
.ComboCtrlFeatures_swigregister(ComboCtrlFeatures
)
88 class ComboCtrl(_core
.Control
):
90 A combo control is a generic combobox that allows for a totally custom
91 popup. In addition it has other customization features. For instance,
92 position and size of the dropdown button can be changed.
94 To specify what to use for the popup control you need to derive a
95 class from `wx.combo.ComboPopup` and pass it to the ComboCtrl with
96 `SetPopupControl`. It doesn't derive from any widget class so it can
97 be used either as a mixin class combined with some standard or custom
98 widget, or you can use the derived ComboPopup to create and hold an
99 independent reference to the widget to be used for the popup.
102 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
103 __repr__
= _swig_repr
104 def __init__(self
, *args
, **kwargs
):
106 __init__(self, Window parent, int id=ID_ANY, String value=wxEmptyString,
107 Point pos=DefaultPosition, Size size=DefaultSize,
108 long style=0, Validator validator=DefaultValidator,
109 String name=wxPyComboBoxNameStr) -> ComboCtrl
111 _combo
.ComboCtrl_swiginit(self
,_combo
.new_ComboCtrl(*args
, **kwargs
))
112 self
._setOORInfo
(self
);ComboCtrl
._setCallbackInfo
(self
, self
, ComboCtrl
)
114 def _setCallbackInfo(*args
, **kwargs
):
115 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
116 return _combo
.ComboCtrl__setCallbackInfo(*args
, **kwargs
)
118 def ShowPopup(*args
, **kwargs
):
122 Show the popup window.
124 return _combo
.ComboCtrl_ShowPopup(*args
, **kwargs
)
126 def HidePopup(*args
, **kwargs
):
130 Dismisses the popup window.
132 return _combo
.ComboCtrl_HidePopup(*args
, **kwargs
)
134 def OnButtonClick(*args
, **kwargs
):
138 Implement in a derived class to define what happens on dropdown button
139 click. Default action is to show the popup.
141 return _combo
.ComboCtrl_OnButtonClick(*args
, **kwargs
)
143 def IsPopupShown(*args
, **kwargs
):
145 IsPopupShown(self) -> bool
147 Returns true if the popup is currently shown.
149 return _combo
.ComboCtrl_IsPopupShown(*args
, **kwargs
)
151 def SetPopupControl(*args
, **kwargs
):
153 SetPopupControl(self, ComboPopup popup)
155 Set popup interface class derived from `wx.combo.ComboPopup`. This
156 method should be called as soon as possible after the control has been
157 created, unless `OnButtonClick` has been overridden.
159 return _combo
.ComboCtrl_SetPopupControl(*args
, **kwargs
)
161 def GetPopupControl(*args
, **kwargs
):
163 GetPopupControl(self) -> ComboPopup
165 Returns the current popup interface that has been set with
168 return _combo
.ComboCtrl_GetPopupControl(*args
, **kwargs
)
170 def GetPopupWindow(*args
, **kwargs
):
172 GetPopupWindow(self) -> Window
174 Returns the popup window containing the popup control.
176 return _combo
.ComboCtrl_GetPopupWindow(*args
, **kwargs
)
178 def GetTextCtrl(*args
, **kwargs
):
180 GetTextCtrl(self) -> wxTextCtrl
182 Get the text control which is part of the combo control.
184 return _combo
.ComboCtrl_GetTextCtrl(*args
, **kwargs
)
186 def GetButton(*args
, **kwargs
):
188 GetButton(self) -> Window
190 Get the dropdown button which is part of the combobox. Note: it's not
191 necessarily a wx.Button or wx.BitmapButton.
193 return _combo
.ComboCtrl_GetButton(*args
, **kwargs
)
195 def GetValue(*args
, **kwargs
):
197 GetValue(self) -> String
199 Returns text representation of the current value. For writable combo
200 control it always returns the value in the text field.
202 return _combo
.ComboCtrl_GetValue(*args
, **kwargs
)
204 def SetValue(*args
, **kwargs
):
206 SetValue(self, String value)
208 Sets the text for the combo control text field. For a combo control
209 with wx.CB_READONLY style the string must be accepted by the popup (for
210 instance, exist in the dropdown list), otherwise the call to
213 return _combo
.ComboCtrl_SetValue(*args
, **kwargs
)
215 def Copy(*args
, **kwargs
):
217 return _combo
.ComboCtrl_Copy(*args
, **kwargs
)
219 def Cut(*args
, **kwargs
):
221 return _combo
.ComboCtrl_Cut(*args
, **kwargs
)
223 def Paste(*args
, **kwargs
):
225 return _combo
.ComboCtrl_Paste(*args
, **kwargs
)
227 def SetInsertionPoint(*args
, **kwargs
):
228 """SetInsertionPoint(self, long pos)"""
229 return _combo
.ComboCtrl_SetInsertionPoint(*args
, **kwargs
)
231 def SetInsertionPointEnd(*args
, **kwargs
):
232 """SetInsertionPointEnd(self)"""
233 return _combo
.ComboCtrl_SetInsertionPointEnd(*args
, **kwargs
)
235 def GetInsertionPoint(*args
, **kwargs
):
236 """GetInsertionPoint(self) -> long"""
237 return _combo
.ComboCtrl_GetInsertionPoint(*args
, **kwargs
)
239 def GetLastPosition(*args
, **kwargs
):
240 """GetLastPosition(self) -> long"""
241 return _combo
.ComboCtrl_GetLastPosition(*args
, **kwargs
)
243 def Replace(*args
, **kwargs
):
244 """Replace(self, long from, long to, String value)"""
245 return _combo
.ComboCtrl_Replace(*args
, **kwargs
)
247 def Remove(*args
, **kwargs
):
248 """Remove(self, long from, long to)"""
249 return _combo
.ComboCtrl_Remove(*args
, **kwargs
)
251 def Undo(*args
, **kwargs
):
253 return _combo
.ComboCtrl_Undo(*args
, **kwargs
)
255 def SetMark(*args
, **kwargs
):
256 """SetMark(self, long from, long to)"""
257 return _combo
.ComboCtrl_SetMark(*args
, **kwargs
)
259 def SetText(*args
, **kwargs
):
261 SetText(self, String value)
263 Sets the text for the text field without affecting the popup. Thus,
264 unlike `SetValue`, it works equally well with combo control using
265 wx.CB_READONLY style.
267 return _combo
.ComboCtrl_SetText(*args
, **kwargs
)
269 def SetValueWithEvent(*args
, **kwargs
):
271 SetValueWithEvent(self, String value, bool withEvent=True)
273 Same as `SetValue`, but also sends a EVT_TEXT event if withEvent is true.
275 return _combo
.ComboCtrl_SetValueWithEvent(*args
, **kwargs
)
277 def SetPopupMinWidth(*args
, **kwargs
):
279 SetPopupMinWidth(self, int width)
281 Sets minimum width of the popup. If wider than combo control, it will
282 extend to the left. A value of -1 indicates to use the default. The
283 popup implementation may choose to ignore this.
285 return _combo
.ComboCtrl_SetPopupMinWidth(*args
, **kwargs
)
287 def SetPopupMaxHeight(*args
, **kwargs
):
289 SetPopupMaxHeight(self, int height)
291 Sets preferred maximum height of the popup. A value of -1 indicates to
292 use the default. The popup implementation may choose to ignore this.
294 return _combo
.ComboCtrl_SetPopupMaxHeight(*args
, **kwargs
)
296 def SetPopupExtents(*args
, **kwargs
):
298 SetPopupExtents(self, int extLeft, int extRight)
300 Extends popup size horizontally, relative to the edges of the combo
301 control. Values are given in pixels, and the defaults are zero. It
302 is up to the popup to fully take these values into account.
304 return _combo
.ComboCtrl_SetPopupExtents(*args
, **kwargs
)
306 def SetCustomPaintWidth(*args
, **kwargs
):
308 SetCustomPaintWidth(self, int width)
310 Set width, in pixels, of custom painted area in control without
311 wx.CB_READONLY style. In read-only OwnerDrawnComboBox, this is used
312 to indicate the area that is not covered by the focus rectangle.
314 return _combo
.ComboCtrl_SetCustomPaintWidth(*args
, **kwargs
)
316 def GetCustomPaintWidth(*args
, **kwargs
):
317 """GetCustomPaintWidth(self) -> int"""
318 return _combo
.ComboCtrl_GetCustomPaintWidth(*args
, **kwargs
)
320 def SetPopupAnchor(*args
, **kwargs
):
322 SetPopupAnchor(self, int anchorSide)
324 Set side of the control to which the popup will align itself. Valid
325 values are wx.LEFT, wx.RIGHT and 0. The default value 0 means that the
326 most appropriate side is used (which, currently, is always wx.LEFT).
328 return _combo
.ComboCtrl_SetPopupAnchor(*args
, **kwargs
)
330 def SetButtonPosition(*args
, **kwargs
):
332 SetButtonPosition(self, int width=-1, int height=-1, int side=RIGHT, int spacingX=0)
334 Set the position of the dropdown button.
336 return _combo
.ComboCtrl_SetButtonPosition(*args
, **kwargs
)
338 def GetButtonSize(*args
, **kwargs
):
340 GetButtonSize(self) -> Size
342 Returns current size of the dropdown button.
344 return _combo
.ComboCtrl_GetButtonSize(*args
, **kwargs
)
346 def SetButtonBitmaps(*args
, **kwargs
):
348 SetButtonBitmaps(self, Bitmap bmpNormal, bool pushButtonBg=False, Bitmap bmpPressed=wxNullBitmap,
349 Bitmap bmpHover=wxNullBitmap,
350 Bitmap bmpDisabled=wxNullBitmap)
352 Sets custom dropdown button graphics.
354 :param bmpNormal: Default button image
355 :param pushButtonBg: If ``True``, blank push button background is painted below the image.
356 :param bmpPressed: Depressed butotn image.
357 :param bmpHover: Button imate to use when the mouse hovers over it.
358 :param bmpDisabled: Disabled button image.
361 return _combo
.ComboCtrl_SetButtonBitmaps(*args
, **kwargs
)
363 def SetTextIndent(*args
, **kwargs
):
365 SetTextIndent(self, int indent)
367 This will set the space in pixels between left edge of the control and
368 the text, regardless whether control is read-only or not. A value of -1 can
369 be given to indicate platform default.
371 return _combo
.ComboCtrl_SetTextIndent(*args
, **kwargs
)
373 def GetTextIndent(*args
, **kwargs
):
375 GetTextIndent(self) -> int
377 Returns actual indentation in pixels.
379 return _combo
.ComboCtrl_GetTextIndent(*args
, **kwargs
)
381 def GetTextRect(*args
, **kwargs
):
383 GetTextRect(self) -> Rect
385 Returns area covered by the text field (includes everything except
386 borders and the dropdown button).
388 return _combo
.ComboCtrl_GetTextRect(*args
, **kwargs
)
390 def UseAltPopupWindow(*args
, **kwargs
):
392 UseAltPopupWindow(self, bool enable=True)
394 Enable or disable usage of an alternative popup window, which
395 guarantees ability to focus the popup control, and allows common
396 native controls to function normally. This alternative popup window is
397 usually a wxDialog, and as such, when it is shown, its parent
398 top-level window will appear as if the focus has been lost from it.
400 return _combo
.ComboCtrl_UseAltPopupWindow(*args
, **kwargs
)
402 def EnablePopupAnimation(*args
, **kwargs
):
404 EnablePopupAnimation(self, bool enable=True)
406 Enables or disables popup animation, if any, depending on the value of
409 return _combo
.ComboCtrl_EnablePopupAnimation(*args
, **kwargs
)
411 def IsKeyPopupToggle(*args
, **kwargs
):
413 IsKeyPopupToggle(self, KeyEvent event) -> bool
415 Returns true if given key combination should toggle the popup.
417 return _combo
.ComboCtrl_IsKeyPopupToggle(*args
, **kwargs
)
419 def PrepareBackground(*args
, **kwargs
):
421 PrepareBackground(self, DC dc, Rect rect, int flags)
423 Prepare background of combo control or an item in a dropdown list in a
424 way typical on platform. This includes painting the focus/disabled
425 background and setting the clipping region. Unless you plan to paint
426 your own focus indicator, you should always call this in your
427 wxComboPopup::PaintComboControl implementation. In addition, it sets
428 pen and text colour to what looks good and proper against the
431 flags are the same as wx.RendererNative flags:
433 ====================== ============================================
434 wx.CONTROL_ISSUBMENU drawing a list item instead of combo control
435 wx.CONTROL_SELECTED list item is selected
436 wx.CONTROL_DISABLED control/item is disabled
437 ====================== ============================================
440 return _combo
.ComboCtrl_PrepareBackground(*args
, **kwargs
)
442 def ShouldDrawFocus(*args
, **kwargs
):
444 ShouldDrawFocus(self) -> bool
446 Returns true if focus indicator should be drawn in the control.
448 return _combo
.ComboCtrl_ShouldDrawFocus(*args
, **kwargs
)
450 def GetBitmapNormal(*args
, **kwargs
):
451 """GetBitmapNormal(self) -> Bitmap"""
452 return _combo
.ComboCtrl_GetBitmapNormal(*args
, **kwargs
)
454 def GetBitmapPressed(*args
, **kwargs
):
455 """GetBitmapPressed(self) -> Bitmap"""
456 return _combo
.ComboCtrl_GetBitmapPressed(*args
, **kwargs
)
458 def GetBitmapHover(*args
, **kwargs
):
459 """GetBitmapHover(self) -> Bitmap"""
460 return _combo
.ComboCtrl_GetBitmapHover(*args
, **kwargs
)
462 def GetBitmapDisabled(*args
, **kwargs
):
463 """GetBitmapDisabled(self) -> Bitmap"""
464 return _combo
.ComboCtrl_GetBitmapDisabled(*args
, **kwargs
)
466 def GetInternalFlags(*args
, **kwargs
):
467 """GetInternalFlags(self) -> unsigned int"""
468 return _combo
.ComboCtrl_GetInternalFlags(*args
, **kwargs
)
470 def IsCreated(*args
, **kwargs
):
472 IsCreated(self) -> bool
474 Return true if Create has finished
476 return _combo
.ComboCtrl_IsCreated(*args
, **kwargs
)
478 def OnPopupDismiss(*args
, **kwargs
):
482 Common code to be called on popup hide/dismiss
484 return _combo
.ComboCtrl_OnPopupDismiss(*args
, **kwargs
)
486 Hidden
= _combo
.ComboCtrl_Hidden
487 Animating
= _combo
.ComboCtrl_Animating
488 Visible
= _combo
.ComboCtrl_Visible
489 def IsPopupWindowState(*args
, **kwargs
):
490 """IsPopupWindowState(self, int state) -> bool"""
491 return _combo
.ComboCtrl_IsPopupWindowState(*args
, **kwargs
)
493 def GetPopupWindowState(*args
, **kwargs
):
494 """GetPopupWindowState(self) -> int"""
495 return _combo
.ComboCtrl_GetPopupWindowState(*args
, **kwargs
)
497 def SetCtrlMainWnd(*args
, **kwargs
):
498 """SetCtrlMainWnd(self, Window wnd)"""
499 return _combo
.ComboCtrl_SetCtrlMainWnd(*args
, **kwargs
)
501 def GetMainWindowOfCompositeControl(*args
, **kwargs
):
502 """GetMainWindowOfCompositeControl(self) -> Window"""
503 return _combo
.ComboCtrl_GetMainWindowOfCompositeControl(*args
, **kwargs
)
505 def GetFeatures(*args
, **kwargs
):
509 Returns a bit-list of flags indicating which features of the ComboCtrl
510 functionality are implemented by this implemetation. See
511 `wx.combo.ComboCtrlFeatures`.
513 return _combo
.ComboCtrl_GetFeatures(*args
, **kwargs
)
515 GetFeatures
= staticmethod(GetFeatures
)
516 ShowBelow
= _combo
.ComboCtrl_ShowBelow
517 ShowAbove
= _combo
.ComboCtrl_ShowAbove
518 CanDeferShow
= _combo
.ComboCtrl_CanDeferShow
519 def DoShowPopup(*args
, **kwargs
):
521 DoShowPopup(self, Rect rect, int flags)
523 Shows and positions the popup.
526 ============ =====================================================
527 ShowBelow Showing popup below the control
528 ShowAbove Showing popup above the control
529 CanDeferShow Can only return true from AnimateShow if this is set
530 ============ =====================================================
533 return _combo
.ComboCtrl_DoShowPopup(*args
, **kwargs
)
535 def AnimateShow(*args
, **kwargs
):
537 AnimateShow(self, Rect rect, int flags) -> bool
539 Implement in derived class to create a drop-down animation. Return
540 ``True`` if finished immediately. Otherwise the popup is only shown when the
541 derived class calls `DoShowPopup`. Flags are same as for `DoShowPopup`.
544 return _combo
.ComboCtrl_AnimateShow(*args
, **kwargs
)
546 PopupControl
= property(GetPopupControl
,SetPopupControl
)
547 PopupWindow
= property(GetPopupWindow
)
548 TextCtrl
= property(GetTextCtrl
)
549 Button
= property(GetButton
)
550 Value
= property(GetValue
,SetValue
)
551 InsertionPoint
= property(GetInsertionPoint
)
552 CustomPaintWidth
= property(GetCustomPaintWidth
,SetCustomPaintWidth
)
553 ButtonSize
= property(GetButtonSize
)
554 TextIndent
= property(GetTextIndent
,SetTextIndent
)
555 TextRect
= property(GetTextRect
)
556 BitmapNormal
= property(GetBitmapNormal
)
557 BitmapPressed
= property(GetBitmapPressed
)
558 BitmapHover
= property(GetBitmapHover
)
559 BitmapDisabled
= property(GetBitmapDisabled
)
560 PopupWindowState
= property(GetPopupWindowState
)
561 _combo
.ComboCtrl_swigregister(ComboCtrl
)
563 def PreComboCtrl(*args
, **kwargs
):
564 """PreComboCtrl() -> ComboCtrl"""
565 val
= _combo
.new_PreComboCtrl(*args
, **kwargs
)
568 def ComboCtrl_GetFeatures(*args
):
570 ComboCtrl_GetFeatures() -> int
572 Returns a bit-list of flags indicating which features of the ComboCtrl
573 functionality are implemented by this implemetation. See
574 `wx.combo.ComboCtrlFeatures`.
576 return _combo
.ComboCtrl_GetFeatures(*args
)
578 #---------------------------------------------------------------------------
580 class ComboPopup(object):
582 In order to use a custom popup with `wx.combo.ComboCtrl` an interface
583 class derived from wx.combo.ComboPopup is used to manage the interface
584 between the popup control and the popup. You can either derive a new
585 class from both the widget class and this ComboPopup class, or the
586 derived class can have a reference to the widget used for the popup.
587 In either case you simply need to return the widget from the
588 `GetControl` method to allow the ComboCtrl to interact with it.
590 Nearly all of the methods of this class are overridable in Python.
592 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
593 __repr__
= _swig_repr
594 def __init__(self
, *args
, **kwargs
):
596 __init__(self) -> ComboPopup
600 _combo
.ComboPopup_swiginit(self
,_combo
.new_ComboPopup(*args
, **kwargs
))
601 ComboPopup
._setCallbackInfo
(self
, self
, ComboPopup
)
603 __swig_destroy__
= _combo
.delete_ComboPopup
604 __del__
= lambda self
: None;
605 def _setCallbackInfo(*args
, **kwargs
):
606 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
607 return _combo
.ComboPopup__setCallbackInfo(*args
, **kwargs
)
609 def Init(*args
, **kwargs
):
613 This method is called after the popup is contructed and has been
614 assigned to the ComboCtrl. Derived classes can override this to do
615 extra inialization or whatever.
617 return _combo
.ComboPopup_Init(*args
, **kwargs
)
619 def Create(*args
, **kwargs
):
621 Create(self, Window parent) -> bool
623 The derived class must implement this method to create the popup
624 control. It should be a child of the ``parent`` passed in, but other
625 than that there is much flexibility in what the widget can be, its
626 style, etc. Return ``True`` for success, ``False`` otherwise. (NOTE:
627 this return value is not currently checked...)
629 return _combo
.ComboPopup_Create(*args
, **kwargs
)
631 def GetControl(*args
, **kwargs
):
633 GetControl(self) -> Window
635 The derived class must implement this method and it should return a
636 reference to the widget created in the `Create` method. If the
637 derived class inherits from both the widget class and ComboPopup then
638 the return value is probably just ``self``.
640 return _combo
.ComboPopup_GetControl(*args
, **kwargs
)
642 def OnPopup(*args
, **kwargs
):
646 The derived class may implement this to do special processing when
649 return _combo
.ComboPopup_OnPopup(*args
, **kwargs
)
651 def OnDismiss(*args
, **kwargs
):
655 The derived class may implement this to do special processing when
658 return _combo
.ComboPopup_OnDismiss(*args
, **kwargs
)
660 def SetStringValue(*args
, **kwargs
):
662 SetStringValue(self, String value)
664 Called just prior to displaying the popup. The derived class can
665 implement this to "select" the item in the popup that coresponds to
666 the passed in string value, if appropriate. The default
667 implementation does nothing.
669 return _combo
.ComboPopup_SetStringValue(*args
, **kwargs
)
671 def GetStringValue(*args
, **kwargs
):
673 GetStringValue(self) -> String
675 Gets the string representation of the currently selected value to be
676 used to display in the combo widget.
678 return _combo
.ComboPopup_GetStringValue(*args
, **kwargs
)
680 def PaintComboControl(*args
, **kwargs
):
682 PaintComboControl(self, DC dc, Rect rect)
684 This is called to custom paint in the combo control itself (ie. not
685 the popup). Default implementation draws the current value as string.
687 return _combo
.ComboPopup_PaintComboControl(*args
, **kwargs
)
689 def OnComboKeyEvent(*args
, **kwargs
):
691 OnComboKeyEvent(self, KeyEvent event)
693 Receives key events from the parent ComboCtrl. Events not handled
694 should be skipped, as usual.
696 return _combo
.ComboPopup_OnComboKeyEvent(*args
, **kwargs
)
698 def OnComboDoubleClick(*args
, **kwargs
):
700 OnComboDoubleClick(self)
702 Implement this method in the derived class if you need to support
703 special actions when the user double-clicks on the parent ComboCtrl.
705 return _combo
.ComboPopup_OnComboDoubleClick(*args
, **kwargs
)
707 def GetAdjustedSize(*args
, **kwargs
):
709 GetAdjustedSize(self, int minWidth, int prefHeight, int maxHeight) -> Size
711 The derived class may implement this method to return adjusted size
712 for the popup control, according to the variables given. It is called
713 on every popup, just prior to `OnPopup`.
715 :param minWidth: Preferred minimum width.
716 :param prefHeight: Preferred height. May be -1 to indicate no preference.
717 :maxWidth: Max height for window, as limited by screen size, and
718 should only be rounded down, if necessary.
721 return _combo
.ComboPopup_GetAdjustedSize(*args
, **kwargs
)
723 def LazyCreate(*args
, **kwargs
):
725 LazyCreate(self) -> bool
727 The derived class may implement this to return ``True`` if it wants to
728 delay the call to `Create` until the popup is shown for the first
729 time. It is more efficient, but on the other hand it is often more
730 convenient to have the control created immediately. The default
731 implementation returns ``False``.
733 return _combo
.ComboPopup_LazyCreate(*args
, **kwargs
)
735 def Dismiss(*args
, **kwargs
):
741 return _combo
.ComboPopup_Dismiss(*args
, **kwargs
)
743 def IsCreated(*args
, **kwargs
):
745 IsCreated(self) -> bool
747 Returns true if `Create` has been called.
749 return _combo
.ComboPopup_IsCreated(*args
, **kwargs
)
751 def DefaultPaintComboControl(*args
, **kwargs
):
753 DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
755 Default PaintComboControl behaviour
757 return _combo
.ComboPopup_DefaultPaintComboControl(*args
, **kwargs
)
759 DefaultPaintComboControl
= staticmethod(DefaultPaintComboControl
)
760 def GetCombo(*args
, **kwargs
):
762 GetCombo(self) -> ComboCtrl
764 Returns a reference to the `wx.combo.ComboCtrl` this ComboPopup object
767 return _combo
.ComboPopup_GetCombo(*args
, **kwargs
)
769 _combo
.ComboPopup_swigregister(ComboPopup
)
771 def ComboPopup_DefaultPaintComboControl(*args
, **kwargs
):
773 ComboPopup_DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
775 Default PaintComboControl behaviour
777 return _combo
.ComboPopup_DefaultPaintComboControl(*args
, **kwargs
)
779 #---------------------------------------------------------------------------
781 ODCB_DCLICK_CYCLES
= _combo
.ODCB_DCLICK_CYCLES
782 ODCB_STD_CONTROL_PAINT
= _combo
.ODCB_STD_CONTROL_PAINT
783 ODCB_PAINTING_CONTROL
= _combo
.ODCB_PAINTING_CONTROL
784 ODCB_PAINTING_SELECTED
= _combo
.ODCB_PAINTING_SELECTED
785 class OwnerDrawnComboBox(ComboCtrl
,_core
.ItemContainer
):
787 wx.combo.OwnerDrawnComboBox is a combobox with owner-drawn list
788 items. In essence, it is a `wx.combo.ComboCtrl` with a `wx.VListBox`
789 popup and a `wx.ControlWithItems` API.
791 Implementing item drawing and measuring is similar to wx.VListBox.
792 The application needs to subclass wx.combo.OwnerDrawnComboBox and
793 implement the `OnDrawItem`, `OnMeasureItem` and `OnMeasureItemWidth`
796 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
797 __repr__
= _swig_repr
798 def __init__(self
, *args
, **kwargs
):
800 __init__(self, Window parent, int id=-1, String value=EmptyString,
801 Point pos=DefaultPosition, Size size=DefaultSize,
802 wxArrayString choices=wxPyEmptyStringArray,
803 long style=0, Validator validator=DefaultValidator,
804 String name=wxPyComboBoxNameStr) -> OwnerDrawnComboBox
806 Standard constructor.
808 _combo
.OwnerDrawnComboBox_swiginit(self
,_combo
.new_OwnerDrawnComboBox(*args
, **kwargs
))
809 self
._setOORInfo
(self
);OwnerDrawnComboBox
._setCallbackInfo
(self
, self
, OwnerDrawnComboBox
)
811 def _setCallbackInfo(*args
, **kwargs
):
812 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
813 return _combo
.OwnerDrawnComboBox__setCallbackInfo(*args
, **kwargs
)
815 def Create(*args
, **kwargs
):
817 Create(self, Window parent, int id=-1, String value=EmptyString,
818 Point pos=DefaultPosition, Size size=DefaultSize,
819 wxArrayString choices=wxPyEmptyStringArray,
820 long style=0, Validator validator=DefaultValidator,
821 String name=wxPyComboBoxNameStr) -> bool
823 Create the UI object, and other initialization.
825 return _combo
.OwnerDrawnComboBox_Create(*args
, **kwargs
)
827 def GetWidestItemWidth(*args
, **kwargs
):
829 GetWidestItemWidth(self) -> int
831 Return the widest item width (recalculating it if necessary.)
833 return _combo
.OwnerDrawnComboBox_GetWidestItemWidth(*args
, **kwargs
)
835 def GetWidestItem(*args
, **kwargs
):
837 GetWidestItem(self) -> int
839 Return the index of the widest item (recalculating it if necessary.)
841 return _combo
.OwnerDrawnComboBox_GetWidestItem(*args
, **kwargs
)
843 def SetMark(*args
, **kwargs
):
844 """SetMark(self, long from, long to)"""
845 return _combo
.OwnerDrawnComboBox_SetMark(*args
, **kwargs
)
847 def OnDrawItem(*args
, **kwargs
):
849 OnDrawItem(self, DC dc, Rect rect, int item, int flags)
851 The derived class may implement this function to actually draw the
852 item with the given index on the provided DC. If this method is not
853 overridden, the item text is simply drawn as if the control was a
856 :param dc: The device context to use for drawing.
857 :param rect: The bounding rectangle for the item being drawn, the
858 DC's clipping region is set to this rectangle before
860 :param item: The index of the item to be drawn.
862 :param flags: ``wx.combo.ODCB_PAINTING_CONTROL`` (The Combo control itself
863 is being painted, instead of a list item. The ``item``
864 parameter may be ``wx.NOT_FOUND`` in this case.
865 ``wx.combo.ODCB_PAINTING_SELECTED`` (An item with
866 selection background is being painted. The DC's text colour
867 should already be correct.
870 return _combo
.OwnerDrawnComboBox_OnDrawItem(*args
, **kwargs
)
872 def OnMeasureItem(*args
, **kwargs
):
874 OnMeasureItem(self, size_t item) -> int
876 The derived class may implement this method to return the height of
877 the specified item (in pixels). The default implementation returns
878 text height, as if this control was a normal combobox.
880 return _combo
.OwnerDrawnComboBox_OnMeasureItem(*args
, **kwargs
)
882 def OnMeasureItemWidth(*args
, **kwargs
):
884 OnMeasureItemWidth(self, size_t item) -> int
886 The derived class may implement this method to return the width of the
887 specified item (in pixels). If -1 is returned, then the item text
888 width is used. The default implementation returns -1.
890 return _combo
.OwnerDrawnComboBox_OnMeasureItemWidth(*args
, **kwargs
)
892 def OnDrawBackground(*args
, **kwargs
):
894 OnDrawBackground(self, DC dc, Rect rect, int item, int flags)
896 This method is used to draw the items background and, maybe, a border
899 The base class version implements a reasonable default behaviour which
900 consists in drawing the selected item with the standard background
901 colour and drawing a border around the item if it is either selected
902 or current. ``flags`` has the sam meaning as with `OnDrawItem`.
904 return _combo
.OwnerDrawnComboBox_OnDrawBackground(*args
, **kwargs
)
906 _combo
.OwnerDrawnComboBox_swigregister(OwnerDrawnComboBox
)
908 def PreOwnerDrawnComboBox(*args
, **kwargs
):
910 PreOwnerDrawnComboBox() -> OwnerDrawnComboBox
912 2-phase create constructor.
914 val
= _combo
.new_PreOwnerDrawnComboBox(*args
, **kwargs
)
917 class BitmapComboBox(OwnerDrawnComboBox
):
919 A combobox that displays a bitmap in front of the list items. It
920 currently only allows using bitmaps of one size, and resizes itself so
921 that a bitmap can be shown next to the text field.
923 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
924 __repr__
= _swig_repr
925 def __init__(self
, *args
, **kwargs
):
927 __init__(self, Window parent, int id=-1, String value=EmptyString,
928 Point pos=DefaultPosition, Size size=DefaultSize,
929 wxArrayString choices=wxPyEmptyStringArray,
930 long style=0, Validator validator=DefaultValidator,
931 String name=wxBitmapComboBoxNameStr) -> BitmapComboBox
935 _combo
.BitmapComboBox_swiginit(self
,_combo
.new_BitmapComboBox(*args
, **kwargs
))
936 self
._setOORInfo
(self
);
938 def Create(*args
, **kwargs
):
940 Create(self, Window parent, int id=-1, String value=EmptyString,
941 Point pos=DefaultPosition, Size size=DefaultSize,
942 wxArrayString choices=wxPyEmptyStringArray,
943 long style=0, Validator validator=DefaultValidator,
944 String name=wxBitmapComboBoxNameStr) -> bool
946 Create the UI object, and other initialization.
948 return _combo
.BitmapComboBox_Create(*args
, **kwargs
)
950 def Append(*args
, **kwargs
):
952 Append(self, String item, Bitmap bitmap=wxNullBitmap, PyObject clientData=None) -> int
954 Adds the item to the control, associating the given data with the item
955 if not None. The return value is the index of the newly added item.
957 return _combo
.BitmapComboBox_Append(*args
, **kwargs
)
959 def GetItemBitmap(*args
, **kwargs
):
961 GetItemBitmap(self, int n) -> Bitmap
963 Returns the image of the item with the given index.
965 return _combo
.BitmapComboBox_GetItemBitmap(*args
, **kwargs
)
967 def Insert(*args
, **kwargs
):
969 Insert(self, String item, Bitmap bitmap, int pos, PyObject clientData=None) -> int
971 Insert an item into the control before the item at the ``pos`` index,
972 optionally associating some data object with the item.
974 return _combo
.BitmapComboBox_Insert(*args
, **kwargs
)
976 def SetItemBitmap(*args
, **kwargs
):
978 SetItemBitmap(self, int n, Bitmap bitmap)
980 Sets the image for the given item.
982 return _combo
.BitmapComboBox_SetItemBitmap(*args
, **kwargs
)
984 def GetBitmapSize(*args
, **kwargs
):
986 GetBitmapSize(self) -> Size
988 Returns size of the image used in list.
990 return _combo
.BitmapComboBox_GetBitmapSize(*args
, **kwargs
)
992 _combo
.BitmapComboBox_swigregister(BitmapComboBox
)
994 def PreBitmapComboBox(*args
, **kwargs
):
996 PreBitmapComboBox() -> BitmapComboBox
998 2-phase create constructor.
1000 val
= _combo
.new_PreBitmapComboBox(*args
, **kwargs
)