don't allow docks to be resized such that panes overlap
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
38d26d6040
commit
69e65b6c0b
@ -1842,8 +1842,8 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont,
|
||||
// value that the pane will receive
|
||||
int pane_proportion = pane.dock_proportion;
|
||||
|
||||
wxBoxSizer* horz_pane_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* vert_pane_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxAuiProportionalBoxSizer* horz_pane_sizer = new wxAuiProportionalBoxSizer(wxHORIZONTAL);
|
||||
wxAuiProportionalBoxSizer* vert_pane_sizer = new wxAuiProportionalBoxSizer(wxVERTICAL);
|
||||
|
||||
if (pane.HasGripper())
|
||||
{
|
||||
@ -1865,7 +1865,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont,
|
||||
if (pane.HasCaption())
|
||||
{
|
||||
// create the caption sizer
|
||||
wxBoxSizer* caption_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxAuiProportionalBoxSizer* caption_sizer = new wxAuiProportionalBoxSizer(wxHORIZONTAL);
|
||||
|
||||
sizer_item = caption_sizer->Add(1, caption_size, 1, wxEXPAND);
|
||||
|
||||
@ -2147,7 +2147,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
|
||||
wxAuiDockUIPartArray& uiparts,
|
||||
bool spacer_only)
|
||||
{
|
||||
wxBoxSizer* container = new wxBoxSizer(wxVERTICAL);
|
||||
wxAuiProportionalBoxSizer* container = new wxAuiProportionalBoxSizer(wxVERTICAL);
|
||||
|
||||
int pane_border_size = m_art->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE);
|
||||
int caption_size = m_art->GetMetric(wxAUI_DOCKART_CAPTION_SIZE);
|
||||
@ -2430,7 +2430,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
|
||||
|
||||
// create a container which will hold this layer's
|
||||
// docks (top, bottom, left, right)
|
||||
cont = new wxBoxSizer(wxVERTICAL);
|
||||
cont = new wxAuiProportionalBoxSizer(wxVERTICAL);
|
||||
|
||||
|
||||
// find any top docks in this layer
|
||||
@ -2445,7 +2445,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
|
||||
// fill out the middle layer (which consists
|
||||
// of left docks, content area and right docks)
|
||||
|
||||
middle = new wxBoxSizer(wxHORIZONTAL);
|
||||
middle = new wxAuiProportionalBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// find any left docks in this layer
|
||||
FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
|
||||
@ -2514,7 +2514,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
|
||||
{
|
||||
// no sizer available, because there are no docks,
|
||||
// therefore we will create a simple background area
|
||||
cont = new wxBoxSizer(wxVERTICAL);
|
||||
cont = new wxAuiProportionalBoxSizer(wxVERTICAL);
|
||||
wxSizerItem* sizer_item = cont->Add(1,1, 1, wxEXPAND);
|
||||
wxAuiDockUIPart part;
|
||||
part.type = wxAuiDockUIPart::typeBackground;
|
||||
@ -4176,26 +4176,84 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event)
|
||||
// resize the dock or the pane
|
||||
if (m_action_part && m_action_part->type==wxAuiDockUIPart::typeDockSizer)
|
||||
{
|
||||
// first, we must calculate the maximum size the dock may be
|
||||
int sash_size = m_art->GetMetric(wxAUI_DOCKART_SASH_SIZE);
|
||||
|
||||
int used_width = 0, used_height = 0;
|
||||
|
||||
wxSize client_size = m_frame->GetClientSize();
|
||||
|
||||
size_t dock_i, dock_count = m_docks.GetCount();
|
||||
for (dock_i = 0; dock_i < dock_count; ++dock_i)
|
||||
{
|
||||
wxAuiDockInfo& dock = m_docks.Item(dock_i);
|
||||
if (dock.dock_direction == wxAUI_DOCK_TOP ||
|
||||
dock.dock_direction == wxAUI_DOCK_BOTTOM)
|
||||
{
|
||||
used_height += dock.size;
|
||||
}
|
||||
if (dock.dock_direction == wxAUI_DOCK_LEFT ||
|
||||
dock.dock_direction == wxAUI_DOCK_RIGHT)
|
||||
{
|
||||
used_width += dock.size;
|
||||
}
|
||||
if (dock.resizable)
|
||||
used_width += sash_size;
|
||||
}
|
||||
|
||||
|
||||
int available_width = client_size.GetWidth() - used_width;
|
||||
int available_height = client_size.GetHeight() - used_height;
|
||||
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// if there's a status control, the available
|
||||
// height decreases accordingly
|
||||
if (m_frame && m_frame->IsKindOf(CLASSINFO(wxFrame)))
|
||||
{
|
||||
wxFrame* frame = static_cast<wxFrame*>(m_frame);
|
||||
wxStatusBar* status = frame->GetStatusBar();
|
||||
if (status)
|
||||
{
|
||||
wxSize status_client_size = status->GetClientSize();
|
||||
available_height -= status_client_size.GetHeight();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
wxRect& rect = m_action_part->dock->rect;
|
||||
|
||||
wxPoint new_pos(event.m_x - m_action_offset.x,
|
||||
event.m_y - m_action_offset.y);
|
||||
|
||||
int new_size, old_size = m_action_part->dock->size;
|
||||
|
||||
switch (m_action_part->dock->dock_direction)
|
||||
{
|
||||
case wxAUI_DOCK_LEFT:
|
||||
m_action_part->dock->size = new_pos.x - rect.x;
|
||||
new_size = new_pos.x - rect.x;
|
||||
if (new_size-old_size > available_width)
|
||||
new_size = old_size+available_width;
|
||||
m_action_part->dock->size = new_size;
|
||||
break;
|
||||
case wxAUI_DOCK_TOP:
|
||||
m_action_part->dock->size = new_pos.y - rect.y;
|
||||
new_size = new_pos.y - rect.y;
|
||||
if (new_size-old_size > available_height)
|
||||
new_size = old_size+available_height;
|
||||
m_action_part->dock->size = new_size;
|
||||
break;
|
||||
case wxAUI_DOCK_RIGHT:
|
||||
m_action_part->dock->size = rect.x + rect.width -
|
||||
new_pos.x - m_action_part->rect.GetWidth();
|
||||
new_size = rect.x + rect.width - new_pos.x -
|
||||
m_action_part->rect.GetWidth();
|
||||
if (new_size-old_size > available_width)
|
||||
new_size = old_size+available_width;
|
||||
m_action_part->dock->size = new_size;
|
||||
break;
|
||||
case wxAUI_DOCK_BOTTOM:
|
||||
m_action_part->dock->size = rect.y + rect.height -
|
||||
new_size = rect.y + rect.height -
|
||||
new_pos.y - m_action_part->rect.GetHeight();
|
||||
if (new_size-old_size > available_height)
|
||||
new_size = old_size+available_height;
|
||||
m_action_part->dock->size = new_size;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user