// 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())
{
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);
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);
// 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
// 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);
{
// 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;
// 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;
}