+ // 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
+