Home | Trees | Index | Help |
|
---|
Package wx :: Module combo :: Class ComboCtrl |
|
object
--+ |Object
--+ |EvtHandler
--+ |Window
--+ |Control
--+ | ComboCtrl
OwnerDrawnComboBox
A combo control is a generic combobox that allows for a totally custom popup. In addition it has other customization features. For instance, position and size of the dropdown button can be changed.
To specify what to use for the popup control you need to derive a
class from wx.combo.ComboPopup
and pass it to the ComboCtrl with
SetPopupControl
. It doesn't derive from any widget class so it can
be used either as a mixin class combined with some standard or custom
widget, or you can use the derived ComboPopup to create and hold an
independent reference to the widget to be used for the popup.
wx.CB_READONLY Text will not be editable. wx.CB_SORT Sorts the entries in the list alphabetically. wx.TE_PROCESS_ENTER The control will generate the event EVT_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). wx.CC_SPECIAL_DCLICK Double-clicking triggers a call to popup's OnComboDoubleClick. Actual behaviour is defined by a derived class. For instance, OwnerDrawnComboBox will cycle an item. This style only applies if wx.CB_READONLY is used as well. wx.CC_STD_BUTTON Drop button will behave more like a standard push button.
Method Summary | |
---|---|
Control |
Create a Control. |
bool |
Implement in derived class to create a drop-down animation. |
Copy(self)
| |
Cut(self)
| |
Shows and positions the popup. | |
Enables or disables popup animation, if any, depending on the value of the argument. | |
Bitmap | GetBitmapDisabled(self)
|
Bitmap | GetBitmapHover(self)
|
Bitmap | GetBitmapNormal(self)
|
Bitmap | GetBitmapPressed(self)
|
Window |
Get the dropdown button which is part of the combobox. |
Size |
Returns current size of the dropdown button. |
int | GetCustomPaintWidth(self)
|
int |
Returns a bit-list of flags indicating which features of the ComboCtrl functionality are implemented by this implemetation. (Static method) |
long | GetInsertionPoint(self)
|
unsigned int | GetInternalFlags(self)
|
long | GetLastPosition(self)
|
Window | GetMainWindowOfCompositeControl(self)
|
ComboPopup |
Returns the current popup interface that has been set with SetPopupControl . |
Window |
Returns the popup window containing the popup control. |
int | GetPopupWindowState(self)
|
wxTextCtrl |
Get the text control which is part of the combo control. |
int |
Returns actual indentation in pixels. |
Rect |
Returns area covered by the text field (includes everything except borders and the dropdown button). |
String |
Returns text representation of the current value. |
Dismisses the popup window. | |
bool |
Return true if Create has finished |
bool |
Returns true if given key combination should toggle the popup. |
bool |
Returns true if the popup is currently shown. |
bool | IsPopupWindowState(self,
state)
|
Implement in a derived class to define what happens on dropdown button click. | |
Common code to be called on popup hide/dismiss | |
Paste(self)
| |
Prepare background of combo control or an item in a dropdown list in a way typical on platform. | |
Remove(self,
from,
to)
| |
Replace(self,
from,
to,
value)
| |
Sets custom dropdown button graphics. | |
Set the position of the dropdown button. | |
SetCtrlMainWnd(self,
wnd)
| |
Set width, in pixels, of custom painted area in control without wx.CB_READONLY style. | |
SetInsertionPoint(self,
pos)
| |
SetInsertionPointEnd(self)
| |
SetMark(self,
from,
to)
| |
Set side of the control to which the popup will align itself. | |
Set popup interface class derived from wx.combo.ComboPopup . | |
Extends popup size horizontally, relative to the edges of the combo control. | |
Sets preferred maximum height of the popup. | |
Sets minimum width of the popup. | |
Sets the text for the text field without affecting the popup. | |
This will set the space in pixels between left edge of the control and the text, regardless whether control is read-only or not. | |
Sets the text for the combo control text field. | |
Same as SetValue , but also sends a EVT_TEXT event if withEvent is true. | |
bool |
Returns true if focus indicator should be drawn in the control. |
Show the popup window. | |
Undo(self)
| |
Enable or disable usage of an alternative popup window, which guarantees ability to focus the popup control, and allows common native controls to function normally. |
Property Summary | |
---|---|
BitmapDisabled | |
BitmapHover | |
BitmapNormal | |
BitmapPressed | |
Button | |
ButtonSize | |
CustomPaintWidth | |
InsertionPoint | |
PopupControl | |
PopupWindow | |
PopupWindowState | |
TextCtrl | |
TextIndent | |
TextRect | |
thisown : The membership flag | |
Value |
Class Variable Summary | |
---|---|
int |
Animating = 2 |
int |
CanDeferShow = 2 |
int |
Hidden = 0 |
int |
ShowAbove = 1 |
int |
ShowBelow = 0 |
int |
Visible = 3 |
Instance Method Details |
---|
__init__(self,
parent,
id=ID_ANY,
value=wxEmptyString,
pos=DefaultPosition,
size=DefaultSize,
style=0,
validator=DefaultValidator,
name=wxPyComboBoxNameStr)
|
AnimateShow(self, rect, flags)Implement in derived class to create a drop-down animation. Return
True if finished immediately. Otherwise the popup is only shown when the
derived class calls
|
DoShowPopup(self, rect, flags)Shows and positions the popup.
|
EnablePopupAnimation(self, enable=True)Enables or disables popup animation, if any, depending on the value of the argument.
|
GetButton(self)Get the dropdown button which is part of the combobox. Note: it's not necessarily a wx.Button or wx.BitmapButton.
|
GetButtonSize(self)Returns current size of the dropdown button.
|
GetPopupControl(self)Returns the current popup interface that has been set with
|
GetPopupWindow(self)Returns the popup window containing the popup control.
|
GetTextCtrl(self)Get the text control which is part of the combo control.
|
GetTextIndent(self)Returns actual indentation in pixels.
|
GetTextRect(self)Returns area covered by the text field (includes everything except borders and the dropdown button).
|
GetValue(self)Returns text representation of the current value. For writable combo control it always returns the value in the text field.
|
HidePopup(self)Dismisses the popup window. |
IsCreated(self)Return true if Create has finished
|
IsKeyPopupToggle(self, event)Returns true if given key combination should toggle the popup.
|
IsPopupShown(self)Returns true if the popup is currently shown.
|
OnButtonClick(self)Implement in a derived class to define what happens on dropdown button click. Default action is to show the popup. |
OnPopupDismiss(self)Common code to be called on popup hide/dismiss |
PrepareBackground(self, dc, rect, flags)Prepare background of combo control or an item in a dropdown list in a way typical on platform. This includes painting the focus/disabled background and setting the clipping region. Unless you plan to paint your own focus indicator, you should always call this in your wxComboPopup::PaintComboControl implementation. In addition, it sets pen and text colour to what looks good and proper against the background. flags are the same as wx.RendererNative flags:
|
SetButtonBitmaps(self, bmpNormal, pushButtonBg=False, bmpPressed=wxNullBitmap, bmpHover=wxNullBitmap, bmpDisabled=wxNullBitmap)Sets custom dropdown button graphics.
|
SetButtonPosition(self, width=-1, height=-1, side=RIGHT, spacingX=0)Set the position of the dropdown button.
|
SetCustomPaintWidth(self, width)Set width, in pixels, of custom painted area in control without wx.CB_READONLY style. In read-only OwnerDrawnComboBox, this is used to indicate the area that is not covered by the focus rectangle.
|
SetPopupAnchor(self, anchorSide)Set side of the control to which the popup will align itself. Valid values are wx.LEFT, wx.RIGHT and 0. The default value 0 means that the most appropriate side is used (which, currently, is always wx.LEFT).
|
SetPopupControl(self, popup)Set popup interface class derived from
|
SetPopupExtents(self, extLeft, extRight)Extends popup size horizontally, relative to the edges of the combo control. Values are given in pixels, and the defaults are zero. It is up to the popup to fully take these values into account.
|
SetPopupMaxHeight(self, height)Sets preferred maximum height of the popup. A value of -1 indicates to use the default. The popup implementation may choose to ignore this.
|
SetPopupMinWidth(self, width)Sets minimum width of the popup. If wider than combo control, it will extend to the left. A value of -1 indicates to use the default. The popup implementation may choose to ignore this.
|
SetText(self, value)Sets the text for the text field without affecting the popup. Thus,
unlike
|
SetTextIndent(self, indent)This will set the space in pixels between left edge of the control and the text, regardless whether control is read-only or not. A value of -1 can be given to indicate platform default.
|
SetValue(self, value)Sets the text for the combo control text field. For a combo control with wx.CB_READONLY style the string must be accepted by the popup (for instance, exist in the dropdown list), otherwise the call to SetValue is ignored.
|
SetValueWithEvent(self, value, withEvent=True)Same as
|
ShouldDrawFocus(self)Returns true if focus indicator should be drawn in the control.
|
ShowPopup(self)Show the popup window. |
UseAltPopupWindow(self, enable=True)Enable or disable usage of an alternative popup window, which guarantees ability to focus the popup control, and allows common native controls to function normally. This alternative popup window is usually a wxDialog, and as such, when it is shown, its parent top-level window will appear as if the focus has been lost from it.
|
Static Method Details |
---|
GetFeatures()Returns a bit-list of flags indicating which features of the ComboCtrl
functionality are implemented by this implemetation. See
|
Property Details |
---|
BitmapDisabled
|
BitmapHover
|
BitmapNormal
|
BitmapPressed
|
Button
|
ButtonSize
|
CustomPaintWidth
|
InsertionPoint
|
PopupControl
|
PopupWindow
|
PopupWindowState
|
TextCtrl
|
TextIndent
|
TextRect
|
thisownThe membership flag
|
Value |
Class Variable Details |
---|
Animating
|
CanDeferShow
|
Hidden
|
ShowAbove
|
ShowBelow
|
Visible
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:14:16 2007 | http://epydoc.sf.net |