I just know that the developers of wxAui are hard at work beavering away at a better solution, but this patch suffices for me for the moment.
- Code: Select all
Index: include/wx/aui/framemanager.h
===================================================================
--- include/wx/aui/framemanager.h (revision 55290)
+++ include/wx/aui/framemanager.h (working copy)
@@ -580,6 +580,7 @@
void OnChildFocus(wxChildFocusEvent& evt);
void OnHintFadeTimer(wxTimerEvent& evt);
void OnFindManager(wxAuiManagerEvent& evt);
+ void OnToolbarDrop(wxAuiManagerEvent& evt);
protected:
@@ -807,6 +808,7 @@
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, 0)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_TOOLBAR_DROP, 0)
END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
@@ -826,6 +828,8 @@
wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
#define EVT_AUI_FIND_MANAGER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
+#define EVT_AUI_TOOLBAR_DROP(func) \
+wx__DECLARE_EVT0(wxEVT_AUI_TOOLBAR_DROP, wxAuiManagerEventHandler(func))
#else
@@ -835,6 +839,7 @@
%constant wxEventType wxEVT_AUI_PANE_RESTORE;
%constant wxEventType wxEVT_AUI_RENDER;
%constant wxEventType wxEVT_AUI_FIND_MANAGER;
+%constant wxEventType wxEVT_AUI_TOOLBAR_DROP;
%pythoncode {
EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
@@ -843,6 +848,7 @@
EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
+ EVT_AUI_TOOLBAR_DROP = wx.PyEventBinder( wxEVT_AUI_TOOLBAR_DROP )
}
#endif // SWIG
Index: src/aui/framemanager.cpp
===================================================================
--- src/aui/framemanager.cpp (revision 55290)
+++ src/aui/framemanager.cpp (working copy)
@@ -568,6 +568,7 @@
EVT_CHILD_FOCUS(wxAuiManager::OnChildFocus)
EVT_AUI_FIND_MANAGER(wxAuiManager::OnFindManager)
EVT_TIMER(101, wxAuiManager::OnHintFadeTimer)
+ EVT_AUI_TOOLBAR_DROP(wxAuiManager::OnToolbarDrop)
END_EVENT_TABLE()
@@ -3597,6 +3598,15 @@
{
// do the drop calculation
DoDrop(m_docks, m_panes, pane, client_pt, action_offset);
+
+ if (pane.IsToolbar())
+ {
+ // fire dropped toolbar event event
+ wxAuiManagerEvent e(wxEVT_AUI_TOOLBAR_DROP);
+ e.SetManager(this);
+ e.SetPane(&pane);
+ ProcessMgrEvent(e);
+ }
}
// if the pane is still floating, update it's floating
@@ -4248,7 +4258,12 @@
for (i = 0; i < dock_pane_count; ++i)
dock.panes.Item(i)->dock_pos = pane_positions[i];
}
-
+
+ // fire dropped toolbar event event
+ wxAuiManagerEvent e(wxEVT_AUI_TOOLBAR_DROP);
+ e.SetManager(this);
+ e.SetPane(&pane);
+ ProcessMgrEvent(e);
pane.state &= ~wxAuiPaneInfo::actionPane;
Update();
}
@@ -4523,4 +4538,61 @@
}
}
+void wxAuiManager::OnToolbarDrop(wxAuiManagerEvent& evt)
+{
+
+ if(evt.GetPane()->window->IsKindOf(CLASSINFO(wxAuiToolBar)))
+ {
+ wxAuiToolBar* toolBar = wxDynamicCast(evt.GetPane()->window, wxAuiToolBar);
+
+ wxAuiPaneInfo* pane = evt.GetPane();
+ if (!pane->IsFloating())
+ {
+ int direction = pane->dock_direction;
+ long style = toolBar->GetWindowStyle();
+ toolBar->Show(false);
+
+ // remove the wxAUI_TB_VERTICAL style if present
+ style &= ~(wxAUI_TB_VERTICAL);
+
+ switch( direction )
+ {
+ case wxAUI_DOCK_LEFT:
+ case wxAUI_DOCK_RIGHT:
+ {
+ style |= wxAUI_TB_VERTICAL;
+
+ pane->GripperTop(true);
+ pane->Gripper(true);
+
+ break;
+ }
+ case wxAUI_DOCK_TOP:
+ case wxAUI_DOCK_BOTTOM:
+ {
+ // Currently do nothing since all we do is switch orientation
+
+ //don't know why the gripper detection does't work so just
+ //add grippers anyway
+ pane->GripperTop(false);
+ pane->Gripper(true);
+
+ break;
+ }
+ }
+ toolBar->SetWindowStyle(style);
+ toolBar->Realize();
+ toolBar->Refresh(true);
+ toolBar->Layout();
+ toolBar->Show(true);
+
+ wxSize s = pane->window->GetMinSize();
+ pane->BestSize(s);
+ pane->FloatingSize(wxDefaultSize);
+
+ Update();
+ }
+ }
+}
+
#endif // wxUSE_AUI