added missing DeleteItem(long itemId) function
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@182 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -123,9 +123,7 @@ enum {
|
||||
|
||||
class WXDLLEXPORT wxTreeItem: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeItem)
|
||||
|
||||
public:
|
||||
public:
|
||||
long m_mask;
|
||||
long m_itemId;
|
||||
long m_state;
|
||||
@@ -136,9 +134,9 @@ class WXDLLEXPORT wxTreeItem: public wxObject
|
||||
int m_children;
|
||||
long m_data;
|
||||
|
||||
wxTreeItem(void);
|
||||
wxTreeItem();
|
||||
|
||||
// Accessors
|
||||
// Accessors
|
||||
inline long GetMask() const { return m_mask; }
|
||||
inline long GetItemId() const { return m_itemId; }
|
||||
inline long GetState() const { return m_state; }
|
||||
@@ -158,6 +156,8 @@ class WXDLLEXPORT wxTreeItem: public wxObject
|
||||
inline void SetSelectedImage(int selImage) { m_selectedImage = selImage; }
|
||||
inline void SetChildren(int children) { m_children = children; }
|
||||
inline void SetData(long data) { m_data = data; }
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeItem)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -218,18 +218,18 @@ class WXDLLEXPORT wxGenericTreeItem: public wxTreeItem
|
||||
wxGenericTreeItem *m_parent;
|
||||
bool m_hasHilight;
|
||||
|
||||
wxGenericTreeItem(void) {};
|
||||
wxGenericTreeItem() {};
|
||||
wxGenericTreeItem( wxGenericTreeItem *parent );
|
||||
wxGenericTreeItem( wxGenericTreeItem *parent, const wxTreeItem& item, wxDC *dc );
|
||||
void SetItem( const wxTreeItem &item, wxDC *dc );
|
||||
void SetText( const wxString &text, wxDC *dc );
|
||||
void Reset(void);
|
||||
void Reset();
|
||||
void GetItem( wxTreeItem &item ) const;
|
||||
void AddChild( const wxTreeItem &item );
|
||||
bool HasChildren(void);
|
||||
bool HasPlus(void);
|
||||
int NumberOfVisibleDescendents(void);
|
||||
int NumberOfVisibleChildren(void);
|
||||
bool HasChildren();
|
||||
bool HasPlus();
|
||||
int NumberOfVisibleDescendents();
|
||||
int NumberOfVisibleChildren();
|
||||
wxGenericTreeItem *FindItem( long itemId ) const;
|
||||
void AddChild( wxGenericTreeItem *child );
|
||||
void SetCross( int x, int y );
|
||||
@@ -242,7 +242,7 @@ class WXDLLEXPORT wxGenericTreeItem: public wxTreeItem
|
||||
void SendExpand( wxWindow *target );
|
||||
void SendCollapse( wxWindow *target );
|
||||
void SetHilight( bool set = TRUE );
|
||||
bool HasHilight(void);
|
||||
bool HasHilight();
|
||||
bool IsExpanded() const { return !m_isCollapsed; }
|
||||
};
|
||||
|
||||
@@ -252,47 +252,46 @@ class WXDLLEXPORT wxGenericTreeItem: public wxTreeItem
|
||||
|
||||
class wxTreeCtrl: public wxScrolledWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
|
||||
|
||||
public:
|
||||
|
||||
wxTreeCtrl(void);
|
||||
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||
public:
|
||||
wxTreeCtrl();
|
||||
wxTreeCtrl(wxWindow *parent, const wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_HAS_BUTTONS,
|
||||
const wxString& name = "wxTreeCtrl" );
|
||||
~wxTreeCtrl(void);
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||
~wxTreeCtrl();
|
||||
bool Create(wxWindow *parent, const wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_HAS_BUTTONS,
|
||||
const wxString& name = "wxTreeCtrl");
|
||||
|
||||
int GetCount(void) const;
|
||||
int GetCount() const;
|
||||
long InsertItem( long parent, const wxString& label, int image = -1,
|
||||
int selImage = -1, long insertAfter = wxTREE_INSERT_LAST );
|
||||
long InsertItem( long parent, wxTreeItem &info, long insertAfter = wxTREE_INSERT_LAST );
|
||||
bool DeleteAllItems(void);
|
||||
long InsertItem( long parent, wxTreeItem &info,
|
||||
long insertAfter = wxTREE_INSERT_LAST );
|
||||
void DeleteItem( long item );
|
||||
bool DeleteAllItems();
|
||||
bool ExpandItem( long item, int action );
|
||||
bool GetItem( wxTreeItem &info ) const;
|
||||
long GetItemData( long item ) const;
|
||||
wxString GetItemText( long item ) const;
|
||||
int GetItemImage(long item) const;
|
||||
long GetParent( long item ) const;
|
||||
long GetRootItem(void) const;
|
||||
long GetSelection(void) const;
|
||||
long GetRootItem() const;
|
||||
long GetSelection() const;
|
||||
bool SelectItem( long item ) const;
|
||||
bool ItemHasChildren( long item ) const;
|
||||
void SetIndent( int indent );
|
||||
int GetIndent(void) const;
|
||||
int GetIndent() const;
|
||||
bool SetItem( wxTreeItem &info );
|
||||
bool SetItemData( long item, long data );
|
||||
bool SetItemText( long item, const wxString &text );
|
||||
void SetItemImage(long item, int image, int imageSel) const;
|
||||
long HitTest( const wxPoint& point, int &flags );
|
||||
|
||||
void AdjustMyScrollbars(void);
|
||||
void AdjustMyScrollbars();
|
||||
void PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level, int &y );
|
||||
void OnPaint( const wxPaintEvent &event );
|
||||
void OnSetFocus( const wxFocusEvent &event );
|
||||
@@ -303,8 +302,7 @@ class wxTreeCtrl: public wxScrolledWindow
|
||||
void SetImageList(wxImageList *imageList) { m_imageList = imageList; }
|
||||
wxImageList *GetImageList() const { return m_imageList; }
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
wxGenericTreeItem *m_anchor;
|
||||
wxGenericTreeItem *m_current;
|
||||
bool m_hasFocus;
|
||||
@@ -319,11 +317,12 @@ class wxTreeCtrl: public wxScrolledWindow
|
||||
wxImageList *m_imageList;
|
||||
|
||||
void CalculateLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level, int &y );
|
||||
void CalculatePositions(void);
|
||||
void CalculatePositions();
|
||||
wxGenericTreeItem *FindItem( long itemId ) const;
|
||||
void RefreshLine( wxGenericTreeItem *item );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -627,6 +627,14 @@ bool wxTreeCtrl::ExpandItem( long item, int action )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxTreeCtrl::DeleteItem( long item )
|
||||
{
|
||||
wxGenericTreeItem *pItem = FindItem( item );
|
||||
wxCHECK_RET( pItem != NULL, "wxTreeCtrl::DeleteItem: no such pItem." );
|
||||
pItem->m_parent->m_children.DeleteObject(pItem);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
bool wxTreeCtrl::DeleteAllItems()
|
||||
{
|
||||
delete m_anchor;
|
||||
|
Reference in New Issue
Block a user