X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1b8c7ba607a15a2ff8a04448138df9ffff7df6c5..065fa541eb40024e105321c072143eee3da3b1ee:/wxPython/src/_listctrl.i diff --git a/wxPython/src/_listctrl.i b/wxPython/src/_listctrl.i index 0d3269c53f..00b88bb0f5 100644 --- a/wxPython/src/_listctrl.i +++ b/wxPython/src/_listctrl.i @@ -19,7 +19,7 @@ #include %} -MAKE_CONST_WXSTRING2(ListCtrlNameStr, _T("wxListCtrl")); +MAKE_CONST_WXSTRING(ListCtrlNameStr); //--------------------------------------------------------------------------- %newgroup @@ -84,6 +84,9 @@ enum { wxLIST_HITTEST_TOLEFT, wxLIST_HITTEST_TORIGHT, wxLIST_HITTEST_ONITEM, + +// GetSubItemRect constants + wxLIST_GETSUBITEMRECT_WHOLEITEM, }; @@ -153,7 +156,7 @@ public: wxListItemAttr(const wxColour& colText = wxNullColour, const wxColour& colBack = wxNullColour, const wxFont& font = wxNullFont); - + ~wxListItemAttr(); // setters void SetTextColour(const wxColour& colText); @@ -169,6 +172,9 @@ public: wxColour GetBackgroundColour(); wxFont GetFont(); + void AssignFrom(const wxListItemAttr& source); + + %pythonAppend Destroy "args[0].thisown = 0" %extend { void Destroy() { delete self; } } }; @@ -288,8 +294,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,7 +309,11 @@ public: %constant wxEventType wxEVT_COMMAND_LIST_COL_END_DRAG; %constant wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED; - +// WXWIN_COMPATIBILITY_2_4 +#if 0 +%constant wxEventType wxEVT_COMMAND_LIST_GET_INFO; +%constant wxEventType wxEVT_COMMAND_LIST_SET_INFO; +#endif %pythoncode { @@ -315,8 +323,10 @@ EVT_LIST_BEGIN_LABEL_EDIT = wx.PyEventBinder(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDI EVT_LIST_END_LABEL_EDIT = wx.PyEventBinder(wxEVT_COMMAND_LIST_END_LABEL_EDIT , 1) EVT_LIST_DELETE_ITEM = wx.PyEventBinder(wxEVT_COMMAND_LIST_DELETE_ITEM , 1) EVT_LIST_DELETE_ALL_ITEMS = wx.PyEventBinder(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS , 1) -EVT_LIST_GET_INFO = wx.PyEventBinder(wxEVT_COMMAND_LIST_GET_INFO , 1) -EVT_LIST_SET_INFO = wx.PyEventBinder(wxEVT_COMMAND_LIST_SET_INFO , 1) +#WXWIN_COMPATIBILITY_2_4 +#EVT_LIST_GET_INFO = wx.PyEventBinder(wxEVT_COMMAND_LIST_GET_INFO , 1) +#EVT_LIST_SET_INFO = wx.PyEventBinder(wxEVT_COMMAND_LIST_SET_INFO , 1) +#END WXWIN_COMPATIBILITY_2_4 EVT_LIST_ITEM_SELECTED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_SELECTED , 1) EVT_LIST_ITEM_DESELECTED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_DESELECTED , 1) EVT_LIST_KEY_DOWN = wx.PyEventBinder(wxEVT_COMMAND_LIST_KEY_DOWN , 1) @@ -332,8 +342,9 @@ EVT_LIST_COL_DRAGGING = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_DRAGGING 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) +#WXWIN_COMPATIBILITY_2_4 +#EVT_LIST_GET_INFO = wx._deprecated(EVT_LIST_GET_INFO) +#EVT_LIST_SET_INFO = wx._deprecated(EVT_LIST_SET_INFO) } //--------------------------------------------------------------------------- @@ -344,7 +355,7 @@ EVT_LIST_SET_INFO = wx._deprecated(EVT_LIST_SET_INFO) static int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) { int retval = 0; PyObject* func = (PyObject*)funcPtr; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* args = Py_BuildValue("(ii)", item1, item2); PyObject* result = PyEval_CallObject(func, args); @@ -363,7 +374,7 @@ EVT_LIST_SET_INFO = wx._deprecated(EVT_LIST_SET_INFO) %{ // C++ Version of a Python aware class class wxPyListCtrl : public wxListCtrl { - DECLARE_ABSTRACT_CLASS(wxPyListCtrl); + DECLARE_ABSTRACT_CLASS(wxPyListCtrl) public: wxPyListCtrl() : wxListCtrl() {} wxPyListCtrl(wxWindow* parent, wxWindowID id, @@ -388,6 +399,7 @@ public: // use the virtual version to avoid a confusing assert in the base class DEC_PYCALLBACK_INT_LONG_virtual(OnGetItemImage); + DEC_PYCALLBACK_INT_LONGLONG(OnGetItemColumnImage); PYPRIVATE; }; @@ -397,7 +409,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxPyListCtrl, wxListCtrl); IMP_PYCALLBACK_STRING_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemText); IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr); IMP_PYCALLBACK_INT_LONG_virtual(wxPyListCtrl, wxListCtrl, OnGetItemImage); - +IMP_PYCALLBACK_INT_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemColumnImage); + %} @@ -473,10 +486,8 @@ 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; -#endif // Gets information about the item %pythonAppend GetItem "if val is not None: val.thisown = 1"; // %newobject doesn't work with OOR typemap @@ -505,6 +516,7 @@ public: // Sets the item image bool SetItemImage(long item, int image, int selImage=-1) ; + bool SetItemColumnImage( long item, long column, int image ); // Gets the item text wxString GetItemText(long item) const ; @@ -535,6 +547,13 @@ public: self->GetItemRect(item, rect, code); return rect; } + +// MSW only so far... +// wxRect GetSubItemRect(long item, long subItem, int code = wxLIST_RECT_BOUNDS) { +// wxRect rect; +// self->GetSubItemRect(item, subItem, rect, code); +// return rect; +// } } @@ -549,9 +568,11 @@ public: // get the horizontal and vertical components of the item spacing wxSize GetItemSpacing() const; + %pythoncode { GetItemSpacing = wx._deprecated(GetItemSpacing) } #ifndef __WXMSW__ void SetItemSpacing( int spacing, bool isSmall = false ); + %pythoncode { SetItemSpacing = wx._deprecated(SetItemSpacing) } #endif // Gets the number of selected items in the list control @@ -585,11 +606,9 @@ public: // Sets the image list void SetImageList(wxImageList *imageList, int which); - // is there a way to tell SWIG to disown this??? - - %apply SWIGTYPE *DISOWN { wxImageList *imageList }; + %disownarg( wxImageList *imageList ); void AssignImageList(wxImageList *imageList, int which); - %clear wxImageList *imageList; + %cleardisown( wxImageList *imageList ); // are we in report mode? bool InReportView() const; @@ -649,23 +668,36 @@ public: long, HitTest(const wxPoint& point, int& OUTPUT), "HitTest(Point point) -> (item, where)", "Determines which item (if any) is at the specified point, giving -details in the second return value (see wxLIST_HITTEST_... flags.)", ""); +details in the second return value (see wx.LIST_HITTEST flags.)", ""); + + DocDeclAStrName( + long, HitTest(const wxPoint& point, int& OUTPUT, long* OUTPUT), + "HitTestSubItem(Point point) -> (item, where, subItem)", + "Determines which item (if any) is at the specified point, giving details in +the second return value (see wx.LIST_HITTEST flags) and also the subItem, if +any.", "", + HitTestSubItem); + // Inserts an item, returning the index of the new item if successful, // -1 otherwise. long InsertItem(wxListItem& info); // Insert a string item - %Rename(InsertStringItem, long, InsertItem(long index, const wxString& label)); + %Rename(InsertStringItem, + long, InsertItem(long index, const wxString& label, int imageIndex=-1)); // Insert an image item - %Rename(InsertImageItem, long, InsertItem(long index, int imageIndex)); + %Rename(InsertImageItem, + long, InsertItem(long index, int imageIndex)); // Insert an image/string item - %Rename(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. - %Rename(InsertColumnInfo, long, InsertColumn(long col, wxListItem& info)); + %Rename(InsertColumnItem, long, InsertColumn(long col, wxListItem& info)); + %pythoncode { InsertColumnInfo = InsertColumnItem } long InsertColumn(long col, const wxString& heading, @@ -687,6 +719,9 @@ details in the second return value (see wxLIST_HITTEST_... flags.)", ""); void SetItemBackgroundColour( long item, const wxColour &col); wxColour GetItemBackgroundColour( long item ) const; + // Font of an item. + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; %pythoncode { %# @@ -716,7 +751,7 @@ details in the second return value (see wxLIST_HITTEST_... flags.)", ""); def IsSelected(self, idx): '''return True if the item is selected''' - return self.GetItemState(idx, wx.LIST_STATE_SELECTED) != 0 + return (self.GetItemState(idx, wx.LIST_STATE_SELECTED) & wx.LIST_STATE_SELECTED) != 0 def SetColumnImage(self, col, image): item = self.GetColumn(col)