Added wxTreeCtrl::GetItemParent to deprecate GetParent.
Moved GetParent into WX_COMPAT_2_2 and exposed base GetParent in that case too. Replaced all lib/sample uses of wxTC::GetParent with GetItemParent. Updated docs to suit. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
01a4679360
commit
99006e446e
@ -8,6 +8,9 @@
|
||||
#include <wx/ffile.h>
|
||||
#include "wx/resource.h"
|
||||
|
||||
#if !wxUSE_WX_RESOURCES
|
||||
#error "convertc requires wxUSE_WX_RESOURCES"
|
||||
#endif // wxUSE_WX_RESOURCES
|
||||
|
||||
class wxr2xml : public wxObject
|
||||
{
|
||||
|
@ -492,14 +492,14 @@ void EditorFrame::OnTreeSel(wxTreeEvent& event)
|
||||
if (node)
|
||||
PropertiesFrame::Get()->ShowProps(node);
|
||||
|
||||
if (m_TreeCtrl->GetParent(event.GetItem()) == m_TreeCtrl->GetRootItem())
|
||||
if (m_TreeCtrl->GetItemParent(event.GetItem()) == m_TreeCtrl->GetRootItem())
|
||||
{
|
||||
wxTreeItemId it = event.GetOldItem();
|
||||
|
||||
if (it.IsOk() && m_TreeCtrl->GetRootItem() != it)
|
||||
{
|
||||
while (m_TreeCtrl->GetParent(it) != m_TreeCtrl->GetRootItem())
|
||||
it = m_TreeCtrl->GetParent(it);
|
||||
while (m_TreeCtrl->GetItemParent(it) != m_TreeCtrl->GetRootItem())
|
||||
it = m_TreeCtrl->GetItemParent(it);
|
||||
m_TreeCtrl->Collapse(it);
|
||||
}
|
||||
RecursivelyExpand(m_TreeCtrl, event.GetItem());
|
||||
@ -567,7 +567,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event)
|
||||
void EditorFrame::DeleteSelectedNode()
|
||||
{
|
||||
XmlTreeData *dt = (XmlTreeData*)
|
||||
(m_TreeCtrl->GetItemData(m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
|
||||
(m_TreeCtrl->GetItemData(m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
|
||||
wxXmlNode *n = (dt) ? dt->Node : NULL;
|
||||
|
||||
m_SelectedNode->GetParent()->RemoveChild(m_SelectedNode);
|
||||
@ -583,7 +583,7 @@ void EditorFrame::OnNewNode(wxCommandEvent& event)
|
||||
{
|
||||
XmlTreeData *pardt =
|
||||
(XmlTreeData*)(m_TreeCtrl->GetItemData(
|
||||
m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
|
||||
m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
|
||||
|
||||
if (pardt && pardt->Node && pardt->Node != m_Resource->GetRoot())
|
||||
{
|
||||
@ -689,7 +689,7 @@ void EditorFrame::OnRightClickTree(wxPoint pos)
|
||||
|
||||
XmlTreeData *pardt =
|
||||
(XmlTreeData*)(m_TreeCtrl->GetItemData(
|
||||
m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
|
||||
m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
|
||||
if (pardt && pardt->Node && pardt->Node != m_Resource->GetRoot())
|
||||
{
|
||||
wxXmlNode *nd = pardt->Node;
|
||||
@ -754,7 +754,7 @@ void EditorFrame::OnClipboardAction(wxCommandEvent& event)
|
||||
{
|
||||
XmlTreeData *pardt =
|
||||
(XmlTreeData*)(m_TreeCtrl->GetItemData(
|
||||
m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
|
||||
m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
|
||||
|
||||
if (pardt && pardt->Node && pardt->Node != m_Resource->GetRoot())
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ class PropEditCtrlCoordXY : public PropEditCtrlInt
|
||||
wxString prev = XmlReadValue(GetNode(), m_PropInfo->Name);
|
||||
if (prev[prev.Len()-1] == _T('d')) s << _T('d');
|
||||
XmlWriteValue(GetNode(), m_PropInfo->Name, s);
|
||||
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetParent(m_TreeItem), TRUE);
|
||||
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), TRUE);
|
||||
}
|
||||
|
||||
virtual wxString GetValueAsText(wxTreeItemId ti)
|
||||
@ -228,7 +228,7 @@ class PropEditCtrlCoordDlg : public PropEditCtrlBool
|
||||
wxString s = XmlReadValue(GetNode(), m_PropInfo->Name).BeforeFirst(_T('d'));
|
||||
if (m_Choice->GetSelection() == 1) s << _T('d');
|
||||
XmlWriteValue(GetNode(), m_PropInfo->Name, s);
|
||||
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetParent(m_TreeItem), TRUE);
|
||||
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), TRUE);
|
||||
}
|
||||
|
||||
virtual wxString GetValueAsText(wxTreeItemId ti)
|
||||
@ -309,7 +309,7 @@ class PropEditCtrlDimX : public PropEditCtrlInt
|
||||
s = m_c;
|
||||
if (dlg) s << _T('d');
|
||||
XmlWriteValue(GetNode(), m_PropInfo->Name, s);
|
||||
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetParent(m_TreeItem), TRUE);
|
||||
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), TRUE);
|
||||
}
|
||||
|
||||
virtual wxString GetValueAsText(wxTreeItemId ti)
|
||||
|
@ -508,10 +508,19 @@ Returns an invalid tree item if there are no further siblings.
|
||||
|
||||
Returns the next visible item.
|
||||
|
||||
\membersection{wxTreeCtrl::GetItemParent}\label{wxtreectrlgetitemparent}
|
||||
|
||||
\constfunc{wxTreeItemId}{GetItemParent}{\param{const wxTreeItemId\&}{ item}}
|
||||
|
||||
Returns the item's parent.
|
||||
|
||||
\membersection{wxTreeCtrl::GetParent}\label{wxtreectrlgetparent}
|
||||
|
||||
\constfunc{wxTreeItemId}{GetParent}{\param{const wxTreeItemId\&}{ item}}
|
||||
|
||||
{\bf NOTE:} This function is deprecated and will only work if {\tt WXWIN\_COMPATIBILITY\_2\_2}
|
||||
is defined. Use \helpref{wxTreeCtrl::GetItemParent}{wxtreectrlgetitemparent} instead.
|
||||
|
||||
Returns the item's parent.
|
||||
|
||||
\pythonnote{This method is named {\tt GetItemParent} to avoid a name
|
||||
|
@ -202,7 +202,16 @@ public:
|
||||
size_t GetSelections(wxArrayTreeItemIds&) const;
|
||||
|
||||
// get the parent of this item (may return NULL if root)
|
||||
wxTreeItemId GetParent(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
// deprecated: Use GetItemParent instead.
|
||||
wxTreeItemId GetParent(const wxTreeItemId& item) const
|
||||
{ return GetItemParent( item ); }
|
||||
|
||||
// Expose the base class method hidden by the one above.
|
||||
wxWindow *GetParent() const { return wxScrolledWindow::GetParent(); }
|
||||
#endif // WXWIN_COMPATIBILITY_2_2
|
||||
|
||||
// for this enumeration function you must pass in a "cookie" parameter
|
||||
// which is opaque for the application but is necessary for the library
|
||||
|
@ -251,7 +251,7 @@ public:
|
||||
wxTreeItemId GetSelection() const;
|
||||
|
||||
// get the parent of this item (may return NULL if root)
|
||||
wxTreeItemId GetParent(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
|
||||
|
||||
// for this enumeration function you must pass in a "cookie" parameter
|
||||
// which is opaque for the application but is necessary for the library
|
||||
|
@ -251,7 +251,7 @@ public:
|
||||
wxTreeItemId GetSelection() const;
|
||||
|
||||
// get the parent of this item (may return NULL if root)
|
||||
wxTreeItemId GetParent(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
|
||||
|
||||
// for this enumeration function you must pass in a "cookie" parameter
|
||||
// which is opaque for the application but is necessary for the library
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
long GetNextItem(long item, int code) const;
|
||||
bool ItemHasChildren(long item) const;
|
||||
long GetChild(long item) const;
|
||||
long GetParent(long item) const;
|
||||
long GetItemParent(long item) const;
|
||||
long GetFirstVisibleItem() const;
|
||||
long GetNextVisibleItem(long item) const;
|
||||
long GetSelection() const;
|
||||
|
@ -222,7 +222,16 @@ public:
|
||||
size_t GetSelections(wxArrayTreeItemIds& selections) const;
|
||||
|
||||
// get the parent of this item (may return NULL if root)
|
||||
wxTreeItemId GetParent(const wxTreeItemId& item) const;
|
||||
wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
// deprecated: Use GetItemParent instead.
|
||||
wxTreeItemId GetParent(const wxTreeItemId& item) const
|
||||
{ return GetItemParent( item ); }
|
||||
|
||||
// Expose the base class method hidden by the one above.
|
||||
wxWindow *GetParent() const { return wxScrolledWindow::GetParent(); }
|
||||
#endif // WXWIN_COMPATIBILITY_2_2
|
||||
|
||||
// for this enumeration function you must pass in a "cookie" parameter
|
||||
// which is opaque for the application but is necessary for the library
|
||||
|
@ -1016,7 +1016,7 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event)
|
||||
if ( itemDst.IsOk() && !ItemHasChildren(itemDst) )
|
||||
{
|
||||
// copy to the parent then
|
||||
itemDst = GetParent(itemDst);
|
||||
itemDst = GetItemParent(itemDst);
|
||||
}
|
||||
|
||||
if ( !itemDst.IsOk() )
|
||||
|
@ -112,7 +112,7 @@ protected:
|
||||
bool IsTestItem(const wxTreeItemId& item)
|
||||
{
|
||||
// the test item is the first child folder
|
||||
return GetParent(item) == GetRootItem() && !GetPrevSibling(item);
|
||||
return GetItemParent(item) == GetRootItem() && !GetPrevSibling(item);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -687,7 +687,7 @@ void wxGenericDirCtrl::OnBeginEditItem(wxTreeEvent &event)
|
||||
}
|
||||
|
||||
// don't rename the individual sections
|
||||
if (m_treeCtrl->GetParent( event.GetItem() ) == m_rootId)
|
||||
if (m_treeCtrl->GetItemParent( event.GetItem() ) == m_rootId)
|
||||
{
|
||||
event.Veto();
|
||||
return;
|
||||
|
@ -257,7 +257,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxTreeItemId id = m_dirCtrl->GetTreeCtrl()->GetSelection();
|
||||
if ((id == m_dirCtrl->GetTreeCtrl()->GetRootItem()) ||
|
||||
(m_dirCtrl->GetTreeCtrl()->GetParent(id) == m_dirCtrl->GetTreeCtrl()->GetRootItem()))
|
||||
(m_dirCtrl->GetTreeCtrl()->GetItemParent(id) == m_dirCtrl->GetTreeCtrl()->GetRootItem()))
|
||||
{
|
||||
wxMessageDialog msg(this, _("You cannot add a new directory to this section."),
|
||||
_("Create directory"), wxOK | wxICON_INFORMATION );
|
||||
@ -265,7 +265,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
|
||||
return;
|
||||
}
|
||||
|
||||
wxTreeItemId parent = id ; // m_dirCtrl->GetTreeCtrl()->GetParent( id );
|
||||
wxTreeItemId parent = id ; // m_dirCtrl->GetTreeCtrl()->GetItemParent( id );
|
||||
wxDirItemData *data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData( parent );
|
||||
wxASSERT( data );
|
||||
|
||||
|
@ -1121,7 +1121,7 @@ bool wxGenericTreeCtrl::IsBold(const wxTreeItemId& item) const
|
||||
// navigation
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
wxTreeItemId wxGenericTreeCtrl::GetParent(const wxTreeItemId& item) const
|
||||
wxTreeItemId wxGenericTreeCtrl::GetItemParent(const wxTreeItemId& item) const
|
||||
{
|
||||
wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") );
|
||||
|
||||
@ -1221,7 +1221,7 @@ wxTreeItemId wxGenericTreeCtrl::GetNext(const wxTreeItemId& item) const
|
||||
do
|
||||
{
|
||||
toFind = GetNextSibling(p);
|
||||
p = GetParent(p);
|
||||
p = GetItemParent(p);
|
||||
} while (p.IsOk() && !toFind.IsOk());
|
||||
return toFind;
|
||||
}
|
||||
@ -1766,13 +1766,13 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId,
|
||||
if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() )
|
||||
return;
|
||||
|
||||
wxTreeItemId parent = GetParent( itemId );
|
||||
wxTreeItemId parent = GetItemParent( itemId );
|
||||
while (parent.IsOk())
|
||||
{
|
||||
if (!IsExpanded(parent))
|
||||
Expand( parent );
|
||||
|
||||
parent = GetParent( parent );
|
||||
parent = GetItemParent( parent );
|
||||
}
|
||||
|
||||
EnsureVisible( itemId );
|
||||
@ -2576,7 +2576,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
||||
wxTreeItemId prev = GetPrevSibling( m_key_current );
|
||||
if (!prev)
|
||||
{
|
||||
prev = GetParent( m_key_current );
|
||||
prev = GetItemParent( m_key_current );
|
||||
if ((prev == GetRootItem()) && HasFlag(wxTR_HIDE_ROOT))
|
||||
{
|
||||
break; // don't go to root if it is hidden
|
||||
@ -2615,7 +2615,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
||||
// left arrow goes to the parent
|
||||
case WXK_LEFT:
|
||||
{
|
||||
wxTreeItemId prev = GetParent( m_current );
|
||||
wxTreeItemId prev = GetItemParent( m_current );
|
||||
if ((prev == GetRootItem()) && HasFlag(wxTR_HIDE_ROOT))
|
||||
{
|
||||
// don't go to root if it is hidden
|
||||
@ -2651,7 +2651,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
||||
wxTreeItemId current = m_key_current;
|
||||
while (current && !next)
|
||||
{
|
||||
current = GetParent( current );
|
||||
current = GetItemParent( current );
|
||||
if (current) next = GetNextSibling( current );
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ wxTreeItemId wxTreeCtrl::GetSelection() const {
|
||||
return p;
|
||||
}
|
||||
|
||||
wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const {
|
||||
wxTreeItemId wxTreeCtrl::GetItemParent(const wxTreeItemId& item) const {
|
||||
if (item.IsOk())
|
||||
return (GtkTreeItem *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "parent");
|
||||
|
||||
|
@ -315,7 +315,7 @@ wxTreeItemId wxTreeCtrl::GetSelection() const {
|
||||
return p;
|
||||
}
|
||||
|
||||
wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const {
|
||||
wxTreeItemId wxTreeCtrl::GetItemParent(const wxTreeItemId& item) const {
|
||||
if (item.IsOk())
|
||||
return (GtkTreeItem *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "parent");
|
||||
|
||||
|
@ -123,7 +123,7 @@ long wxTreeCtrl::GetChild(long item) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxTreeCtrl::GetParent(long item) const
|
||||
long wxTreeCtrl::GetItemParent(long item) const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
@ -123,7 +123,7 @@ long wxTreeCtrl::GetChild(long item) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxTreeCtrl::GetParent(long item) const
|
||||
long wxTreeCtrl::GetItemParent(long item) const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
@ -1349,7 +1349,7 @@ wxTreeItemId wxTreeCtrl::GetSelection() const
|
||||
return wxTreeItemId((WXHTREEITEM) TreeView_GetSelection(GetHwnd()));
|
||||
}
|
||||
|
||||
wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const
|
||||
wxTreeItemId wxTreeCtrl::GetItemParent(const wxTreeItemId& item) const
|
||||
{
|
||||
HTREEITEM hItem;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user