X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/761a9d2b1fea5a7e04199f68a9da7cea06310d77..5bee458a0f61063fc142a50012261d8ac2c32e5a:/utils/wxPython/src/controls2.i diff --git a/utils/wxPython/src/controls2.i b/utils/wxPython/src/controls2.i index 7074cf2335..d6c263814c 100644 --- a/utils/wxPython/src/controls2.i +++ b/utils/wxPython/src/controls2.i @@ -14,6 +14,9 @@ %{ #include "helpers.h" +#ifdef __WXMSW__ +#include +#endif #include #include %} @@ -158,9 +161,11 @@ public: long GetItemData(long item); %addmethods { - %new wxListItem* GetItem(long itemId) { + %new wxListItem* GetItem(long itemId, int col=0) { wxListItem* info = new wxListItem; info->m_itemId = itemId; + info->m_col = col; + info->m_mask = 0xFFFF; self->GetItem(*info); return info; } @@ -225,6 +230,34 @@ public: //---------------------------------------------------------------------- +enum wxTreeItemIcon +{ + wxTreeItemIcon_Normal, // not selected, not expanded + wxTreeItemIcon_Selected, // selected, not expanded + wxTreeItemIcon_Expanded, // not selected, expanded + wxTreeItemIcon_SelectedExpanded, // selected, expanded + wxTreeItemIcon_Max +}; + + +// constants for HitTest +enum { + wxTREE_HITTEST_ABOVE, + wxTREE_HITTEST_BELOW, + wxTREE_HITTEST_NOWHERE, + wxTREE_HITTEST_ONITEMBUTTON, + wxTREE_HITTEST_ONITEMICON, + wxTREE_HITTEST_ONITEMINDENT, + wxTREE_HITTEST_ONITEMLABEL, + wxTREE_HITTEST_ONITEMRIGHT, + wxTREE_HITTEST_ONITEMSTATEICON, + wxTREE_HITTEST_TOLEFT, + wxTREE_HITTEST_TORIGHT, + wxTREE_HITTEST_ONITEMUPPERPART, + wxTREE_HITTEST_ONITEMLOWERPART, + wxTREE_HITTEST_ONITEM +}; + class wxTreeItemId { public: @@ -313,15 +346,20 @@ public: void SetIndent(unsigned int indent); wxImageList *GetImageList(); wxImageList *GetStateImageList(); - void SetImageList(wxImageList *imageList); + void SetImageList(wxImageList *imageList/*, int which = wxIMAGE_LIST_NORMAL*/); void SetStateImageList(wxImageList *imageList); + unsigned int GetSpacing(); + void SetSpacing(unsigned int spacing); + wxString GetItemText(const wxTreeItemId& item); - int GetItemImage(const wxTreeItemId& item); + int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal); int GetItemSelectedImage(const wxTreeItemId& item); void SetItemText(const wxTreeItemId& item, const wxString& text); - void SetItemImage(const wxTreeItemId& item, int image); + void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); void SetItemSelectedImage(const wxTreeItemId& item, int image); void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE); @@ -370,10 +408,11 @@ public: wxTreeItemId GetRootItem(); wxTreeItemId GetSelection(); - wxTreeItemId GetParent(const wxTreeItemId& item); + %name(GetItemParent) wxTreeItemId GetParent(const wxTreeItemId& item); //size_t GetSelections(wxArrayTreeItemIds& selection); %addmethods { PyObject* GetSelections() { + bool doSave = wxPyRestoreThread(); PyObject* rval = PyList_New(0); wxArrayTreeItemIds array; size_t num, x; @@ -383,6 +422,7 @@ public: "wxTreeItemId"); PyList_Append(rval, item); } + wxPySaveThread(doSave); return rval; } } @@ -436,24 +476,35 @@ public: #ifdef __WXMSW__ wxTextCtrl* EditLabel(const wxTreeItemId& item); wxTextCtrl* GetEditControl(); - void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE); + void EndEditLabel(const wxTreeItemId& item, int discardChanges = FALSE); #else void EditLabel(const wxTreeItemId& item); #endif void SortChildren(const wxTreeItemId& item); - void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + void SetItemBold(const wxTreeItemId& item, int bold = TRUE); bool IsBold(const wxTreeItemId& item) const; - wxTreeItemId HitTest(const wxPoint& point); + wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT); + + void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); + void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); + void SetItemFont(const wxTreeItemId& item, const wxFont& font); #ifdef __WXMSW__ + void SetItemDropHighlight(const wxTreeItemId& item, int highlight = TRUE); + //bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, int textOnly = FALSE) %addmethods { PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) { wxRect rect; - if (self->GetBoundingRect(item, rect, textOnly)) - return wxPyConstructObject((void*)&rect, "wxRect"); + if (self->GetBoundingRect(item, rect, textOnly)) { + bool doSave = wxPyRestoreThread(); + wxRect* r = new wxRect(rect); + PyObject* val = wxPyConstructObject((void*)r, "wxRect"); + wxPySaveThread(doSave); + return val; + } else { Py_INCREF(Py_None); return Py_None;