Added wxSplitterWindow::SetSashInvisible() and IsSashInvisible().
Also fix handling of wxSP_NOSASH. Closes #14074. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70840 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -492,6 +492,7 @@ All (GUI):
|
|||||||
- Fix setting of the frame icon when using non-standard icon sizes (vid).
|
- Fix setting of the frame icon when using non-standard icon sizes (vid).
|
||||||
- Implement wxDV_ROW_LINES in generic wxDataViewCtrl (RedCAT).
|
- Implement wxDV_ROW_LINES in generic wxDataViewCtrl (RedCAT).
|
||||||
- Added EVT_AUI_PANE_ACTIVATED event (Ronny Krüger).
|
- Added EVT_AUI_PANE_ACTIVATED event (Ronny Krüger).
|
||||||
|
- Added wxSplitterWindow::SetSashInvisible() (Armel Asselin).
|
||||||
|
|
||||||
|
|
||||||
GTK:
|
GTK:
|
||||||
|
@@ -136,8 +136,14 @@ public:
|
|||||||
// Sets the border size
|
// Sets the border size
|
||||||
void SetBorderSize(int WXUNUSED(width)) { }
|
void SetBorderSize(int WXUNUSED(width)) { }
|
||||||
|
|
||||||
// Gets the sash size
|
// Hide or show the sash and test whether it's currently hidden.
|
||||||
|
void SetSashInvisible(bool invisible = true);
|
||||||
|
bool IsSashInvisible() const { return HasFlag(wxSP_NOSASH); }
|
||||||
|
|
||||||
|
// Gets the current sash size which may be 0 if it's hidden and the default
|
||||||
|
// sash size.
|
||||||
int GetSashSize() const;
|
int GetSashSize() const;
|
||||||
|
int GetDefaultSashSize() const;
|
||||||
|
|
||||||
// Gets the border size
|
// Gets the border size
|
||||||
int GetBorderSize() const;
|
int GetBorderSize() const;
|
||||||
|
@@ -163,16 +163,25 @@ public:
|
|||||||
int GetSashPosition() const;
|
int GetSashPosition() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the sash size in pixels.
|
Returns the default sash size in pixels or 0 if it is invisible.
|
||||||
|
|
||||||
|
@see GetDefaultSashSize(), IsSashInvisible()
|
||||||
|
*/
|
||||||
|
int GetSashSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the default sash size in pixels.
|
||||||
|
|
||||||
The size of the sash is its width for a vertically split window and its
|
The size of the sash is its width for a vertically split window and its
|
||||||
height for a horizontally split one. Its other direction is the same as
|
height for a horizontally split one. Its other direction is the same as
|
||||||
the client size of the window in the corresponding direction.
|
the client size of the window in the corresponding direction.
|
||||||
|
|
||||||
The sash size is platform-dependent because it conforms to the current
|
The default sash size is platform-dependent because it conforms to the
|
||||||
platform look-and-feel and cannot be changed.
|
current platform look-and-feel and cannot be changed.
|
||||||
|
|
||||||
|
@since 2.9.4
|
||||||
*/
|
*/
|
||||||
int GetSashSize() const;
|
int GetDefaultSashSize() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the split mode.
|
Gets the split mode.
|
||||||
@@ -205,6 +214,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Initialize(wxWindow* window);
|
void Initialize(wxWindow* window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the sash is invisible even when the window is split, @false otherwise.
|
||||||
|
|
||||||
|
@remark This is a shortcut for HasFlag(wxSP_NOSASH)
|
||||||
|
|
||||||
|
@see SetSashInvisible()
|
||||||
|
|
||||||
|
@since 2.9.4
|
||||||
|
*/
|
||||||
|
bool IsSashInvisible() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if the window is split, @false otherwise.
|
Returns @true if the window is split, @false otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -335,6 +355,25 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetSplitMode(int mode);
|
void SetSplitMode(int mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets whether the sash should be invisible, even when the window is
|
||||||
|
split.
|
||||||
|
|
||||||
|
When the sash is invisible, it doesn't appear on the screen at all and,
|
||||||
|
in particular, doesn't allow the user to resize the windows.
|
||||||
|
|
||||||
|
@remarks Only sets the internal variable; does not update the display.
|
||||||
|
|
||||||
|
@param invisible
|
||||||
|
If @true, the sash is always invisible, else it is shown when the
|
||||||
|
window is split.
|
||||||
|
|
||||||
|
@see IsSashInvisible()
|
||||||
|
|
||||||
|
@since 2.9.4
|
||||||
|
*/
|
||||||
|
void SetSashInvisible(bool invisible=true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes the top and bottom panes of the splitter window.
|
Initializes the top and bottom panes of the splitter window.
|
||||||
The child windows are shown if they are currently hidden.
|
The child windows are shown if they are currently hidden.
|
||||||
|
@@ -60,7 +60,8 @@ enum
|
|||||||
SPLIT_SETPOSITION,
|
SPLIT_SETPOSITION,
|
||||||
SPLIT_SETMINSIZE,
|
SPLIT_SETMINSIZE,
|
||||||
SPLIT_SETGRAVITY,
|
SPLIT_SETGRAVITY,
|
||||||
SPLIT_REPLACE
|
SPLIT_REPLACE,
|
||||||
|
SPLIT_INVISIBLE
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -99,6 +100,7 @@ public:
|
|||||||
void OnSetMinSize(wxCommandEvent& event);
|
void OnSetMinSize(wxCommandEvent& event);
|
||||||
void OnSetGravity(wxCommandEvent& event);
|
void OnSetGravity(wxCommandEvent& event);
|
||||||
void OnReplace(wxCommandEvent &event);
|
void OnReplace(wxCommandEvent &event);
|
||||||
|
void OnToggleInvisible(wxCommandEvent &event);
|
||||||
|
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -106,6 +108,7 @@ public:
|
|||||||
void OnUpdateUIHorizontal(wxUpdateUIEvent& event);
|
void OnUpdateUIHorizontal(wxUpdateUIEvent& event);
|
||||||
void OnUpdateUIVertical(wxUpdateUIEvent& event);
|
void OnUpdateUIVertical(wxUpdateUIEvent& event);
|
||||||
void OnUpdateUIUnsplit(wxUpdateUIEvent& event);
|
void OnUpdateUIUnsplit(wxUpdateUIEvent& event);
|
||||||
|
void OnUpdateUIInvisible(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxScrolledWindow *m_left, *m_right;
|
wxScrolledWindow *m_left, *m_right;
|
||||||
@@ -187,12 +190,14 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(SPLIT_SETMINSIZE, MyFrame::OnSetMinSize)
|
EVT_MENU(SPLIT_SETMINSIZE, MyFrame::OnSetMinSize)
|
||||||
EVT_MENU(SPLIT_SETGRAVITY, MyFrame::OnSetGravity)
|
EVT_MENU(SPLIT_SETGRAVITY, MyFrame::OnSetGravity)
|
||||||
EVT_MENU(SPLIT_REPLACE, MyFrame::OnReplace)
|
EVT_MENU(SPLIT_REPLACE, MyFrame::OnReplace)
|
||||||
|
EVT_MENU(SPLIT_INVISIBLE, MyFrame::OnToggleInvisible)
|
||||||
|
|
||||||
EVT_MENU(SPLIT_QUIT, MyFrame::OnQuit)
|
EVT_MENU(SPLIT_QUIT, MyFrame::OnQuit)
|
||||||
|
|
||||||
EVT_UPDATE_UI(SPLIT_VERTICAL, MyFrame::OnUpdateUIVertical)
|
EVT_UPDATE_UI(SPLIT_VERTICAL, MyFrame::OnUpdateUIVertical)
|
||||||
EVT_UPDATE_UI(SPLIT_HORIZONTAL, MyFrame::OnUpdateUIHorizontal)
|
EVT_UPDATE_UI(SPLIT_HORIZONTAL, MyFrame::OnUpdateUIHorizontal)
|
||||||
EVT_UPDATE_UI(SPLIT_UNSPLIT, MyFrame::OnUpdateUIUnsplit)
|
EVT_UPDATE_UI(SPLIT_UNSPLIT, MyFrame::OnUpdateUIUnsplit)
|
||||||
|
EVT_UPDATE_UI(SPLIT_INVISIBLE, MyFrame::OnUpdateUIInvisible)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// My frame constructor
|
// My frame constructor
|
||||||
@@ -218,6 +223,9 @@ MyFrame::MyFrame()
|
|||||||
splitMenu->Append(SPLIT_UNSPLIT,
|
splitMenu->Append(SPLIT_UNSPLIT,
|
||||||
wxT("&Unsplit\tCtrl-U"),
|
wxT("&Unsplit\tCtrl-U"),
|
||||||
wxT("Unsplit"));
|
wxT("Unsplit"));
|
||||||
|
splitMenu->AppendCheckItem(SPLIT_INVISIBLE,
|
||||||
|
wxT("Toggle sash &invisibility\tCtrl-I"),
|
||||||
|
wxT("Toggle sash invisibility"));
|
||||||
splitMenu->AppendSeparator();
|
splitMenu->AppendSeparator();
|
||||||
|
|
||||||
splitMenu->AppendCheckItem(SPLIT_LIVE,
|
splitMenu->AppendCheckItem(SPLIT_LIVE,
|
||||||
@@ -436,6 +444,12 @@ void MyFrame::OnReplace(wxCommandEvent& WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnToggleInvisible(wxCommandEvent& WXUNUSED(event) )
|
||||||
|
{
|
||||||
|
m_splitter->SetSashInvisible(!m_splitter->IsSashInvisible());
|
||||||
|
m_splitter->SizeWindows();
|
||||||
|
}
|
||||||
|
|
||||||
// Update UI handlers
|
// Update UI handlers
|
||||||
|
|
||||||
void MyFrame::OnUpdateUIHorizontal(wxUpdateUIEvent& event)
|
void MyFrame::OnUpdateUIHorizontal(wxUpdateUIEvent& event)
|
||||||
@@ -453,6 +467,11 @@ void MyFrame::OnUpdateUIUnsplit(wxUpdateUIEvent& event)
|
|||||||
event.Enable( m_splitter->IsSplit() );
|
event.Enable( m_splitter->IsSplit() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnUpdateUIInvisible(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Check( m_splitter->IsSashInvisible() );
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MySplitterWindow
|
// MySplitterWindow
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -496,7 +496,18 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance)
|
|||||||
return z >= hitMin && z <= hitMax;
|
return z >= hitMin && z <= hitMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxSplitterWindow::SetSashInvisible(bool invisible)
|
||||||
|
{
|
||||||
|
if ( IsSashInvisible() != invisible )
|
||||||
|
ToggleWindowStyle(wxSP_NOSASH);
|
||||||
|
}
|
||||||
|
|
||||||
int wxSplitterWindow::GetSashSize() const
|
int wxSplitterWindow::GetSashSize() const
|
||||||
|
{
|
||||||
|
return IsSashInvisible() ? 0 : GetDefaultSashSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSplitterWindow::GetDefaultSashSize() const
|
||||||
{
|
{
|
||||||
return wxRendererNative::Get().GetSplitterParams(this).widthSash;
|
return wxRendererNative::Get().GetSplitterParams(this).widthSash;
|
||||||
}
|
}
|
||||||
@@ -522,7 +533,7 @@ void wxSplitterWindow::DrawSash(wxDC& dc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// nor if we're configured to not show it
|
// nor if we're configured to not show it
|
||||||
if ( HasFlag(wxSP_NOSASH) )
|
if ( IsSashInvisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxRendererNative::Get().DrawSplitterSash
|
wxRendererNative::Get().DrawSplitterSash
|
||||||
|
Reference in New Issue
Block a user