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_BUTTON_STAYS_DOWN
= _combo
.CC_BUTTON_STAYS_DOWN
69 CC_FULL_BUTTON
= _combo
.CC_FULL_BUTTON
70 CC_BUTTON_COVERS_BORDER
= _combo
.CC_BUTTON_COVERS_BORDER
71 CC_MF_ON_BUTTON
= _combo
.CC_MF_ON_BUTTON
72 CC_MF_ON_CLICK_AREA
= _combo
.CC_MF_ON_CLICK_AREA
73 class ComboCtrlFeatures(object):
75 Namespace for `wx.combo.ComboCtrl` feature flags. See
76 `wx.combo.ComboCtrl.GetFeatures`.
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"
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
)
91 class ComboCtrl(_core
.Control
):
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.
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.
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
):
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
114 _combo
.ComboCtrl_swiginit(self
,_combo
.new_ComboCtrl(*args
, **kwargs
))
115 self
._setOORInfo
(self
);ComboCtrl
._setCallbackInfo
(self
, self
, ComboCtrl
)
117 def _setCallbackInfo(*args
, **kwargs
):
118 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
119 return _combo
.ComboCtrl__setCallbackInfo(*args
, **kwargs
)
121 def ShowPopup(*args
, **kwargs
):
125 Show the popup window.
127 return _combo
.ComboCtrl_ShowPopup(*args
, **kwargs
)
129 def HidePopup(*args
, **kwargs
):
133 Dismisses the popup window.
135 return _combo
.ComboCtrl_HidePopup(*args
, **kwargs
)
137 def OnButtonClick(*args
, **kwargs
):
141 Implement in a derived class to define what happens on dropdown button
142 click. Default action is to show the popup.
144 return _combo
.ComboCtrl_OnButtonClick(*args
, **kwargs
)
146 def IsPopupShown(*args
, **kwargs
):
148 IsPopupShown(self) -> bool
150 Returns true if the popup is currently shown.
152 return _combo
.ComboCtrl_IsPopupShown(*args
, **kwargs
)
154 def SetPopupControl(*args
, **kwargs
):
156 SetPopupControl(self, ComboPopup popup)
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.
162 return _combo
.ComboCtrl_SetPopupControl(*args
, **kwargs
)
164 def GetPopupControl(*args
, **kwargs
):
166 GetPopupControl(self) -> ComboPopup
168 Returns the current popup interface that has been set with
171 return _combo
.ComboCtrl_GetPopupControl(*args
, **kwargs
)
173 def GetPopupWindow(*args
, **kwargs
):
175 GetPopupWindow(self) -> Window
177 Returns the popup window containing the popup control.
179 return _combo
.ComboCtrl_GetPopupWindow(*args
, **kwargs
)
181 def GetTextCtrl(*args
, **kwargs
):
183 GetTextCtrl(self) -> wxTextCtrl
185 Get the text control which is part of the combo control.
187 return _combo
.ComboCtrl_GetTextCtrl(*args
, **kwargs
)
189 def GetButton(*args
, **kwargs
):
191 GetButton(self) -> Window
193 Get the dropdown button which is part of the combobox. Note: it's not
194 necessarily a wx.Button or wx.BitmapButton.
196 return _combo
.ComboCtrl_GetButton(*args
, **kwargs
)
198 def GetValue(*args
, **kwargs
):
200 GetValue(self) -> String
202 Returns text representation of the current value. For writable combo
203 control it always returns the value in the text field.
205 return _combo
.ComboCtrl_GetValue(*args
, **kwargs
)
207 def SetValue(*args
, **kwargs
):
209 SetValue(self, String value)
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
216 return _combo
.ComboCtrl_SetValue(*args
, **kwargs
)
218 def Copy(*args
, **kwargs
):
220 return _combo
.ComboCtrl_Copy(*args
, **kwargs
)
222 def Cut(*args
, **kwargs
):
224 return _combo
.ComboCtrl_Cut(*args
, **kwargs
)
226 def Paste(*args
, **kwargs
):
228 return _combo
.ComboCtrl_Paste(*args
, **kwargs
)
230 def SetInsertionPoint(*args
, **kwargs
):
231 """SetInsertionPoint(self, long pos)"""
232 return _combo
.ComboCtrl_SetInsertionPoint(*args
, **kwargs
)
234 def SetInsertionPointEnd(*args
, **kwargs
):
235 """SetInsertionPointEnd(self)"""
236 return _combo
.ComboCtrl_SetInsertionPointEnd(*args
, **kwargs
)
238 def GetInsertionPoint(*args
, **kwargs
):
239 """GetInsertionPoint(self) -> long"""
240 return _combo
.ComboCtrl_GetInsertionPoint(*args
, **kwargs
)
242 def GetLastPosition(*args
, **kwargs
):
243 """GetLastPosition(self) -> long"""
244 return _combo
.ComboCtrl_GetLastPosition(*args
, **kwargs
)
246 def Replace(*args
, **kwargs
):
247 """Replace(self, long from, long to, String value)"""
248 return _combo
.ComboCtrl_Replace(*args
, **kwargs
)
250 def Remove(*args
, **kwargs
):
251 """Remove(self, long from, long to)"""
252 return _combo
.ComboCtrl_Remove(*args
, **kwargs
)
254 def Undo(*args
, **kwargs
):
256 return _combo
.ComboCtrl_Undo(*args
, **kwargs
)
258 def SetMark(*args
, **kwargs
):
259 """SetMark(self, long from, long to)"""
260 return _combo
.ComboCtrl_SetMark(*args
, **kwargs
)
262 def SetText(*args
, **kwargs
):
264 SetText(self, String value)
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.
270 return _combo
.ComboCtrl_SetText(*args
, **kwargs
)
272 def SetValueWithEvent(*args
, **kwargs
):
274 SetValueWithEvent(self, String value, bool withEvent=True)
276 Same as `SetValue`, but also sends a EVT_TEXT event if withEvent is true.
278 return _combo
.ComboCtrl_SetValueWithEvent(*args
, **kwargs
)
280 def SetPopupMinWidth(*args
, **kwargs
):
282 SetPopupMinWidth(self, int width)
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.
288 return _combo
.ComboCtrl_SetPopupMinWidth(*args
, **kwargs
)
290 def SetPopupMaxHeight(*args
, **kwargs
):
292 SetPopupMaxHeight(self, int height)
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.
297 return _combo
.ComboCtrl_SetPopupMaxHeight(*args
, **kwargs
)
299 def SetPopupExtents(*args
, **kwargs
):
301 SetPopupExtents(self, int extLeft, int extRight)
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
305 is up to the popup to fully take these values into account.
307 return _combo
.ComboCtrl_SetPopupExtents(*args
, **kwargs
)
309 def SetCustomPaintWidth(*args
, **kwargs
):
311 SetCustomPaintWidth(self, int width)
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.
317 return _combo
.ComboCtrl_SetCustomPaintWidth(*args
, **kwargs
)
319 def GetCustomPaintWidth(*args
, **kwargs
):
320 """GetCustomPaintWidth(self) -> int"""
321 return _combo
.ComboCtrl_GetCustomPaintWidth(*args
, **kwargs
)
323 def SetPopupAnchor(*args
, **kwargs
):
325 SetPopupAnchor(self, int anchorSide)
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).
331 return _combo
.ComboCtrl_SetPopupAnchor(*args
, **kwargs
)
333 def SetButtonPosition(*args
, **kwargs
):
335 SetButtonPosition(self, int width=-1, int height=-1, int side=RIGHT, int spacingX=0)
337 Set the position of the dropdown button.
339 return _combo
.ComboCtrl_SetButtonPosition(*args
, **kwargs
)
341 def GetButtonSize(*args
, **kwargs
):
343 GetButtonSize(self) -> Size
345 Returns current size of the dropdown button.
347 return _combo
.ComboCtrl_GetButtonSize(*args
, **kwargs
)
349 def SetButtonBitmaps(*args
, **kwargs
):
351 SetButtonBitmaps(self, Bitmap bmpNormal, bool pushButtonBg=False, Bitmap bmpPressed=wxNullBitmap,
352 Bitmap bmpHover=wxNullBitmap,
353 Bitmap bmpDisabled=wxNullBitmap)
355 Sets custom dropdown button graphics.
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.
364 return _combo
.ComboCtrl_SetButtonBitmaps(*args
, **kwargs
)
366 def SetTextIndent(*args
, **kwargs
):
368 SetTextIndent(self, int indent)
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.
374 return _combo
.ComboCtrl_SetTextIndent(*args
, **kwargs
)
376 def GetTextIndent(*args
, **kwargs
):
378 GetTextIndent(self) -> int
380 Returns actual indentation in pixels.
382 return _combo
.ComboCtrl_GetTextIndent(*args
, **kwargs
)
384 def GetTextRect(*args
, **kwargs
):
386 GetTextRect(self) -> Rect
388 Returns area covered by the text field (includes everything except
389 borders and the dropdown button).
391 return _combo
.ComboCtrl_GetTextRect(*args
, **kwargs
)
393 def UseAltPopupWindow(*args
, **kwargs
):
395 UseAltPopupWindow(self, bool enable=True)
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.
403 return _combo
.ComboCtrl_UseAltPopupWindow(*args
, **kwargs
)
405 def EnablePopupAnimation(*args
, **kwargs
):
407 EnablePopupAnimation(self, bool enable=True)
409 Enables or disables popup animation, if any, depending on the value of
412 return _combo
.ComboCtrl_EnablePopupAnimation(*args
, **kwargs
)
414 def IsKeyPopupToggle(*args
, **kwargs
):
416 IsKeyPopupToggle(self, KeyEvent event) -> bool
418 Returns true if given key combination should toggle the popup.
420 return _combo
.ComboCtrl_IsKeyPopupToggle(*args
, **kwargs
)
422 def PrepareBackground(*args
, **kwargs
):
424 PrepareBackground(self, DC dc, Rect rect, int flags)
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
434 flags are the same as wx.RendererNative flags:
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 ====================== ============================================
443 return _combo
.ComboCtrl_PrepareBackground(*args
, **kwargs
)
445 def ShouldDrawFocus(*args
, **kwargs
):
447 ShouldDrawFocus(self) -> bool
449 Returns true if focus indicator should be drawn in the control.
451 return _combo
.ComboCtrl_ShouldDrawFocus(*args
, **kwargs
)
453 def GetBitmapNormal(*args
, **kwargs
):
454 """GetBitmapNormal(self) -> Bitmap"""
455 return _combo
.ComboCtrl_GetBitmapNormal(*args
, **kwargs
)
457 def GetBitmapPressed(*args
, **kwargs
):
458 """GetBitmapPressed(self) -> Bitmap"""
459 return _combo
.ComboCtrl_GetBitmapPressed(*args
, **kwargs
)
461 def GetBitmapHover(*args
, **kwargs
):
462 """GetBitmapHover(self) -> Bitmap"""
463 return _combo
.ComboCtrl_GetBitmapHover(*args
, **kwargs
)
465 def GetBitmapDisabled(*args
, **kwargs
):
466 """GetBitmapDisabled(self) -> Bitmap"""
467 return _combo
.ComboCtrl_GetBitmapDisabled(*args
, **kwargs
)
469 def GetInternalFlags(*args
, **kwargs
):
470 """GetInternalFlags(self) -> unsigned int"""
471 return _combo
.ComboCtrl_GetInternalFlags(*args
, **kwargs
)
473 def IsCreated(*args
, **kwargs
):
475 IsCreated(self) -> bool
477 Return true if Create has finished
479 return _combo
.ComboCtrl_IsCreated(*args
, **kwargs
)
481 def OnPopupDismiss(*args
, **kwargs
):
485 Common code to be called on popup hide/dismiss
487 return _combo
.ComboCtrl_OnPopupDismiss(*args
, **kwargs
)
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
)
496 def GetPopupWindowState(*args
, **kwargs
):
497 """GetPopupWindowState(self) -> int"""
498 return _combo
.ComboCtrl_GetPopupWindowState(*args
, **kwargs
)
500 def SetCtrlMainWnd(*args
, **kwargs
):
501 """SetCtrlMainWnd(self, Window wnd)"""
502 return _combo
.ComboCtrl_SetCtrlMainWnd(*args
, **kwargs
)
504 def GetMainWindowOfCompositeControl(*args
, **kwargs
):
505 """GetMainWindowOfCompositeControl(self) -> Window"""
506 return _combo
.ComboCtrl_GetMainWindowOfCompositeControl(*args
, **kwargs
)
508 def GetFeatures(*args
, **kwargs
):
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`.
516 return _combo
.ComboCtrl_GetFeatures(*args
, **kwargs
)
518 GetFeatures
= staticmethod(GetFeatures
)
519 ShowBelow
= _combo
.ComboCtrl_ShowBelow
520 ShowAbove
= _combo
.ComboCtrl_ShowAbove
521 CanDeferShow
= _combo
.ComboCtrl_CanDeferShow
522 def DoShowPopup(*args
, **kwargs
):
524 DoShowPopup(self, Rect rect, int flags)
526 Shows and positions the popup.
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 ============ =====================================================
536 return _combo
.ComboCtrl_DoShowPopup(*args
, **kwargs
)
538 def AnimateShow(*args
, **kwargs
):
540 AnimateShow(self, Rect rect, int flags) -> bool
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`.
547 return _combo
.ComboCtrl_AnimateShow(*args
, **kwargs
)
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
)
564 _combo
.ComboCtrl_swigregister(ComboCtrl
)
566 def PreComboCtrl(*args
, **kwargs
):
567 """PreComboCtrl() -> ComboCtrl"""
568 val
= _combo
.new_PreComboCtrl(*args
, **kwargs
)
571 def ComboCtrl_GetFeatures(*args
):
573 ComboCtrl_GetFeatures() -> int
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`.
579 return _combo
.ComboCtrl_GetFeatures(*args
)
581 #---------------------------------------------------------------------------
583 class ComboPopup(object):
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.
593 Nearly all of the methods of this class are overridable in Python.
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
):
599 __init__(self) -> ComboPopup
603 _combo
.ComboPopup_swiginit(self
,_combo
.new_ComboPopup(*args
, **kwargs
))
604 ComboPopup
._setCallbackInfo
(self
, self
, ComboPopup
)
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
)
612 def Init(*args
, **kwargs
):
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.
620 return _combo
.ComboPopup_Init(*args
, **kwargs
)
622 def Create(*args
, **kwargs
):
624 Create(self, Window parent) -> bool
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...)
632 return _combo
.ComboPopup_Create(*args
, **kwargs
)
634 def GetControl(*args
, **kwargs
):
636 GetControl(self) -> Window
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``.
643 return _combo
.ComboPopup_GetControl(*args
, **kwargs
)
645 def OnPopup(*args
, **kwargs
):
649 The derived class may implement this to do special processing when
652 return _combo
.ComboPopup_OnPopup(*args
, **kwargs
)
654 def OnDismiss(*args
, **kwargs
):
658 The derived class may implement this to do special processing when
661 return _combo
.ComboPopup_OnDismiss(*args
, **kwargs
)
663 def SetStringValue(*args
, **kwargs
):
665 SetStringValue(self, String value)
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.
672 return _combo
.ComboPopup_SetStringValue(*args
, **kwargs
)
674 def GetStringValue(*args
, **kwargs
):
676 GetStringValue(self) -> String
678 Gets the string representation of the currently selected value to be
679 used to display in the combo widget.
681 return _combo
.ComboPopup_GetStringValue(*args
, **kwargs
)
683 def PaintComboControl(*args
, **kwargs
):
685 PaintComboControl(self, DC dc, Rect rect)
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.
690 return _combo
.ComboPopup_PaintComboControl(*args
, **kwargs
)
692 def OnComboKeyEvent(*args
, **kwargs
):
694 OnComboKeyEvent(self, KeyEvent event)
696 Receives key events from the parent ComboCtrl. Events not handled
697 should be skipped, as usual.
699 return _combo
.ComboPopup_OnComboKeyEvent(*args
, **kwargs
)
701 def OnComboDoubleClick(*args
, **kwargs
):
703 OnComboDoubleClick(self)
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.
708 return _combo
.ComboPopup_OnComboDoubleClick(*args
, **kwargs
)
710 def GetAdjustedSize(*args
, **kwargs
):
712 GetAdjustedSize(self, int minWidth, int prefHeight, int maxHeight) -> Size
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`.
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.
724 return _combo
.ComboPopup_GetAdjustedSize(*args
, **kwargs
)
726 def LazyCreate(*args
, **kwargs
):
728 LazyCreate(self) -> bool
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``.
736 return _combo
.ComboPopup_LazyCreate(*args
, **kwargs
)
738 def Dismiss(*args
, **kwargs
):
744 return _combo
.ComboPopup_Dismiss(*args
, **kwargs
)
746 def IsCreated(*args
, **kwargs
):
748 IsCreated(self) -> bool
750 Returns true if `Create` has been called.
752 return _combo
.ComboPopup_IsCreated(*args
, **kwargs
)
754 def DefaultPaintComboControl(*args
, **kwargs
):
756 DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
758 Default PaintComboControl behaviour
760 return _combo
.ComboPopup_DefaultPaintComboControl(*args
, **kwargs
)
762 DefaultPaintComboControl
= staticmethod(DefaultPaintComboControl
)
763 def GetCombo(*args
, **kwargs
):
765 GetCombo(self) -> ComboCtrl
767 Returns a reference to the `wx.combo.ComboCtrl` this ComboPopup object
770 return _combo
.ComboPopup_GetCombo(*args
, **kwargs
)
772 _combo
.ComboPopup_swigregister(ComboPopup
)
774 def ComboPopup_DefaultPaintComboControl(*args
, **kwargs
):
776 ComboPopup_DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
778 Default PaintComboControl behaviour
780 return _combo
.ComboPopup_DefaultPaintComboControl(*args
, **kwargs
)
782 #---------------------------------------------------------------------------
784 ODCB_DCLICK_CYCLES
= _combo
.ODCB_DCLICK_CYCLES
785 ODCB_STD_CONTROL_PAINT
= _combo
.ODCB_STD_CONTROL_PAINT
786 ODCB_PAINTING_CONTROL
= _combo
.ODCB_PAINTING_CONTROL
787 ODCB_PAINTING_SELECTED
= _combo
.ODCB_PAINTING_SELECTED
788 class OwnerDrawnComboBox(ComboCtrl
,_core
.ItemContainer
):
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.
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`
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
):
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
809 Standard constructor.
811 _combo
.OwnerDrawnComboBox_swiginit(self
,_combo
.new_OwnerDrawnComboBox(*args
, **kwargs
))
812 self
._setOORInfo
(self
);OwnerDrawnComboBox
._setCallbackInfo
(self
, self
, OwnerDrawnComboBox
)
814 def _setCallbackInfo(*args
, **kwargs
):
815 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
816 return _combo
.OwnerDrawnComboBox__setCallbackInfo(*args
, **kwargs
)
818 def Create(*args
, **kwargs
):
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
826 Create the UI object, and other initialization.
828 return _combo
.OwnerDrawnComboBox_Create(*args
, **kwargs
)
830 def GetWidestItemWidth(*args
, **kwargs
):
832 GetWidestItemWidth(self) -> int
834 Return the widest item width (recalculating it if necessary.)
836 return _combo
.OwnerDrawnComboBox_GetWidestItemWidth(*args
, **kwargs
)
838 def GetWidestItem(*args
, **kwargs
):
840 GetWidestItem(self) -> int
842 Return the index of the widest item (recalculating it if necessary.)
844 return _combo
.OwnerDrawnComboBox_GetWidestItem(*args
, **kwargs
)
846 def SetMark(*args
, **kwargs
):
847 """SetMark(self, long from, long to)"""
848 return _combo
.OwnerDrawnComboBox_SetMark(*args
, **kwargs
)
850 def OnDrawItem(*args
, **kwargs
):
852 OnDrawItem(self, DC dc, Rect rect, int item, int flags)
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
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
863 :param item: The index of the item to be drawn.
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.
873 return _combo
.OwnerDrawnComboBox_OnDrawItem(*args
, **kwargs
)
875 def OnMeasureItem(*args
, **kwargs
):
877 OnMeasureItem(self, size_t item) -> int
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.
883 return _combo
.OwnerDrawnComboBox_OnMeasureItem(*args
, **kwargs
)
885 def OnMeasureItemWidth(*args
, **kwargs
):
887 OnMeasureItemWidth(self, size_t item) -> int
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.
893 return _combo
.OwnerDrawnComboBox_OnMeasureItemWidth(*args
, **kwargs
)
895 def OnDrawBackground(*args
, **kwargs
):
897 OnDrawBackground(self, DC dc, Rect rect, int item, int flags)
899 This method is used to draw the items background and, maybe, a border
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`.
907 return _combo
.OwnerDrawnComboBox_OnDrawBackground(*args
, **kwargs
)
909 _combo
.OwnerDrawnComboBox_swigregister(OwnerDrawnComboBox
)
911 def PreOwnerDrawnComboBox(*args
, **kwargs
):
913 PreOwnerDrawnComboBox() -> OwnerDrawnComboBox
915 2-phase create constructor.
917 val
= _combo
.new_PreOwnerDrawnComboBox(*args
, **kwargs
)
920 class BitmapComboBox(OwnerDrawnComboBox
):
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.
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
):
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
938 _combo
.BitmapComboBox_swiginit(self
,_combo
.new_BitmapComboBox(*args
, **kwargs
))
939 self
._setOORInfo
(self
);
941 def Create(*args
, **kwargs
):
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
949 Create the UI object, and other initialization.
951 return _combo
.BitmapComboBox_Create(*args
, **kwargs
)
953 def Append(*args
, **kwargs
):
955 Append(self, String item, Bitmap bitmap=wxNullBitmap, PyObject clientData=None) -> int
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.
960 return _combo
.BitmapComboBox_Append(*args
, **kwargs
)
962 def GetItemBitmap(*args
, **kwargs
):
964 GetItemBitmap(self, int n) -> Bitmap
966 Returns the image of the item with the given index.
968 return _combo
.BitmapComboBox_GetItemBitmap(*args
, **kwargs
)
970 def Insert(*args
, **kwargs
):
972 Insert(self, String item, Bitmap bitmap, int pos, PyObject clientData=None) -> int
974 Insert an item into the control before the item at the ``pos`` index,
975 optionally associating some data object with the item.
977 return _combo
.BitmapComboBox_Insert(*args
, **kwargs
)
979 def SetItemBitmap(*args
, **kwargs
):
981 SetItemBitmap(self, int n, Bitmap bitmap)
983 Sets the image for the given item.
985 return _combo
.BitmapComboBox_SetItemBitmap(*args
, **kwargs
)
987 def GetBitmapSize(*args
, **kwargs
):
989 GetBitmapSize(self) -> Size
991 Returns size of the image used in list.
993 return _combo
.BitmapComboBox_GetBitmapSize(*args
, **kwargs
)
995 _combo
.BitmapComboBox_swigregister(BitmapComboBox
)
997 def PreBitmapComboBox(*args
, **kwargs
):
999 PreBitmapComboBox() -> BitmapComboBox
1001 2-phase create constructor.
1003 val
= _combo
.new_PreBitmapComboBox(*args
, **kwargs
)