%{
#include "helpers.h"
+#ifdef __WXMSW__
+#include <windows.h>
+#endif
#include <wx/listctrl.h>
#include <wx/treectrl.h>
%}
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;
}
//----------------------------------------------------------------------
+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:
}
~wxPyTreeItemData() {
-#ifdef WXP_WITH_THREAD
- PyEval_RestoreThread(wxPyEventThreadState);
-#endif
+ bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj);
-#ifdef WXP_WITH_THREAD
- PyEval_SaveThread();
-#endif
+ wxPySaveThread(doSave);
}
PyObject* GetData() {
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);
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;
+ num = self->GetSelections(array);
+ for (x=0; x < num; x++) {
+ PyObject* item = wxPyConstructObject((void*)&array.Item(x),
+ "wxTreeItemId");
+ PyList_Append(rval, item);
+ }
+ wxPySaveThread(doSave);
+ return rval;
+ }
+ }
+
+
size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE);
wxTreeItemId GetFirstVisibleItem();
wxTreeItemId GetNextVisible(const wxTreeItemId& item);
wxTreeItemId GetPrevVisible(const wxTreeItemId& item);
+ wxTreeItemId GetLastChild(const wxTreeItemId& item);
+
wxTreeItemId AddRoot(const wxString& text,
#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);
- // **** And this too
- // wxTreeItemCmpFunc *cmpFunction = NULL);
+ 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)) {
+ 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;
+ }
+ }
+ }
+#endif
%pragma(python) addtoclass = "
# Redefine a couple methods that SWIG gets a bit confused on...