added CollapsePath() (patch 1494638)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-05-28 23:54:28 +00:00
parent bd00fe32fb
commit f395a825a9
4 changed files with 36 additions and 0 deletions

View File

@@ -147,6 +147,7 @@ All (GUI):
- Fixed bug with ignoring blank lines in multiline wxGrid cell labels - Fixed bug with ignoring blank lines in multiline wxGrid cell labels
- Added wxTextAttr::Merge() (Marcin Simonides) - Added wxTextAttr::Merge() (Marcin Simonides)
- Added wxTB_NO_TOOLTIPS style (Igor Korot) - Added wxTB_NO_TOOLTIPS style (Igor Korot)
- Added wxGenericDirCtrl::CollapsePath() (Christian Buhtz)
wxMSW: wxMSW:

View File

@@ -101,6 +101,12 @@ Collapses the entire tree.
Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control. Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control.
\membersection{wxGenericDirCtrl::CollapsePath}\label{wxgenericdirctrlcollapsepath}
\func{bool}{CollapsePath}{\param{const wxString\& }{path}}
Collapse the given path.
\membersection{wxGenericDirCtrl::GetDefaultPath}\label{wxgenericdirctrlgetdefaultpath} \membersection{wxGenericDirCtrl::GetDefaultPath}\label{wxgenericdirctrlgetdefaultpath}
\constfunc{wxString}{GetDefaultPath}{\void} \constfunc{wxString}{GetDefaultPath}{\void}

View File

@@ -116,6 +116,8 @@ public:
// Try to expand as much of the given path as possible. // Try to expand as much of the given path as possible.
virtual bool ExpandPath(const wxString& path); virtual bool ExpandPath(const wxString& path);
// collapse the path
virtual bool CollapsePath(const wxString& path);
// Accessors // Accessors

View File

@@ -1065,6 +1065,33 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path)
return true; return true;
} }
bool wxGenericDirCtrl::CollapsePath(const wxString& path)
{
bool done = false;
wxTreeItemId id = FindChild(m_rootId, path, done);
wxTreeItemId lastId = id; // The last non-zero id
while ( id.IsOk() && !done )
{
CollapseDir(id);
id = FindChild(id, path, done);
if ( id.IsOk() )
lastId = id;
}
if ( !lastId.IsOk() )
return false;
m_treeCtrl->SelectItem(lastId);
m_treeCtrl->EnsureVisible(lastId);
return true;
}
wxString wxGenericDirCtrl::GetPath() const wxString wxGenericDirCtrl::GetPath() const
{ {
wxTreeItemId id = m_treeCtrl->GetSelection(); wxTreeItemId id = m_treeCtrl->GetSelection();