#include "helpers.h"
#include <wx/listctrl.h>
#include <wx/treectrl.h>
-#include <wx/tabctrl.h>
%}
//----------------------------------------------------------------------
%import events.i
%import controls.i
+%pragma(python) code = "import wx"
+
//----------------------------------------------------------------------
%{
class wxListCtrl : public wxControl {
public:
-#ifdef __WXMSW__
wxListCtrl(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxPyDefaultPosition,
const wxSize& size = wxPyDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxPyDefaultValidator,
char* name = "listCtrl");
-#else
- wxListCtrl(wxWindow* parent, wxWindowID id,
- const wxPoint& pos = wxPyDefaultPosition,
- const wxSize& size = wxPyDefaultSize,
- long style = wxLC_ICON,
- char* name = "listctrl");
-#endif
+
+ %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
bool DeleteItem(long item);
bool DeleteAllItems();
bool DeleteColumn(int col);
-#ifdef __WXMSW__
bool DeleteAllColumns(void);
void ClearAll(void);
+#ifdef __WXMSW__
wxTextCtrl* EditLabel(long item);
bool EndEditLabel(bool cancel);
+ wxTextCtrl* GetEditControl();
#endif
bool EnsureVisible(long item);
long FindItem(long start, const wxString& str, bool partial = FALSE);
bool GetColumn(int col, wxListItem& item);
int GetColumnWidth(int col);
int GetCountPerPage();
-#ifdef __WXMSW
- wxTextCtrl* GetEditControl();
-#endif
wxImageList* GetImageList(int which);
long GetItemData(long item);
int GetSelectedItemCount();
#ifdef __WXMSW__
wxColour GetTextColour();
+ void SetTextColour(const wxColour& col);
#endif
long GetTopItem();
long HitTest(const wxPoint& point, int& OUTPUT);
bool SetItemState(long item, long state, long stateMask);
void SetItemText(long item, const wxString& text);
void SetSingleStyle(long style, bool add = TRUE);
-#ifdef __WXMSW__
- void SetTextColour(const wxColour& col);
-#endif
void SetWindowStyleFlag(long style);
// TODO: bool SortItems(wxListCtrlCompare fn, long data);
};
//----------------------------------------------------------------------
-enum {
- wxTREE_MASK_HANDLE,
- wxTREE_MASK_STATE,
- wxTREE_MASK_TEXT,
- wxTREE_MASK_IMAGE,
- wxTREE_MASK_SELECTED_IMAGE,
- wxTREE_MASK_CHILDREN,
- wxTREE_MASK_DATA,
-
- wxTREE_STATE_BOLD,
- wxTREE_STATE_DROPHILITED,
- wxTREE_STATE_EXPANDED,
- wxTREE_STATE_EXPANDEDONCE,
- wxTREE_STATE_FOCUSED,
- wxTREE_STATE_SELECTED,
- wxTREE_STATE_CUT,
-
- 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_ONITEM,
-};
-
-
-enum {
- wxTREE_NEXT_CARET,
- wxTREE_NEXT_CHILD,
- wxTREE_NEXT_DROPHILITE,
- wxTREE_NEXT_FIRSTVISIBLE,
- wxTREE_NEXT_NEXT,
- wxTREE_NEXT_NEXTVISIBLE,
- wxTREE_NEXT_PARENT,
- wxTREE_NEXT_PREVIOUS,
- wxTREE_NEXT_PREVIOUSVISIBLE,
- wxTREE_NEXT_ROOT
-};
-
-enum {
- wxTREE_EXPAND_EXPAND,
- wxTREE_EXPAND_COLLAPSE,
- wxTREE_EXPAND_COLLAPSE_RESET,
- wxTREE_EXPAND_TOGGLE
-};
+class wxTreeItemId {
+public:
+ wxTreeItemId();
+ ~wxTreeItemId();
+ bool IsOk() const { return m_itemId != 0; }
-enum {
- wxTREE_INSERT_LAST,
- wxTREE_INSERT_FIRST,
- wxTREE_INSERT_SORT,
+// %addmethods {
+// long GetId() { return (long)(*self); }
+// }
};
-
-
-
-
-class wxTreeItem {
+// **** This isn't very useful yet. This needs to be specialized to enable
+// derived Python classes...
+class wxTreeItemData {
public:
- long m_mask;
- long m_itemId;
- long m_state;
- long m_stateMask;
- wxString m_text;
- int m_image;
- int m_selectedImage;
- int m_children;
- long m_data;
-
- wxTreeItem();
- ~wxTreeItem();
+ wxTreeItemData();
+ ~wxTreeItemData();
+
+ const wxTreeItemId& GetId();
+ void SetId(const wxTreeItemId& id);
};
-class wxTreeEvent : public wxCommandEvent {
+
+class wxTreeEvent : public wxCommandEvent {
public:
- int m_code;
- wxTreeItem m_item;
- long m_oldItem;
- wxPoint m_pointDrag;
+ wxTreeItemId GetItem();
+ wxTreeItemId GetOldItem();
+ wxPoint GetPoint();
+ int GetCode();
+ void Veto();
};
+// These are for the GetFirstChild/GetNextChild methods below
+%typemap(python, in) long& INOUT = long* INOUT;
+%typemap(python, argout) long& INOUT = long* INOUT;
class wxTreeCtrl : public wxControl {
public:
-#ifdef __WXMSW__
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxPyDefaultPosition,
- const wxSize& size = wxPyDefaultSize,
- long style = wxTR_HAS_BUTTONS,
- const wxValidator& validator = wxPyDefaultValidator,
- char* name = "wxTreeCtrl");
-#else
- wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxPyDefaultPosition,
- const wxSize& size = wxPyDefaultSize,
- long style = wxTR_HAS_BUTTONS,
- char* name = "wxTreeCtrl");
-#endif
-
- bool DeleteAllItems();
-#ifdef __WXMSW__
- bool DeleteItem(long item);
-#else
- void DeleteItem(long item);
-#endif
-#ifdef __WXMSW__
- wxTextCtrl* EditLabel(long item);
- bool EnsureVisible(long item);
- bool ExpandItem(long item, int action);
- long GetChild(long item);
-#endif
- int GetCount();
-#ifdef __WXMSW__
+ const wxPoint& pos = wxPyDefaultPosition,
+ const wxSize& size = wxPyDefaultSize,
+ long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
+ const wxValidator& validator = wxPyDefaultValidator,
+ char* name = "wxTreeCtrl");
+
+ %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
+
+ size_t GetCount();
+ unsigned int GetIndent();
+ void SetIndent(unsigned int indent);
+ wxImageList *GetImageList();
+ wxImageList *GetStateImageList();
+ void SetImageList(wxImageList *imageList);
+ void SetStateImageList(wxImageList *imageList);
+
+ wxString GetItemText(const wxTreeItemId& item);
+ int GetItemImage(const wxTreeItemId& item);
+ int GetItemSelectedImage(const wxTreeItemId& item);
+ wxTreeItemData *GetItemData(const wxTreeItemId& item);
+
+ void SetItemText(const wxTreeItemId& item, const wxString& text);
+ void SetItemImage(const wxTreeItemId& item, int image);
+ void SetItemSelectedImage(const wxTreeItemId& item, int image);
+ void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
+ void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE);
+
+ bool IsVisible(const wxTreeItemId& item);
+ bool ItemHasChildren(const wxTreeItemId& item);
+ bool IsExpanded(const wxTreeItemId& item);
+ bool IsSelected(const wxTreeItemId& item);
+
+ wxTreeItemId GetRootItem();
+ wxTreeItemId GetSelection();
+ wxTreeItemId GetParent(const wxTreeItemId& item);
+
+ wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT);
+ wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT);
+ wxTreeItemId GetNextSibling(const wxTreeItemId& item);
+ wxTreeItemId GetPrevSibling(const wxTreeItemId& item);
+ wxTreeItemId GetFirstVisibleItem();
+ wxTreeItemId GetNextVisible(const wxTreeItemId& item);
+ wxTreeItemId GetPrevVisible(const wxTreeItemId& item);
+
+
+ wxTreeItemId AddRoot(const wxString& text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData *data = NULL);
+ wxTreeItemId PrependItem(const wxTreeItemId& parent,
+ const wxString& text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData *data = NULL);
+ wxTreeItemId InsertItem(const wxTreeItemId& parent,
+ const wxTreeItemId& idPrevious,
+ const wxString& text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData *data = NULL);
+ wxTreeItemId AppendItem(const wxTreeItemId& parent,
+ const wxString& text,
+ int image = -1, int selectedImage = -1,
+ wxTreeItemData *data = NULL);
+
+ void Delete(const wxTreeItemId& item);
+ void DeleteChildren(const wxTreeItemId& item);
+ void DeleteAllItems();
+
+ void Expand(const wxTreeItemId& item);
+ void Collapse(const wxTreeItemId& item);
+ void CollapseAndReset(const wxTreeItemId& item);
+ void Toggle(const wxTreeItemId& item);
+
+ void Unselect();
+ void SelectItem(const wxTreeItemId& item);
+ void EnsureVisible(const wxTreeItemId& item);
+ void ScrollTo(const wxTreeItemId& item);
+
+ wxTextCtrl* EditLabel(const wxTreeItemId& item);
+ // **** figure out how to do this
+ // wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl));
wxTextCtrl* GetEditControl();
- long GetFirstVisibleItem();
-#endif
- wxImageList* GetImageList(int which = wxIMAGE_LIST_NORMAL);
- int GetIndent();
- long GetItemData(long item);
+ void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE);
- %addmethods {
- %new wxTreeItem* GetItem() {
- wxTreeItem* info = new wxTreeItem;
- self->GetItem(*info);
- return info;
- }
-#ifdef __WXMSW__
- %new wxRect* GetItemRect(long item, int textOnly = FALSE) {
- wxRect* rect = new wxRect;
- self->GetItemRect(item, *rect, textOnly);
- return rect;
- }
-#endif
- }
+// void SortChildren(const wxTreeItemId& item);
+ // **** And this too
+ // wxTreeItemCmpFunc *cmpFunction = NULL);
-#ifdef __WXMSW__
- int GetItemState(long item, long stateMask);
-#endif
- wxString GetItemText(long item);
-#ifdef __WXMSW__
- long GetNextItem(long item, int code);
- long GetNextVisibleItem(long item);
-#endif
- long GetParent(long item);
- long GetRootItem();
- long GetSelection();
- long HitTest(const wxPoint& point, int& OUTPUT); // *** check this
- long InsertItem(long parent, wxTreeItem& info,
- long insertAfter = wxTREE_INSERT_LAST);
- %name(InsertItemString)
- long InsertItem(long parent, const wxString& label,
- int image = -1, int selImage = -1,
- long insertAfter = wxTREE_INSERT_LAST);
- bool ItemHasChildren(long item);
-#ifdef __WXMSW__
- bool ScrollTo(long item);
-#endif
- bool SelectItem(long item);
- void SetIndent(int indent);
- void SetImageList(wxImageList* imageList, int which = wxIMAGE_LIST_NORMAL);
- bool SetItem(wxTreeItem& info);
-#ifdef __WXMSW__
- bool SetItemImage(long item, int image, int selImage);
-#else
- void SetItemImage(long item, int image, int selImage);
-#endif
-#ifdef __WXMSW__
- bool SetItemState(long item, long state, long stateMask);
-#endif
- void SetItemText(long item, const wxString& text);
- bool SetItemData(long item, long data);
-#ifdef __WXMSW__
- bool SortChildren(long item);
-#endif
+ void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
+ bool IsBold(const wxTreeItemId& item) const;
+ wxTreeItemId HitTest(const wxPoint& point);
};
+
//----------------------------------------------------------------------
+#ifdef SKIPTHIS
#ifdef __WXMSW__
class wxTabEvent : public wxCommandEvent {
public:
long style = 0,
char* name = "tabCtrl");
+ %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
+
bool DeleteAllItems();
bool DeleteItem(int item);
wxImageList* GetImageList();
};
+#endif
#endif
//----------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
// $Log$
+// Revision 1.14 1999/01/30 07:30:10 RD
+// Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
+//
+// Various cleanup, tweaks, minor additions, etc. to maintain
+// compatibility with the current wxWindows.
+//
+// Revision 1.13 1998/12/17 14:07:34 RR
+//
+// Removed minor differences between wxMSW and wxGTK
+//
+// Revision 1.12 1998/12/16 22:10:52 RD
+//
+// Tweaks needed to be able to build wxPython with wxGTK.
+//
+// Revision 1.11 1998/12/15 20:41:16 RD
+// Changed the import semantics from "from wxPython import *" to "from
+// wxPython.wx import *" This is for people who are worried about
+// namespace pollution, they can use "from wxPython import wx" and then
+// prefix all the wxPython identifiers with "wx."
+//
+// Added wxTaskbarIcon for wxMSW.
+//
+// Made the events work for wxGrid.
+//
+// Added wxConfig.
+//
+// Added wxMiniFrame for wxGTK, (untested.)
+//
+// Changed many of the args and return values that were pointers to gdi
+// objects to references to reflect changes in the wxWindows API.
+//
+// Other assorted fixes and additions.
+//
+// Revision 1.10 1998/11/25 08:45:23 RD
+//
+// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
+// Added events for wxGrid
+// Other various fixes and additions
+//
+// Revision 1.9 1998/11/16 00:00:54 RD
+// Generic treectrl for wxPython/GTK compiles...
+//
+// Revision 1.8 1998/11/11 04:40:20 RD
+// wxTreeCtrl now works (sort of) for wxPython-GTK. This is the new
+// TreeCtrl in src/gtk/treectrl.cpp not the old generic one.
+//
+// Revision 1.7 1998/11/11 03:12:25 RD
+//
+// Additions for wxTreeCtrl
+//
+// Revision 1.6 1998/10/20 06:43:55 RD
+// New wxTreeCtrl wrappers (untested)
+// some changes in helpers
+// etc.
+//
+// Revision 1.5 1998/10/07 07:34:33 RD
+// Version 0.4.1 for wxGTK
+//
+// Revision 1.4 1998/10/02 06:40:36 RD
+//
+// Version 0.4 of wxPython for MSW.
+//
// Revision 1.3 1998/08/18 19:48:15 RD
// more wxGTK compatibility things.
//