X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/84dd1dd89e9f02edaaf9d61b3932c7feb3cd8898..9e477492e29e03c02827b1e42a16cb09a13f5149:/wxPython/src/combo.i diff --git a/wxPython/src/combo.i b/wxPython/src/combo.i index 389afca86e..d14a2487ce 100644 --- a/wxPython/src/combo.i +++ b/wxPython/src/combo.i @@ -141,6 +141,12 @@ public: } + virtual wxWindow *GetMainWindowOfCompositeControl() + { + return wxComboCtrl::GetMainWindowOfCompositeControl(); + } + + enum { ShowBelow = 0x0000, // Showing popup below the control @@ -184,6 +190,7 @@ 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. ", " + Window Styles ------------- ==================== ============================================ @@ -284,12 +291,17 @@ created, unless `OnButtonClick` has been overridden.", ""); "Get the dropdown button which is part of the combobox. Note: it's not necessarily a wx.Button or wx.BitmapButton.", ""); - + +// NOTE: These are virtuals defined in a base class, so there +// shouldn't be any reason to provide SWIG wrappers for them... // // forward these methods to all subcontrols // virtual bool Enable(bool enable = true); // virtual bool Show(bool show = true); // virtual bool SetFont(const wxFont& font); +// virtual void SetValidator(const wxValidator &validator); +// virtual wxValidator *GetValidator(); + // wxTextCtrl methods - for readonly combo they should return // without errors. @@ -352,7 +364,7 @@ use the default. The popup implementation may choose to ignore this.", ""); void , SetPopupExtents( int extLeft, int 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 th epopup to fully take these values into account.", ""); +is up to the popup to fully take these values into account.", ""); DocDeclStr( @@ -442,16 +454,6 @@ the argument.", ""); "Returns true if given key combination should toggle the popup.", ""); - // 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: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control - // wxCONTROL_SELECTED: list item is selected - // wxCONTROL_DISABLED: control/item is disabled DocDeclStr( virtual void , PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const, "Prepare background of combo control or an item in a dropdown list in a @@ -510,6 +512,7 @@ flags are the same as wx.RendererNative flags: // Set value returned by GetMainWindowOfCompositeControl void SetCtrlMainWnd( wxWindow* wnd ); + virtual wxWindow *GetMainWindowOfCompositeControl(); DocDeclStr( static int , GetFeatures(), @@ -550,6 +553,22 @@ derived class calls `DoShowPopup`. Flags are same as for `DoShowPopup`. ", ""); + %property(PopupControl, GetPopupControl, SetPopupControl); + %property(PopupWindow, GetPopupWindow); + %property(TextCtrl, GetTextCtrl); + %property(Button, GetButton); + %property(Value, GetValue, SetValue); + %property(InsertionPoint, GetInsertionPoint); + %property(CustomPaintWidth, GetCustomPaintWidth, SetCustomPaintWidth); + %property(ButtonSize, GetButtonSize); + %property(TextIndent, GetTextIndent, SetTextIndent); + %property(TextRect, GetTextRect); + %property(BitmapNormal, GetBitmapNormal); + %property(BitmapPressed, GetBitmapPressed); + %property(BitmapHover, GetBitmapHover); + %property(BitmapDisabled, GetBitmapDisabled); + %property(PopupWindowState, GetPopupWindowState); + }; //--------------------------------------------------------------------------- @@ -998,6 +1017,116 @@ or current. ``flags`` has the sam meaning as with `OnDrawItem`.", ""); }; +//--------------------------------------------------------------------------- + +%{ +#include +%} + +DocStr(wxBitmapComboBox, + "A combobox that displays a bitmap in front of the list items. It +currently only allows using bitmaps of one size, and resizes itself so +that a bitmap can be shown next to the text field.", +" + +Window Styles +------------- + =================== ============================================ + wx.CB_READONLY Creates a combobox without a text editor. On + some platforms the control may appear very + different when this style is used. + wx.CB_SORT Sorts the entries in the list alphabetically. + wx.TE_PROCESS_ENTER The control will generate the event + wx.EVT__TEXT_ENTER (otherwise pressing Enter + key is either processed internally by the + control or used for navigation between dialog + controls). + =================== ============================================ +"); + +MustHaveApp(wxBitmapComboBox); + +class wxBitmapComboBox : public wxPyOwnerDrawnComboBox +{ +public: + %pythonAppend wxBitmapComboBox "self._setOORInfo(self);"; + %pythonAppend wxBitmapComboBox() ""; + + DocCtorStr( + wxBitmapComboBox(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxPyEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxArrayString& choices = wxPyEmptyStringArray, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapComboBoxNameStr), + "Standard constructor", ""); + + DocCtorStrName(wxBitmapComboBox(), + "2-phase create constructor.", "", + PreBitmapComboBox); + + DocDeclStr( + bool , Create(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxPyEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxArrayString& choices = wxPyEmptyStringArray, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapComboBoxNameStr), + "Create the UI object, and other initialization.", ""); + + + + %extend { + DocStr(Append, + "Adds the item to the control, associating the given data with the item +if not None. The return value is the index of the newly added item.", ""); + int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap, PyObject* clientData=NULL) { + if (clientData) { + wxPyClientData* data = new wxPyClientData(clientData); + return self->Append(item, bitmap, data); + } else + return self->Append(item, bitmap); + } + } + + + DocDeclStr( + virtual wxBitmap , GetItemBitmap(/*unsigned*/ int n) const, + "Returns the image of the item with the given index.", ""); + + + %extend { + DocStr(Insert, + "Insert an item into the control before the item at the ``pos`` index, +optionally associating some data object with the item.", ""); + int Insert(const wxString& item, const wxBitmap& bitmap, + /*unsigned*/ int pos, PyObject* clientData=NULL) { + if (clientData) { + wxPyClientData* data = new wxPyClientData(clientData); + return self->Insert(item, bitmap, pos, data); + } else + return self->Insert(item, bitmap, pos); + } + } + + + DocDeclStr( + virtual void , SetItemBitmap(/*unsigned*/ int n, const wxBitmap& bitmap), + "Sets the image for the given item.", ""); + + + DocDeclStr( + virtual wxSize , GetBitmapSize() const, + "Returns size of the image used in list.", ""); + + +}; //---------------------------------------------------------------------------