X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..59455c67d444c12f6d6a59e0c16528554c8b4c30:/wxPython/src/_treectrl.i diff --git a/wxPython/src/_treectrl.i b/wxPython/src/_treectrl.i index d0076c526e..1fac4850c1 100644 --- a/wxPython/src/_treectrl.i +++ b/wxPython/src/_treectrl.i @@ -18,10 +18,9 @@ %{ #include #include "wx/wxPython/pytree.h" - - const wxChar* wx_TreeCtrlNameStr = _T("wxTreeCtrl"); - DECLARE_DEF_STRING(_TreeCtrlNameStr); %} + +MAKE_CONST_WXSTRING2(TreeCtrlNameStr, _T("wxTreeCtrl")); //--------------------------------------------------------------------------- %newgroup @@ -99,12 +98,12 @@ public: %extend { bool operator==(const wxTreeItemId* other) { - if (!other) return false; + if (!other) return False; return *self == *other; } bool operator!=(const wxTreeItemId* other) { - if (!other) return true; + if (!other) return True; return *self != *other; } } @@ -196,7 +195,7 @@ public: %constant wxEventType wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK; %constant wxEventType wxEVT_COMMAND_TREE_END_DRAG; %constant wxEventType wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK; - +%constant wxEventType wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP; %pythoncode { @@ -220,7 +219,7 @@ EVT_TREE_ITEM_RIGHT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLIC EVT_TREE_ITEM_MIDDLE_CLICK = wx.PyEventBinder(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 1) EVT_TREE_END_DRAG = wx.PyEventBinder(wxEVT_COMMAND_TREE_END_DRAG , 1) EVT_TREE_STATE_IMAGE_CLICK = wx.PyEventBinder(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 1) - +EVT_TREE_ITEM_GETTOOLTIP = wx.PyEventBinder(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 1) } @@ -261,6 +260,8 @@ public: bool IsEditCancelled() const; void SetEditCanceled(bool editCancelled); + // Set the tooltip for the item (for EVT_TREE_ITEM_GETTOOLTIP events) + void SetToolTip(const wxString& toolTip); }; //--------------------------------------------------------------------------- @@ -295,8 +296,8 @@ public: bool found; wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { - PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), false); - PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), false); + PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), False); + PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), False); rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",o1,o2)); Py_DECREF(o1); Py_DECREF(o2); @@ -326,7 +327,7 @@ public: const wxSize& size = wxDefaultSize, long style = wxTR_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPy_TreeCtrlNameStr); + const wxString& name = wxPyTreeCtrlNameStr); %name(PreTreeCtrl)wxPyTreeCtrl(); bool Create(wxWindow *parent, wxWindowID id = -1, @@ -334,7 +335,7 @@ public: const wxSize& size = wxDefaultSize, long style = wxTR_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPy_TreeCtrlNameStr); + const wxString& name = wxPyTreeCtrlNameStr); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -451,14 +452,14 @@ public: // allow the user to expand the items which don't have any children now // - but instead add them only when needed, thus minimizing memory // usage and loading time. - void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); + void SetItemHasChildren(const wxTreeItemId& item, bool has = True); // the item will be shown in bold - void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + void SetItemBold(const wxTreeItemId& item, bool bold = True); #ifdef __WXMSW__ // the item will be shown with a drop highlight - void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE); + void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = True); #endif // set the items text colour @@ -487,19 +488,19 @@ public: bool IsBold(const wxTreeItemId& item) const; - // if 'recursively' is FALSE, only immediate children count, otherwise + // if 'recursively' is False, only immediate children count, otherwise // the returned number is the number of all items in this branch size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = TRUE) /*const*/; + bool recursively = True) /*const*/; // get the root tree item - // wxTreeItemId.IsOk() will return FALSE if there is no such item + // wxTreeItemId.IsOk() will return False if there is no such item wxTreeItemId GetRootItem() const; // get the item currently selected - // wxTreeItemId.IsOk() will return FALSE if there is no such item + // wxTreeItemId.IsOk() will return False if there is no such item wxTreeItemId GetSelection() const; %extend { @@ -515,7 +516,7 @@ public: num = self->GetSelections(array); for (x=0; x < num; x++) { wxTreeItemId *tii = new wxTreeItemId(array.Item(x)); - PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), true); + PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), True); PyList_Append(rval, item); } wxPyEndBlockThreads(); @@ -524,7 +525,7 @@ public: } // get the parent of this item - // wxTreeItemId.IsOk() will return FALSE if there is no such item + // wxTreeItemId.IsOk() will return False if there is no such item wxTreeItemId GetItemParent(const wxTreeItemId& item) const; @@ -537,8 +538,8 @@ public: wxTreeItemId ritem = self->GetFirstChild(item, cookie); wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); - PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true)); - PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(cookie, wxT("wxTreeItemIdValue"), true)); + PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), True)); + PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(cookie, wxT("wxTreeItemIdValue"), True)); wxPyEndBlockThreads(); return tup; } @@ -552,8 +553,8 @@ public: wxTreeItemId ritem = self->GetNextChild(item, cookie); wxPyBeginBlockThreads(); PyObject* tup = PyTuple_New(2); - PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true)); - PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(cookie, wxT("wxTreeItemIdValue"), true)); + PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), True)); + PyTuple_SET_ITEM(tup, 1, wxPyConstructObject(cookie, wxT("wxTreeItemIdValue"), True)); wxPyEndBlockThreads(); return tup; } @@ -669,7 +670,7 @@ public: #ifdef __WXMSW__ // end editing and accept or discard the changes to item label - void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE); + void EndEditLabel(const wxTreeItemId& item, bool discardChanges = False); #endif @@ -682,22 +683,23 @@ public: - // determine to which item (if any) belongs the given point (the - // coordinates specified are relative to the client area of tree ctrl) - // and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx - // constants. - // - wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT); + DocDeclAStr( + wxTreeItemId, HitTest(const wxPoint& point, int& OUTPUT), + "HitTest(Point point) -> (item, where)", + "Determine which item (if any) belongs the given point. The\n" + "coordinates specified are relative to the client area of tree ctrl\n" + "and the where return value is set to a bitmask of wxTREE_HITTEST_xxx\n" + "constants.\n"); %extend { // get the bounding rectangle of the item (or of its label only) - PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = FALSE) { + PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = False) { wxRect rect; if (self->GetBoundingRect(item, rect, textOnly)) { wxPyBeginBlockThreads(); wxRect* r = new wxRect(rect); - PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), true); + PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), True); wxPyEndBlockThreads(); return val; }