%{
#include <wx/treectrl.h>
#include "wx/wxPython/pytree.h"
-
- const wxChar* wx_TreeCtrlNameStr = _T("wxTreeCtrl");
- DECLARE_DEF_STRING(_TreeCtrlNameStr);
%}
+
+MAKE_CONST_WXSTRING2(TreeCtrlNameStr, _T("wxTreeCtrl"));
//---------------------------------------------------------------------------
%newgroup
%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;
}
}
%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 {
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)
}
bool IsEditCancelled() const;
void SetEditCanceled(bool editCancelled);
+ // Set the tooltip for the item (for EVT_TREE_ITEM_GETTOOLTIP events)
+ void SetToolTip(const wxString& toolTip);
};
//---------------------------------------------------------------------------
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);
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,
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);
// 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
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 {
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();
}
// 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;
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;
}
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;
}
#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
- // 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;
}