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