]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/mac/combo.py
Add ToggleWindowStyle
[wxWidgets.git] / wxPython / src / mac / combo.py
CommitLineData
84bc0d49
RD
1# This file was created automatically by SWIG 1.3.29.
2# Don't modify this file, modify the SWIG interface instead.
3
4"""
d359a380 5ComboCtrl class that can have any type of popup widget, and also an
84bc0d49
RD
6owner-drawn combobox control.
7"""
8
9import _combo
10import new
11new_instancemethod = new.instancemethod
12def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
13 if (name == "thisown"): return self.this.own(value)
14 if (name == "this"):
15 if type(value).__name__ == 'PySwigObject':
16 self.__dict__[name] = value
17 return
18 method = class_type.__swig_setmethods__.get(name,None)
19 if method: return method(self,value)
20 if (not static) or hasattr(self,name):
21 self.__dict__[name] = value
22 else:
23 raise AttributeError("You cannot add attributes to %s" % self)
24
25def _swig_setattr(self,class_type,name,value):
26 return _swig_setattr_nondynamic(self,class_type,name,value,0)
27
28def _swig_getattr(self,class_type,name):
29 if (name == "thisown"): return self.this.own()
30 method = class_type.__swig_getmethods__.get(name,None)
31 if method: return method(self)
32 raise AttributeError,name
33
34def _swig_repr(self):
35 try: strthis = "proxy of " + self.this.__repr__()
36 except: strthis = ""
37 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
38
39import types
40try:
41 _object = types.ObjectType
42 _newclass = 1
43except AttributeError:
44 class _object : pass
45 _newclass = 0
46del types
47
48
49def _swig_setattr_nondynamic_method(set):
50 def set_attr(self,name,value):
51 if (name == "thisown"): return self.this.own(value)
52 if hasattr(self,name) or (name == "this"):
53 set(self,name,value)
54 else:
55 raise AttributeError("You cannot add attributes to %s" % self)
56 return set_attr
57
58
59import _windows
60import _core
61wx = _core
62__docfilter__ = wx.__DocFilter(globals())
63#---------------------------------------------------------------------------
64
65CC_BUTTON_OUTSIDE_BORDER = _combo.CC_BUTTON_OUTSIDE_BORDER
66CC_POPUP_ON_MOUSE_UP = _combo.CC_POPUP_ON_MOUSE_UP
67CC_NO_TEXT_AUTO_SELECT = _combo.CC_NO_TEXT_AUTO_SELECT
68CC_MF_ON_BUTTON = _combo.CC_MF_ON_BUTTON
69CC_MF_ON_CLICK_AREA = _combo.CC_MF_ON_CLICK_AREA
70class ComboCtrlFeatures(object):
eccab1a7
RD
71 """
72 Namespace for `wx.combo.ComboCtrl` feature flags. See
73 `wx.combo.ComboCtrl.GetFeatures`.
74 """
84bc0d49
RD
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"
77 __repr__ = _swig_repr
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)
87
88class ComboCtrl(_core.Control):
eccab1a7
RD
89 """
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.
93
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.
100
101 """
84bc0d49
RD
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):
105 """
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
110 """
111 _combo.ComboCtrl_swiginit(self,_combo.new_ComboCtrl(*args, **kwargs))
112 self._setOORInfo(self);ComboCtrl._setCallbackInfo(self, self, ComboCtrl)
113
114 def _setCallbackInfo(*args, **kwargs):
115 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
116 return _combo.ComboCtrl__setCallbackInfo(*args, **kwargs)
117
118 def ShowPopup(*args, **kwargs):
eccab1a7
RD
119 """
120 ShowPopup(self)
121
122 Show the popup window.
123 """
84bc0d49
RD
124 return _combo.ComboCtrl_ShowPopup(*args, **kwargs)
125
126 def HidePopup(*args, **kwargs):
eccab1a7
RD
127 """
128 HidePopup(self)
129
130 Dismisses the popup window.
131 """
84bc0d49
RD
132 return _combo.ComboCtrl_HidePopup(*args, **kwargs)
133
134 def OnButtonClick(*args, **kwargs):
eccab1a7
RD
135 """
136 OnButtonClick(self)
137
138 Implement in a derived class to define what happens on dropdown button
139 click. Default action is to show the popup.
140 """
84bc0d49
RD
141 return _combo.ComboCtrl_OnButtonClick(*args, **kwargs)
142
143 def IsPopupShown(*args, **kwargs):
eccab1a7
RD
144 """
145 IsPopupShown(self) -> bool
146
147 Returns true if the popup is currently shown.
148 """
84bc0d49
RD
149 return _combo.ComboCtrl_IsPopupShown(*args, **kwargs)
150
151 def SetPopupControl(*args, **kwargs):
eccab1a7
RD
152 """
153 SetPopupControl(self, ComboPopup popup)
154
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.
158 """
84bc0d49
RD
159 return _combo.ComboCtrl_SetPopupControl(*args, **kwargs)
160
161 def GetPopupControl(*args, **kwargs):
eccab1a7
RD
162 """
163 GetPopupControl(self) -> ComboPopup
164
165 Returns the current popup interface that has been set with
166 `SetPopupControl`.
167 """
84bc0d49
RD
168 return _combo.ComboCtrl_GetPopupControl(*args, **kwargs)
169
170 def GetPopupWindow(*args, **kwargs):
eccab1a7
RD
171 """
172 GetPopupWindow(self) -> Window
173
174 Returns the popup window containing the popup control.
175 """
84bc0d49
RD
176 return _combo.ComboCtrl_GetPopupWindow(*args, **kwargs)
177
178 def GetTextCtrl(*args, **kwargs):
eccab1a7
RD
179 """
180 GetTextCtrl(self) -> wxTextCtrl
181
182 Get the text control which is part of the combo control.
183 """
84bc0d49
RD
184 return _combo.ComboCtrl_GetTextCtrl(*args, **kwargs)
185
186 def GetButton(*args, **kwargs):
eccab1a7
RD
187 """
188 GetButton(self) -> Window
189
190 Get the dropdown button which is part of the combobox. Note: it's not
191 necessarily a wx.Button or wx.BitmapButton.
192 """
84bc0d49
RD
193 return _combo.ComboCtrl_GetButton(*args, **kwargs)
194
195 def GetValue(*args, **kwargs):
eccab1a7
RD
196 """
197 GetValue(self) -> String
198
199 Returns text representation of the current value. For writable combo
200 control it always returns the value in the text field.
201 """
84bc0d49
RD
202 return _combo.ComboCtrl_GetValue(*args, **kwargs)
203
204 def SetValue(*args, **kwargs):
eccab1a7
RD
205 """
206 SetValue(self, String value)
207
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
211 SetValue is ignored.
212 """
84bc0d49
RD
213 return _combo.ComboCtrl_SetValue(*args, **kwargs)
214
215 def Copy(*args, **kwargs):
216 """Copy(self)"""
217 return _combo.ComboCtrl_Copy(*args, **kwargs)
218
219 def Cut(*args, **kwargs):
220 """Cut(self)"""
221 return _combo.ComboCtrl_Cut(*args, **kwargs)
222
223 def Paste(*args, **kwargs):
224 """Paste(self)"""
225 return _combo.ComboCtrl_Paste(*args, **kwargs)
226
227 def SetInsertionPoint(*args, **kwargs):
228 """SetInsertionPoint(self, long pos)"""
229 return _combo.ComboCtrl_SetInsertionPoint(*args, **kwargs)
230
231 def SetInsertionPointEnd(*args, **kwargs):
232 """SetInsertionPointEnd(self)"""
233 return _combo.ComboCtrl_SetInsertionPointEnd(*args, **kwargs)
234
235 def GetInsertionPoint(*args, **kwargs):
236 """GetInsertionPoint(self) -> long"""
237 return _combo.ComboCtrl_GetInsertionPoint(*args, **kwargs)
238
239 def GetLastPosition(*args, **kwargs):
240 """GetLastPosition(self) -> long"""
241 return _combo.ComboCtrl_GetLastPosition(*args, **kwargs)
242
243 def Replace(*args, **kwargs):
244 """Replace(self, long from, long to, String value)"""
245 return _combo.ComboCtrl_Replace(*args, **kwargs)
246
247 def Remove(*args, **kwargs):
248 """Remove(self, long from, long to)"""
249 return _combo.ComboCtrl_Remove(*args, **kwargs)
250
251 def Undo(*args, **kwargs):
252 """Undo(self)"""
253 return _combo.ComboCtrl_Undo(*args, **kwargs)
254
255 def SetMark(*args, **kwargs):
256 """SetMark(self, long from, long to)"""
257 return _combo.ComboCtrl_SetMark(*args, **kwargs)
258
259 def SetText(*args, **kwargs):
eccab1a7
RD
260 """
261 SetText(self, String value)
262
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.
266 """
84bc0d49
RD
267 return _combo.ComboCtrl_SetText(*args, **kwargs)
268
269 def SetValueWithEvent(*args, **kwargs):
eccab1a7
RD
270 """
271 SetValueWithEvent(self, String value, bool withEvent=True)
272
273 Same as `SetValue`, but also sends a EVT_TEXT event if withEvent is true.
274 """
84bc0d49
RD
275 return _combo.ComboCtrl_SetValueWithEvent(*args, **kwargs)
276
277 def SetPopupMinWidth(*args, **kwargs):
eccab1a7
RD
278 """
279 SetPopupMinWidth(self, int width)
280
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.
284 """
84bc0d49
RD
285 return _combo.ComboCtrl_SetPopupMinWidth(*args, **kwargs)
286
287 def SetPopupMaxHeight(*args, **kwargs):
eccab1a7
RD
288 """
289 SetPopupMaxHeight(self, int height)
290
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.
293 """
84bc0d49
RD
294 return _combo.ComboCtrl_SetPopupMaxHeight(*args, **kwargs)
295
296 def SetPopupExtents(*args, **kwargs):
eccab1a7
RD
297 """
298 SetPopupExtents(self, int extLeft, int extRight)
299
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
f27895d2 302 is up to the popup to fully take these values into account.
eccab1a7 303 """
84bc0d49
RD
304 return _combo.ComboCtrl_SetPopupExtents(*args, **kwargs)
305
306 def SetCustomPaintWidth(*args, **kwargs):
eccab1a7
RD
307 """
308 SetCustomPaintWidth(self, int width)
309
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.
313 """
84bc0d49
RD
314 return _combo.ComboCtrl_SetCustomPaintWidth(*args, **kwargs)
315
316 def GetCustomPaintWidth(*args, **kwargs):
317 """GetCustomPaintWidth(self) -> int"""
318 return _combo.ComboCtrl_GetCustomPaintWidth(*args, **kwargs)
319
320 def SetPopupAnchor(*args, **kwargs):
eccab1a7
RD
321 """
322 SetPopupAnchor(self, int anchorSide)
323
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).
327 """
84bc0d49
RD
328 return _combo.ComboCtrl_SetPopupAnchor(*args, **kwargs)
329
330 def SetButtonPosition(*args, **kwargs):
eccab1a7
RD
331 """
332 SetButtonPosition(self, int width=-1, int height=-1, int side=RIGHT, int spacingX=0)
333
334 Set the position of the dropdown button.
335 """
84bc0d49
RD
336 return _combo.ComboCtrl_SetButtonPosition(*args, **kwargs)
337
338 def GetButtonSize(*args, **kwargs):
eccab1a7
RD
339 """
340 GetButtonSize(self) -> Size
341
342 Returns current size of the dropdown button.
343 """
84bc0d49
RD
344 return _combo.ComboCtrl_GetButtonSize(*args, **kwargs)
345
346 def SetButtonBitmaps(*args, **kwargs):
347 """
348 SetButtonBitmaps(self, Bitmap bmpNormal, bool pushButtonBg=False, Bitmap bmpPressed=wxNullBitmap,
349 Bitmap bmpHover=wxNullBitmap,
350 Bitmap bmpDisabled=wxNullBitmap)
eccab1a7
RD
351
352 Sets custom dropdown button graphics.
353
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.
359
84bc0d49
RD
360 """
361 return _combo.ComboCtrl_SetButtonBitmaps(*args, **kwargs)
362
363 def SetTextIndent(*args, **kwargs):
eccab1a7
RD
364 """
365 SetTextIndent(self, int indent)
366
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.
370 """
84bc0d49
RD
371 return _combo.ComboCtrl_SetTextIndent(*args, **kwargs)
372
373 def GetTextIndent(*args, **kwargs):
eccab1a7
RD
374 """
375 GetTextIndent(self) -> int
376
377 Returns actual indentation in pixels.
378 """
84bc0d49
RD
379 return _combo.ComboCtrl_GetTextIndent(*args, **kwargs)
380
381 def GetTextRect(*args, **kwargs):
eccab1a7
RD
382 """
383 GetTextRect(self) -> Rect
384
385 Returns area covered by the text field (includes everything except
386 borders and the dropdown button).
387 """
84bc0d49
RD
388 return _combo.ComboCtrl_GetTextRect(*args, **kwargs)
389
390 def UseAltPopupWindow(*args, **kwargs):
eccab1a7
RD
391 """
392 UseAltPopupWindow(self, bool enable=True)
393
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.
399 """
84bc0d49
RD
400 return _combo.ComboCtrl_UseAltPopupWindow(*args, **kwargs)
401
402 def EnablePopupAnimation(*args, **kwargs):
eccab1a7
RD
403 """
404 EnablePopupAnimation(self, bool enable=True)
405
406 Enables or disables popup animation, if any, depending on the value of
407 the argument.
408 """
84bc0d49
RD
409 return _combo.ComboCtrl_EnablePopupAnimation(*args, **kwargs)
410
411 def IsKeyPopupToggle(*args, **kwargs):
eccab1a7
RD
412 """
413 IsKeyPopupToggle(self, KeyEvent event) -> bool
414
415 Returns true if given key combination should toggle the popup.
416 """
84bc0d49
RD
417 return _combo.ComboCtrl_IsKeyPopupToggle(*args, **kwargs)
418
419 def PrepareBackground(*args, **kwargs):
eccab1a7
RD
420 """
421 PrepareBackground(self, DC dc, Rect rect, int flags)
422
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
429 background.
430
431 flags are the same as wx.RendererNative flags:
432
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 ====================== ============================================
438
439 """
84bc0d49
RD
440 return _combo.ComboCtrl_PrepareBackground(*args, **kwargs)
441
442 def ShouldDrawFocus(*args, **kwargs):
eccab1a7
RD
443 """
444 ShouldDrawFocus(self) -> bool
445
446 Returns true if focus indicator should be drawn in the control.
447 """
84bc0d49
RD
448 return _combo.ComboCtrl_ShouldDrawFocus(*args, **kwargs)
449
450 def GetBitmapNormal(*args, **kwargs):
451 """GetBitmapNormal(self) -> Bitmap"""
452 return _combo.ComboCtrl_GetBitmapNormal(*args, **kwargs)
453
454 def GetBitmapPressed(*args, **kwargs):
455 """GetBitmapPressed(self) -> Bitmap"""
456 return _combo.ComboCtrl_GetBitmapPressed(*args, **kwargs)
457
458 def GetBitmapHover(*args, **kwargs):
459 """GetBitmapHover(self) -> Bitmap"""
460 return _combo.ComboCtrl_GetBitmapHover(*args, **kwargs)
461
462 def GetBitmapDisabled(*args, **kwargs):
463 """GetBitmapDisabled(self) -> Bitmap"""
464 return _combo.ComboCtrl_GetBitmapDisabled(*args, **kwargs)
465
466 def GetInternalFlags(*args, **kwargs):
467 """GetInternalFlags(self) -> unsigned int"""
468 return _combo.ComboCtrl_GetInternalFlags(*args, **kwargs)
469
470 def IsCreated(*args, **kwargs):
eccab1a7
RD
471 """
472 IsCreated(self) -> bool
473
474 Return true if Create has finished
475 """
84bc0d49
RD
476 return _combo.ComboCtrl_IsCreated(*args, **kwargs)
477
478 def OnPopupDismiss(*args, **kwargs):
eccab1a7
RD
479 """
480 OnPopupDismiss(self)
481
482 Common code to be called on popup hide/dismiss
483 """
84bc0d49
RD
484 return _combo.ComboCtrl_OnPopupDismiss(*args, **kwargs)
485
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)
492
493 def GetPopupWindowState(*args, **kwargs):
494 """GetPopupWindowState(self) -> int"""
495 return _combo.ComboCtrl_GetPopupWindowState(*args, **kwargs)
496
497 def SetCtrlMainWnd(*args, **kwargs):
498 """SetCtrlMainWnd(self, Window wnd)"""
499 return _combo.ComboCtrl_SetCtrlMainWnd(*args, **kwargs)
500
f27895d2
RD
501 def GetMainWindowOfCompositeControl(*args, **kwargs):
502 """GetMainWindowOfCompositeControl(self) -> Window"""
503 return _combo.ComboCtrl_GetMainWindowOfCompositeControl(*args, **kwargs)
504
84bc0d49 505 def GetFeatures(*args, **kwargs):
eccab1a7
RD
506 """
507 GetFeatures() -> int
508
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`.
512 """
84bc0d49
RD
513 return _combo.ComboCtrl_GetFeatures(*args, **kwargs)
514
515 GetFeatures = staticmethod(GetFeatures)
516 ShowBelow = _combo.ComboCtrl_ShowBelow
517 ShowAbove = _combo.ComboCtrl_ShowAbove
518 CanDeferShow = _combo.ComboCtrl_CanDeferShow
519 def DoShowPopup(*args, **kwargs):
eccab1a7
RD
520 """
521 DoShowPopup(self, Rect rect, int flags)
522
523 Shows and positions the popup.
524
525 Flags:
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 ============ =====================================================
531
532 """
84bc0d49
RD
533 return _combo.ComboCtrl_DoShowPopup(*args, **kwargs)
534
535 def AnimateShow(*args, **kwargs):
eccab1a7
RD
536 """
537 AnimateShow(self, Rect rect, int flags) -> bool
538
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`.
542
543 """
84bc0d49
RD
544 return _combo.ComboCtrl_AnimateShow(*args, **kwargs)
545
f27895d2
RD
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)
84bc0d49
RD
561_combo.ComboCtrl_swigregister(ComboCtrl)
562
563def PreComboCtrl(*args, **kwargs):
564 """PreComboCtrl() -> ComboCtrl"""
565 val = _combo.new_PreComboCtrl(*args, **kwargs)
566 return val
567
568def ComboCtrl_GetFeatures(*args):
eccab1a7
RD
569 """
570 ComboCtrl_GetFeatures() -> int
571
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`.
575 """
84bc0d49
RD
576 return _combo.ComboCtrl_GetFeatures(*args)
577
578#---------------------------------------------------------------------------
579
580class ComboPopup(object):
eccab1a7
RD
581 """
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.
589
590 Nearly all of the methods of this class are overridable in Python.
591 """
84bc0d49
RD
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):
eccab1a7
RD
595 """
596 __init__(self) -> ComboPopup
597
598 Constructor
599 """
84bc0d49
RD
600 _combo.ComboPopup_swiginit(self,_combo.new_ComboPopup(*args, **kwargs))
601 ComboPopup._setCallbackInfo(self, self, ComboPopup)
602
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)
608
609 def Init(*args, **kwargs):
eccab1a7
RD
610 """
611 Init(self)
612
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.
616 """
84bc0d49
RD
617 return _combo.ComboPopup_Init(*args, **kwargs)
618
619 def Create(*args, **kwargs):
eccab1a7
RD
620 """
621 Create(self, Window parent) -> bool
622
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...)
628 """
84bc0d49
RD
629 return _combo.ComboPopup_Create(*args, **kwargs)
630
631 def GetControl(*args, **kwargs):
eccab1a7
RD
632 """
633 GetControl(self) -> Window
634
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``.
639 """
84bc0d49
RD
640 return _combo.ComboPopup_GetControl(*args, **kwargs)
641
642 def OnPopup(*args, **kwargs):
eccab1a7
RD
643 """
644 OnPopup(self)
645
646 The derived class may implement this to do special processing when
647 popup is shown.
648 """
84bc0d49
RD
649 return _combo.ComboPopup_OnPopup(*args, **kwargs)
650
651 def OnDismiss(*args, **kwargs):
eccab1a7
RD
652 """
653 OnDismiss(self)
654
655 The derived class may implement this to do special processing when
656 popup is hidden.
657 """
84bc0d49
RD
658 return _combo.ComboPopup_OnDismiss(*args, **kwargs)
659
660 def SetStringValue(*args, **kwargs):
eccab1a7
RD
661 """
662 SetStringValue(self, String value)
663
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.
668 """
84bc0d49
RD
669 return _combo.ComboPopup_SetStringValue(*args, **kwargs)
670
671 def GetStringValue(*args, **kwargs):
eccab1a7
RD
672 """
673 GetStringValue(self) -> String
674
675 Gets the string representation of the currently selected value to be
676 used to display in the combo widget.
677 """
84bc0d49
RD
678 return _combo.ComboPopup_GetStringValue(*args, **kwargs)
679
680 def PaintComboControl(*args, **kwargs):
eccab1a7
RD
681 """
682 PaintComboControl(self, DC dc, Rect rect)
683
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.
686 """
84bc0d49
RD
687 return _combo.ComboPopup_PaintComboControl(*args, **kwargs)
688
689 def OnComboKeyEvent(*args, **kwargs):
eccab1a7
RD
690 """
691 OnComboKeyEvent(self, KeyEvent event)
692
693 Receives key events from the parent ComboCtrl. Events not handled
694 should be skipped, as usual.
695 """
84bc0d49
RD
696 return _combo.ComboPopup_OnComboKeyEvent(*args, **kwargs)
697
698 def OnComboDoubleClick(*args, **kwargs):
eccab1a7
RD
699 """
700 OnComboDoubleClick(self)
701
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.
704 """
84bc0d49
RD
705 return _combo.ComboPopup_OnComboDoubleClick(*args, **kwargs)
706
707 def GetAdjustedSize(*args, **kwargs):
eccab1a7
RD
708 """
709 GetAdjustedSize(self, int minWidth, int prefHeight, int maxHeight) -> Size
710
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`.
714
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.
719
720 """
84bc0d49
RD
721 return _combo.ComboPopup_GetAdjustedSize(*args, **kwargs)
722
723 def LazyCreate(*args, **kwargs):
eccab1a7
RD
724 """
725 LazyCreate(self) -> bool
726
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``.
732 """
84bc0d49
RD
733 return _combo.ComboPopup_LazyCreate(*args, **kwargs)
734
735 def Dismiss(*args, **kwargs):
eccab1a7
RD
736 """
737 Dismiss(self)
738
739 Hides the popup
740 """
84bc0d49
RD
741 return _combo.ComboPopup_Dismiss(*args, **kwargs)
742
743 def IsCreated(*args, **kwargs):
eccab1a7
RD
744 """
745 IsCreated(self) -> bool
746
747 Returns true if `Create` has been called.
748 """
84bc0d49
RD
749 return _combo.ComboPopup_IsCreated(*args, **kwargs)
750
751 def DefaultPaintComboControl(*args, **kwargs):
eccab1a7
RD
752 """
753 DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
754
755 Default PaintComboControl behaviour
756 """
84bc0d49
RD
757 return _combo.ComboPopup_DefaultPaintComboControl(*args, **kwargs)
758
759 DefaultPaintComboControl = staticmethod(DefaultPaintComboControl)
760 def GetCombo(*args, **kwargs):
eccab1a7
RD
761 """
762 GetCombo(self) -> ComboCtrl
763
764 Returns a reference to the `wx.combo.ComboCtrl` this ComboPopup object
765 is associated with.
766 """
84bc0d49
RD
767 return _combo.ComboPopup_GetCombo(*args, **kwargs)
768
769_combo.ComboPopup_swigregister(ComboPopup)
770
771def ComboPopup_DefaultPaintComboControl(*args, **kwargs):
eccab1a7
RD
772 """
773 ComboPopup_DefaultPaintComboControl(wxComboCtrlBase combo, DC dc, Rect rect)
774
775 Default PaintComboControl behaviour
776 """
84bc0d49
RD
777 return _combo.ComboPopup_DefaultPaintComboControl(*args, **kwargs)
778
779#---------------------------------------------------------------------------
780
781ODCB_DCLICK_CYCLES = _combo.ODCB_DCLICK_CYCLES
782ODCB_STD_CONTROL_PAINT = _combo.ODCB_STD_CONTROL_PAINT
783ODCB_PAINTING_CONTROL = _combo.ODCB_PAINTING_CONTROL
784ODCB_PAINTING_SELECTED = _combo.ODCB_PAINTING_SELECTED
785class OwnerDrawnComboBox(ComboCtrl,_core.ItemContainer):
eccab1a7
RD
786 """
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.
790
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`
794 methods.
795 """
84bc0d49
RD
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):
799 """
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
eccab1a7
RD
805
806 Standard constructor.
84bc0d49
RD
807 """
808 _combo.OwnerDrawnComboBox_swiginit(self,_combo.new_OwnerDrawnComboBox(*args, **kwargs))
809 self._setOORInfo(self);OwnerDrawnComboBox._setCallbackInfo(self, self, OwnerDrawnComboBox)
810
eccab1a7
RD
811 def _setCallbackInfo(*args, **kwargs):
812 """_setCallbackInfo(self, PyObject self, PyObject _class)"""
813 return _combo.OwnerDrawnComboBox__setCallbackInfo(*args, **kwargs)
814
84bc0d49
RD
815 def Create(*args, **kwargs):
816 """
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
eccab1a7
RD
822
823 Create the UI object, and other initialization.
84bc0d49
RD
824 """
825 return _combo.OwnerDrawnComboBox_Create(*args, **kwargs)
826
827 def GetWidestItemWidth(*args, **kwargs):
eccab1a7
RD
828 """
829 GetWidestItemWidth(self) -> int
830
831 Return the widest item width (recalculating it if necessary.)
832 """
84bc0d49
RD
833 return _combo.OwnerDrawnComboBox_GetWidestItemWidth(*args, **kwargs)
834
835 def GetWidestItem(*args, **kwargs):
eccab1a7
RD
836 """
837 GetWidestItem(self) -> int
838
839 Return the index of the widest item (recalculating it if necessary.)
840 """
84bc0d49
RD
841 return _combo.OwnerDrawnComboBox_GetWidestItem(*args, **kwargs)
842
843 def SetMark(*args, **kwargs):
844 """SetMark(self, long from, long to)"""
845 return _combo.OwnerDrawnComboBox_SetMark(*args, **kwargs)
846
eccab1a7
RD
847 def OnDrawItem(*args, **kwargs):
848 """
849 OnDrawItem(self, DC dc, Rect rect, int item, int flags)
850
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
854 normal combobox.
855
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
859 calling this method.
860 :param item: The index of the item to be drawn.
861
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.
868
869 """
870 return _combo.OwnerDrawnComboBox_OnDrawItem(*args, **kwargs)
871
872 def OnMeasureItem(*args, **kwargs):
873 """
874 OnMeasureItem(self, size_t item) -> int
875
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.
879 """
880 return _combo.OwnerDrawnComboBox_OnMeasureItem(*args, **kwargs)
881
882 def OnMeasureItemWidth(*args, **kwargs):
883 """
884 OnMeasureItemWidth(self, size_t item) -> int
885
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.
889 """
890 return _combo.OwnerDrawnComboBox_OnMeasureItemWidth(*args, **kwargs)
891
892 def OnDrawBackground(*args, **kwargs):
893 """
894 OnDrawBackground(self, DC dc, Rect rect, int item, int flags)
895
896 This method is used to draw the items background and, maybe, a border
897 around it.
898
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`.
903 """
904 return _combo.OwnerDrawnComboBox_OnDrawBackground(*args, **kwargs)
905
84bc0d49
RD
906_combo.OwnerDrawnComboBox_swigregister(OwnerDrawnComboBox)
907
908def PreOwnerDrawnComboBox(*args, **kwargs):
eccab1a7
RD
909 """
910 PreOwnerDrawnComboBox() -> OwnerDrawnComboBox
911
912 2-phase create constructor.
913 """
84bc0d49
RD
914 val = _combo.new_PreOwnerDrawnComboBox(*args, **kwargs)
915 return val
916
f27895d2
RD
917class BitmapComboBox(OwnerDrawnComboBox):
918 """
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.
922 """
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):
926 """
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
932
933 Standard constructor
934 """
935 _combo.BitmapComboBox_swiginit(self,_combo.new_BitmapComboBox(*args, **kwargs))
936 self._setOORInfo(self);
937
938 def Create(*args, **kwargs):
939 """
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
945
946 Create the UI object, and other initialization.
947 """
948 return _combo.BitmapComboBox_Create(*args, **kwargs)
949
950 def Append(*args, **kwargs):
951 """
952 Append(self, String item, Bitmap bitmap=wxNullBitmap, PyObject clientData=None) -> int
953
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.
956 """
957 return _combo.BitmapComboBox_Append(*args, **kwargs)
958
959 def GetItemBitmap(*args, **kwargs):
960 """
d359a380 961 GetItemBitmap(self, int n) -> Bitmap
f27895d2
RD
962
963 Returns the image of the item with the given index.
964 """
965 return _combo.BitmapComboBox_GetItemBitmap(*args, **kwargs)
966
967 def Insert(*args, **kwargs):
968 """
d359a380 969 Insert(self, String item, Bitmap bitmap, int pos, PyObject clientData=None) -> int
f27895d2
RD
970
971 Insert an item into the control before the item at the ``pos`` index,
972 optionally associating some data object with the item.
973 """
974 return _combo.BitmapComboBox_Insert(*args, **kwargs)
975
976 def SetItemBitmap(*args, **kwargs):
977 """
d359a380 978 SetItemBitmap(self, int n, Bitmap bitmap)
f27895d2
RD
979
980 Sets the image for the given item.
981 """
982 return _combo.BitmapComboBox_SetItemBitmap(*args, **kwargs)
983
984 def GetBitmapSize(*args, **kwargs):
985 """
986 GetBitmapSize(self) -> Size
987
988 Returns size of the image used in list.
989 """
990 return _combo.BitmapComboBox_GetBitmapSize(*args, **kwargs)
991
992_combo.BitmapComboBox_swigregister(BitmapComboBox)
993
994def PreBitmapComboBox(*args, **kwargs):
995 """
996 PreBitmapComboBox() -> BitmapComboBox
997
998 2-phase create constructor.
999 """
1000 val = _combo.new_PreBitmapComboBox(*args, **kwargs)
1001 return val
1002
84bc0d49
RD
1003
1004