X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/174051f6139a05e5bc5a2ba101534a4742e3afb1..42f8298f6f42d5d63bb3caf65682b7d9d9f8b702:/wxPython/src/_listctrl.i diff --git a/wxPython/src/_listctrl.i b/wxPython/src/_listctrl.i index c1619a8708..48a9f0ac31 100644 --- a/wxPython/src/_listctrl.i +++ b/wxPython/src/_listctrl.i @@ -17,9 +17,9 @@ %{ #include - %} -MAKE_CONST_WXSTRING2(ListCtrlNameStr, _T("wxListCtrl")); + +MAKE_CONST_WXSTRING(ListCtrlNameStr); //--------------------------------------------------------------------------- %newgroup @@ -288,8 +288,6 @@ public: %constant wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT; %constant wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM; %constant wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; -%constant wxEventType wxEVT_COMMAND_LIST_GET_INFO; -%constant wxEventType wxEVT_COMMAND_LIST_SET_INFO; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED; %constant wxEventType wxEVT_COMMAND_LIST_KEY_DOWN; @@ -305,6 +303,9 @@ public: %constant wxEventType wxEVT_COMMAND_LIST_COL_END_DRAG; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED; +// WXWIN_COMPATIBILITY_2_4 +%constant wxEventType wxEVT_COMMAND_LIST_GET_INFO; +%constant wxEventType wxEVT_COMMAND_LIST_SET_INFO; %pythoncode { @@ -331,6 +332,9 @@ EVT_LIST_COL_BEGIN_DRAG = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG EVT_LIST_COL_DRAGGING = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_DRAGGING , 1) EVT_LIST_COL_END_DRAG = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_END_DRAG , 1) EVT_LIST_ITEM_FOCUSED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_FOCUSED , 1) + +EVT_LIST_GET_INFO = wx._deprecated(EVT_LIST_GET_INFO) +EVT_LIST_SET_INFO = wx._deprecated(EVT_LIST_SET_INFO) } //--------------------------------------------------------------------------- @@ -381,36 +385,42 @@ public: } DEC_PYCALLBACK_STRING_LONGLONG(OnGetItemText); - DEC_PYCALLBACK_INT_LONG(OnGetItemImage); DEC_PYCALLBACK_LISTATTR_LONG(OnGetItemAttr); + // use the virtual version to avoid a confusing assert in the base class + DEC_PYCALLBACK_INT_LONG_virtual(OnGetItemImage); + PYPRIVATE; }; IMPLEMENT_ABSTRACT_CLASS(wxPyListCtrl, wxListCtrl); IMP_PYCALLBACK_STRING_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemText); -IMP_PYCALLBACK_INT_LONG(wxPyListCtrl, wxListCtrl, OnGetItemImage); IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr); +IMP_PYCALLBACK_INT_LONG_virtual(wxPyListCtrl, wxListCtrl, OnGetItemImage); + %} -%name(ListCtrl)class wxPyListCtrl : public wxControl { +MustHaveApp(wxPyListCtrl); + +%rename(ListCtrl) wxPyListCtrl; +class wxPyListCtrl : public wxControl { public: %pythonAppend wxPyListCtrl "self._setOORInfo(self);self._setCallbackInfo(self, ListCtrl)" %pythonAppend wxPyListCtrl() "" - + wxPyListCtrl(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyListCtrlNameStr); - %name(PreListCtrl)wxPyListCtrl(); + %RenameCtor(PreListCtrl, wxPyListCtrl()); bool Create(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, @@ -421,7 +431,7 @@ public: void _setCallbackInfo(PyObject* self, PyObject* _class); - + // Set the control colours bool SetForegroundColour(const wxColour& col); bool SetBackgroundColour(const wxColour& col); @@ -463,7 +473,7 @@ public: // return the total area occupied by all the items (icon/small icon only) wxRect GetViewRect() const; - + #ifdef __WXMSW__ // Gets the edit control for editing labels. wxTextCtrl* GetEditControl() const; @@ -486,7 +496,7 @@ public: bool SetItem(wxListItem& info) ; // Sets a string field at a particular column - %name(SetStringItem)long SetItem(long index, int col, const wxString& label, int imageId = -1); + %Rename(SetStringItem, long, SetItem(long index, int col, const wxString& label, int imageId = -1)); // Gets the item state int GetItemState(long item, long stateMask) const ; @@ -495,7 +505,7 @@ public: bool SetItemState(long item, long state, long stateMask) ; // Sets the item image - bool SetItemImage(long item, int image, int selImage) ; + bool SetItemImage(long item, int image, int selImage=-1) ; // Gets the item text wxString GetItemText(long item) const ; @@ -542,7 +552,7 @@ public: wxSize GetItemSpacing() const; #ifndef __WXMSW__ - void SetItemSpacing( int spacing, bool isSmall = False ); + void SetItemSpacing( int spacing, bool isSmall = false ); #endif // Gets the number of selected items in the list control @@ -559,7 +569,7 @@ public: long GetTopItem() const ; // Add or remove a single window style - void SetSingleStyle(long style, bool add = True) ; + void SetSingleStyle(long style, bool add = true) ; // Set the whole window style void SetWindowStyleFlag(long style) ; @@ -581,10 +591,10 @@ public: %apply SWIGTYPE *DISOWN { wxImageList *imageList }; void AssignImageList(wxImageList *imageList, int which); %clear wxImageList *imageList; - + // are we in report mode? bool InReportView() const; - + // returns True if it is a virtual list control bool IsVirtual() const; @@ -625,38 +635,38 @@ public: // Find an item whose label matches this string, starting from the item after 'start' // or the beginning if 'start' is -1. - long FindItem(long start, const wxString& str, bool partial = False); + long FindItem(long start, const wxString& str, bool partial = false); // Find an item whose data matches this data, starting from the item after 'start' // or the beginning if 'start' is -1. - %name(FindItemData) long FindItem(long start, long data); + %Rename(FindItemData, long, FindItem(long start, long data)); // Find an item nearest this position in the specified direction, starting from // the item after 'start' or the beginning if 'start' is -1. - %name(FindItemAtPos) long FindItem(long start, const wxPoint& pt, int direction); + %Rename(FindItemAtPos, long, FindItem(long start, const wxPoint& pt, int direction)); DocDeclAStr( long, HitTest(const wxPoint& point, int& OUTPUT), "HitTest(Point point) -> (item, where)", - "Determines which item (if any) is at the specified point,\n" - "giving details in the second return value (see wxLIST_HITTEST_... flags.)"); + "Determines which item (if any) is at the specified point, giving +details in the second return value (see wx.LIST_HITTEST flags.)", ""); // Inserts an item, returning the index of the new item if successful, // -1 otherwise. long InsertItem(wxListItem& info); // Insert a string item - %name(InsertStringItem) long InsertItem(long index, const wxString& label); + %Rename(InsertStringItem, long, InsertItem(long index, const wxString& label)); // Insert an image item - %name(InsertImageItem) long InsertItem(long index, int imageIndex); + %Rename(InsertImageItem, long, InsertItem(long index, int imageIndex)); // Insert an image/string item - %name(InsertImageStringItem) long InsertItem(long index, const wxString& label, int imageIndex); + %Rename(InsertImageStringItem, long, InsertItem(long index, const wxString& label, int imageIndex)); // For list view mode (only), inserts a column. - %name(InsertColumnInfo) long InsertColumn(long col, wxListItem& info); + %Rename(InsertColumnInfo, long, InsertColumn(long col, wxListItem& info)); long InsertColumn(long col, const wxString& heading, @@ -752,7 +762,7 @@ public: // or zero if the two items are equivalent. bool SortItems(PyObject* func) { if (!PyCallable_Check(func)) - return False; + return false; return self->SortItems((wxListCtrlCompare)wxPyListCtrl_SortItems, (long)func); } } @@ -778,6 +788,8 @@ public: %newgroup +MustHaveApp(wxListView); + // wxListView: a class which provides a little better API for list control class wxListView : public wxPyListCtrl { @@ -792,7 +804,7 @@ public: long style = wxLC_REPORT, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyListCtrlNameStr); - %name(PreListView)wxListView(); + %RenameCtor(PreListView, wxListView()); bool Create( wxWindow *parent, wxWindowID id = -1, @@ -803,7 +815,7 @@ public: const wxString& name = wxPyListCtrlNameStr); // [de]select an item - void Select(long n, bool on = True); + void Select(long n, bool on = true); // focus and show the given item void Focus(long index);