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 th epopup 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 GetFeatures(*args
, **kwargs
):
505 Returns a bit-list of flags indicating which features of the ComboCtrl
506 functionality are implemented by this implemetation. See
507 `wx.combo.ComboCtrlFeatures`.
509 return _combo
.ComboCtrl_GetFeatures(*args
, **kwargs
)
511 GetFeatures
= staticmethod(GetFeatures
)
512 ShowBelow
= _combo
.ComboCtrl_ShowBelow
513 ShowAbove
= _combo
.ComboCtrl_ShowAbove
514 CanDeferShow
= _combo
.ComboCtrl_CanDeferShow
515 def DoShowPopup(*args
, **kwargs
):
517 DoShowPopup(self, Rect rect, int flags)
519 Shows and positions the popup.
522 ============ =====================================================
523 ShowBelow Showing popup below the control
524 ShowAbove Showing popup above the control
525 CanDeferShow Can only return true from AnimateShow if this is set
526 ============ =====================================================
529 return _combo
.ComboCtrl_DoShowPopup(*args
, **kwargs
)
531 def AnimateShow(*args
, **kwargs
):
533 AnimateShow(self, Rect rect, int flags) -> bool
535 Implement in derived class to create a drop-down animation. Return
536 ``True`` if finished immediately. Otherwise the popup is only shown when the
537 derived class calls `DoShowPopup`. Flags are same as for `DoShowPopup`.
540 return _combo
.ComboCtrl_AnimateShow(*args
, **kwargs
)
542 _combo
.ComboCtrl_swigregister(ComboCtrl
)
544 def PreComboCtrl(*args
, **kwargs
):
545 """PreComboCtrl() -> ComboCtrl"""
546 val
= _combo
.new_PreComboCtrl(*args
, **kwargs
)
549 def ComboCtrl_GetFeatures(*args
):
551 ComboCtrl_GetFeatures() -> int
553 Returns a bit-list of flags indicating which features of the ComboCtrl
554 functionality are implemented by this implemetation. See
555 `wx.combo.ComboCtrlFeatures`.
557 return _combo
.ComboCtrl_GetFeatures(*args
)
559 #---------------------------------------------------------------------------
561 class ComboPopup(object):
563 In order to use a custom popup with `wx.combo.ComboCtrl` an interface
564 class derived from wx.combo.ComboPopup is used to manage the interface
565 between the popup control and the popup. You can either derive a new
566 class from both the widget class and this ComboPopup class, or the
567 derived class can have a reference to the widget used for the popup.
568 In either case you simply need to return the widget from the
569 `GetControl` method to allow the ComboCtrl to interact with it.
571 Nearly all of the methods of this class are overridable in Python.
573 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
574 __repr__
= _swig_repr
575 def __init__(self
, *args
, **kwargs
):
577 __init__(self) -> ComboPopup
581 _combo
.ComboPopup_swiginit(self
,_combo
.new_ComboPopup(*args
, **kwargs
))
582 ComboPopup
._setCallbackInfo
(self
, self
, ComboPopup
)
584 __swig_destroy__
= _combo
.delete_ComboPopup
585 __del__
= lambda self
: None;
586 def _setCallbackInfo(*args
, **kwargs
):
587 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
588 return _combo
.ComboPopup__setCallbackInfo(*args
, **kwargs
)
590 def Init(*args
, **kwargs
):
594 This method is called after the popup is contructed and has been
595 assigned to the ComboCtrl. Derived classes can override this to do
596 extra inialization or whatever.
598 return _combo
.ComboPopup_Init(*args
, **kwargs
)
600 def Create(*args
, **kwargs
):
602 Create(self, Window parent) -> bool
604 The derived class must implement this method to create the popup
605 control. It should be a child of the ``parent`` passed in, but other
606 than that there is much flexibility in what the widget can be, its
607 style, etc. Return ``True`` for success, ``False`` otherwise. (NOTE:
608 this return value is not currently checked...)
610 return _combo
.ComboPopup_Create(*args
, **kwargs
)
612 def GetControl(*args
, **kwargs
):
614 GetControl(self) -> Window
616 The derived class must implement this method and it should return a
617 reference to the widget created in the `Create` method. If the
618 derived class inherits from both the widget class and ComboPopup then
619 the return value is probably just ``self``.
621 return _combo
.ComboPopup_GetControl(*args
, **kwargs
)
623 def OnPopup(*args
, **kwargs
):
627 The derived class may implement this to do special processing when
630 return _combo
.ComboPopup_OnPopup(*args
, **kwargs
)
632 def OnDismiss(*args
, **kwargs
):
636 The derived class may implement this to do special processing when
639 return _combo
.ComboPopup_OnDismiss(*args
, **kwargs
)
641 def SetStringValue(*args
, **kwargs
):
643 SetStringValue(self, String value)
645 Called just prior to displaying the popup. The derived class can
646 implement this to "select" the item in the popup that coresponds to
647 the passed in string value, if appropriate. The default
648 implementation does nothing.
650 return _combo
.ComboPopup_SetStringValue(*args
, **kwargs
)
652 def GetStringValue(*args
, **kwargs
):
654 GetStringValue(self) -> String
656 Gets the string representation of the currently selected value to be
657 used to display in the combo widget.
659 return _combo
.ComboPopup_GetStringValue(*args
, **kwargs
)
661 def PaintComboControl(*args
, **kwargs
):
663 PaintComboControl(self, DC dc, Rect rect)
665 This is called to custom paint in the combo control itself (ie. not
666 the popup). Default implementation draws the current value as string.
668 return _combo
.ComboPopup_PaintComboControl(*args
, **kwargs
)
670 def OnComboKeyEvent(*args
, **kwargs
):
672 OnComboKeyEvent(self, KeyEvent event)
674 Receives key events from the parent ComboCtrl. Events not handled
675 should be skipped, as usual.
677 return _combo
.ComboPopup_OnComboKeyEvent(*args
, **kwargs
)
679 def OnComboDoubleClick(*args
, **kwargs
):
681 OnComboDoubleClick(self)
683 Implement this method in the derived class if you need to support
684 special actions when the user double-clicks on the parent ComboCtrl.
686 return _combo
.ComboPopup_OnComboDoubleClick(*args
, **kwargs
)
688 def GetAdjustedSize(*args
, **kwargs
):
690 GetAdjustedSize(self, int minWidth, int prefHeight, int maxHeight) -> Size
692 The derived class may implement this method to return adjusted size
693 for the popup control, according to the variables given. It is called
694 on every popup, just prior to `OnPopup`.
696 :param minWidth: Preferred minimum width.
697 :param prefHeight: Preferred height. May be -1 to indicate no preference.
698 :maxWidth: Max height for window, as limited by screen size, and
699 should only be rounded down, if necessary.
702 return _combo
.ComboPopup_GetAdjustedSize(*args
, **kwargs
)
704 def LazyCreate(*args
, **kwargs
):
706 LazyCreate(self) -> bool
708 The derived class may implement this to return ``True`` if it wants to
709 delay the call to `Create` until the popup is shown for the first
710 time. It is more efficient, but on the other hand it is often more
711 convenient to have the control created immediately. The default
712 implementation returns ``False``.
714 return _combo
.ComboPopup_LazyCreate(*args
, **kwargs
)
716 def Dismiss(*args
, **kwargs
):
722 return _combo
.ComboPopup_Dismiss(*args
, **kwargs
)
724 def IsCreated(*args
, **kwargs
):
726 IsCreated(self) -> bool
728 Returns true if `Create` has been called.
730 return _combo
.ComboPopup_IsCreated(*args
, **kwargs
)
732 def DefaultPaintComboControl(*args
, **kwargs
):
734 DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
736 Default PaintComboControl behaviour
738 return _combo
.ComboPopup_DefaultPaintComboControl(*args
, **kwargs
)
740 DefaultPaintComboControl
= staticmethod(DefaultPaintComboControl
)
741 def GetCombo(*args
, **kwargs
):
743 GetCombo(self) -> ComboCtrl
745 Returns a reference to the `wx.combo.ComboCtrl` this ComboPopup object
748 return _combo
.ComboPopup_GetCombo(*args
, **kwargs
)
750 _combo
.ComboPopup_swigregister(ComboPopup
)
752 def ComboPopup_DefaultPaintComboControl(*args
, **kwargs
):
754 ComboPopup_DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
756 Default PaintComboControl behaviour
758 return _combo
.ComboPopup_DefaultPaintComboControl(*args
, **kwargs
)
760 #---------------------------------------------------------------------------
762 ODCB_DCLICK_CYCLES
= _combo
.ODCB_DCLICK_CYCLES
763 ODCB_STD_CONTROL_PAINT
= _combo
.ODCB_STD_CONTROL_PAINT
764 ODCB_PAINTING_CONTROL
= _combo
.ODCB_PAINTING_CONTROL
765 ODCB_PAINTING_SELECTED
= _combo
.ODCB_PAINTING_SELECTED
766 class OwnerDrawnComboBox(ComboCtrl
,_core
.ItemContainer
):
768 wx.combo.OwnerDrawnComboBox is a combobox with owner-drawn list
769 items. In essence, it is a `wx.combo.ComboCtrl` with a `wx.VListBox`
770 popup and a `wx.ControlWithItems` API.
772 Implementing item drawing and measuring is similar to wx.VListBox.
773 The application needs to subclass wx.combo.OwnerDrawnComboBox and
774 implement the `OnDrawItem`, `OnMeasureItem` and `OnMeasureItemWidth`
777 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
778 __repr__
= _swig_repr
779 def __init__(self
, *args
, **kwargs
):
781 __init__(self, Window parent, int id=-1, String value=EmptyString,
782 Point pos=DefaultPosition, Size size=DefaultSize,
783 wxArrayString choices=wxPyEmptyStringArray,
784 long style=0, Validator validator=DefaultValidator,
785 String name=wxPyComboBoxNameStr) -> OwnerDrawnComboBox
787 Standard constructor.
789 _combo
.OwnerDrawnComboBox_swiginit(self
,_combo
.new_OwnerDrawnComboBox(*args
, **kwargs
))
790 self
._setOORInfo
(self
);OwnerDrawnComboBox
._setCallbackInfo
(self
, self
, OwnerDrawnComboBox
)
792 def _setCallbackInfo(*args
, **kwargs
):
793 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
794 return _combo
.OwnerDrawnComboBox__setCallbackInfo(*args
, **kwargs
)
796 def Create(*args
, **kwargs
):
798 Create(self, Window parent, int id=-1, String value=EmptyString,
799 Point pos=DefaultPosition, Size size=DefaultSize,
800 wxArrayString choices=wxPyEmptyStringArray,
801 long style=0, Validator validator=DefaultValidator,
802 String name=wxPyComboBoxNameStr) -> bool
804 Create the UI object, and other initialization.
806 return _combo
.OwnerDrawnComboBox_Create(*args
, **kwargs
)
808 def GetWidestItemWidth(*args
, **kwargs
):
810 GetWidestItemWidth(self) -> int
812 Return the widest item width (recalculating it if necessary.)
814 return _combo
.OwnerDrawnComboBox_GetWidestItemWidth(*args
, **kwargs
)
816 def GetWidestItem(*args
, **kwargs
):
818 GetWidestItem(self) -> int
820 Return the index of the widest item (recalculating it if necessary.)
822 return _combo
.OwnerDrawnComboBox_GetWidestItem(*args
, **kwargs
)
824 def SetMark(*args
, **kwargs
):
825 """SetMark(self, long from, long to)"""
826 return _combo
.OwnerDrawnComboBox_SetMark(*args
, **kwargs
)
828 def OnDrawItem(*args
, **kwargs
):
830 OnDrawItem(self, DC dc, Rect rect, int item, int flags)
832 The derived class may implement this function to actually draw the
833 item with the given index on the provided DC. If this method is not
834 overridden, the item text is simply drawn as if the control was a
837 :param dc: The device context to use for drawing.
838 :param rect: The bounding rectangle for the item being drawn, the
839 DC's clipping region is set to this rectangle before
841 :param item: The index of the item to be drawn.
843 :param flags: ``wx.combo.ODCB_PAINTING_CONTROL`` (The Combo control itself
844 is being painted, instead of a list item. The ``item``
845 parameter may be ``wx.NOT_FOUND`` in this case.
846 ``wx.combo.ODCB_PAINTING_SELECTED`` (An item with
847 selection background is being painted. The DC's text colour
848 should already be correct.
851 return _combo
.OwnerDrawnComboBox_OnDrawItem(*args
, **kwargs
)
853 def OnMeasureItem(*args
, **kwargs
):
855 OnMeasureItem(self, size_t item) -> int
857 The derived class may implement this method to return the height of
858 the specified item (in pixels). The default implementation returns
859 text height, as if this control was a normal combobox.
861 return _combo
.OwnerDrawnComboBox_OnMeasureItem(*args
, **kwargs
)
863 def OnMeasureItemWidth(*args
, **kwargs
):
865 OnMeasureItemWidth(self, size_t item) -> int
867 The derived class may implement this method to return the width of the
868 specified item (in pixels). If -1 is returned, then the item text
869 width is used. The default implementation returns -1.
871 return _combo
.OwnerDrawnComboBox_OnMeasureItemWidth(*args
, **kwargs
)
873 def OnDrawBackground(*args
, **kwargs
):
875 OnDrawBackground(self, DC dc, Rect rect, int item, int flags)
877 This method is used to draw the items background and, maybe, a border
880 The base class version implements a reasonable default behaviour which
881 consists in drawing the selected item with the standard background
882 colour and drawing a border around the item if it is either selected
883 or current. ``flags`` has the sam meaning as with `OnDrawItem`.
885 return _combo
.OwnerDrawnComboBox_OnDrawBackground(*args
, **kwargs
)
887 _combo
.OwnerDrawnComboBox_swigregister(OwnerDrawnComboBox
)
889 def PreOwnerDrawnComboBox(*args
, **kwargs
):
891 PreOwnerDrawnComboBox() -> OwnerDrawnComboBox
893 2-phase create constructor.
895 val
= _combo
.new_PreOwnerDrawnComboBox(*args
, **kwargs
)