wxSplitterWindow::ReplaceWindow() function added and documented
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -205,10 +205,32 @@ user. It may return FALSE to prevent the change or TRUE to allow it.
|
|||||||
The default implementation of this function verifies that the sizes of both
|
The default implementation of this function verifies that the sizes of both
|
||||||
panes of the splitter are greater than minimum pane size.
|
panes of the splitter are greater than minimum pane size.
|
||||||
|
|
||||||
|
\membersection{wxSplitterWindow::ReplaceWindow}\label{wxsplitterwindowreplacewindow}
|
||||||
|
|
||||||
|
\func{bool}{ReplaceWindow}{\param{wxWindow * }{winOld}, \param{wxWindow * }{winNew}}
|
||||||
|
|
||||||
|
This function replaces one of the windows managed by the wxSplitterWindow with
|
||||||
|
another one. It is in general better to use it instead of calling Unsplit()
|
||||||
|
and then resplitting the window back because it will provoke much less flicker
|
||||||
|
(if any). It is valid to call this function whether the splitter has two
|
||||||
|
windows or only one.
|
||||||
|
|
||||||
|
Both parameters should be non NULL and {\it winOld} must specify one of the
|
||||||
|
windows managed by the splitter. If the parameters are incorrect or the window
|
||||||
|
couldn't be replaced, FALSE is returned. Otherwise the function will return
|
||||||
|
TRUE, but please notice that it will not delete the replaced window and you
|
||||||
|
may wish to do it yourself.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
|
\helpref{wxSplitterWindow::GetMinimumPaneSize}{wxsplitterwindowgetminimumpanesize}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}\\
|
||||||
|
\helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}\\
|
||||||
|
\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
|
||||||
|
|
||||||
\membersection{wxSplitterWindow::SetSashPosition}\label{wxsplitterwindowsetsashposition}
|
\membersection{wxSplitterWindow::SetSashPosition}\label{wxsplitterwindowsetsashposition}
|
||||||
|
|
||||||
\func{void}{SetSashPosition}{\param{int }{position}, \param{const bool}{ redraw = TRUE}}
|
\func{void}{SetSashPosition}{\param{int }{position}, \param{const bool}{ redraw = TRUE}}
|
||||||
|
@@ -94,6 +94,10 @@ public:
|
|||||||
// Doesn't actually delete the window.
|
// Doesn't actually delete the window.
|
||||||
bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL);
|
bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL);
|
||||||
|
|
||||||
|
// Replaces one of the windows with another one (neither old nor new
|
||||||
|
// parameter should be NULL)
|
||||||
|
bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
|
||||||
|
|
||||||
// Is the window split?
|
// Is the window split?
|
||||||
bool IsSplit() const { return (m_windowTwo != NULL); }
|
bool IsSplit() const { return (m_windowTwo != NULL); }
|
||||||
|
|
||||||
|
@@ -587,22 +587,17 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove)
|
|||||||
if ( ! IsSplit() )
|
if ( ! IsSplit() )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
wxWindow *win = NULL;
|
||||||
if ( toRemove == NULL || toRemove == m_windowTwo)
|
if ( toRemove == NULL || toRemove == m_windowTwo)
|
||||||
{
|
{
|
||||||
wxWindow *win = m_windowTwo ;
|
win = m_windowTwo ;
|
||||||
m_windowTwo = (wxWindow *) NULL;
|
m_windowTwo = (wxWindow *) NULL;
|
||||||
OnUnsplit(win);
|
|
||||||
m_sashPosition = 0;
|
|
||||||
SizeWindows();
|
|
||||||
}
|
}
|
||||||
else if ( toRemove == m_windowOne )
|
else if ( toRemove == m_windowOne )
|
||||||
{
|
{
|
||||||
wxWindow *win = m_windowOne ;
|
win = m_windowOne ;
|
||||||
m_windowOne = m_windowTwo;
|
m_windowOne = m_windowTwo;
|
||||||
m_windowTwo = (wxWindow *) NULL;
|
m_windowTwo = (wxWindow *) NULL;
|
||||||
OnUnsplit(win);
|
|
||||||
m_sashPosition = 0;
|
|
||||||
SizeWindows();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -611,6 +606,36 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OnUnsplit(win);
|
||||||
|
m_sashPosition = 0;
|
||||||
|
SizeWindows();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace a window with another one
|
||||||
|
bool wxSplitterWindow::ReplaceWindow(wxWindow *winOld, wxWindow *winNew)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( winOld, FALSE, "use one of Split() functions instead" );
|
||||||
|
wxCHECK_MSG( winNew, FALSE, "use Unsplit() functions instead" );
|
||||||
|
|
||||||
|
if ( winOld == m_windowTwo )
|
||||||
|
{
|
||||||
|
m_windowTwo = winNew;
|
||||||
|
}
|
||||||
|
else if ( winOld == m_windowOne )
|
||||||
|
{
|
||||||
|
m_windowOne = winNew;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFAIL_MSG("splitter: attempt to replace a non-existent window");
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SizeWindows();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user