X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2713fedc4644942bab59472b90612ffbe37c2760..0b850f25d2924ee0e5ea08f93fffaa63f62f9104:/src/aui/framemanager.cpp diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 395adb8905..27e3bf9416 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -53,6 +53,7 @@ wxPaneInfo wxNullPaneInfo; wxDockInfo wxNullDockInfo; DEFINE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON) DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSE) +DEFINE_EVENT_TYPE(wxEVT_AUI_RENDER) #ifdef __WXMAC__ // a few defines to avoid nameclashes @@ -61,6 +62,8 @@ DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSE) #include "wx/mac/private.h" #endif +IMPLEMENT_DYNAMIC_CLASS(wxFrameManagerEvent, wxEvent) + // -- static utility functions -- @@ -374,6 +377,7 @@ static int PaneSortFunc(wxPaneInfo** p1, wxPaneInfo** p2) BEGIN_EVENT_TABLE(wxFrameManager, wxEvtHandler) EVT_AUI_PANEBUTTON(wxFrameManager::OnPaneButton) + EVT_AUI_RENDER(wxFrameManager::OnRender) EVT_PAINT(wxFrameManager::OnPaint) EVT_ERASE_BACKGROUND(wxFrameManager::OnEraseBackground) EVT_SIZE(wxFrameManager::OnSize) @@ -387,7 +391,7 @@ BEGIN_EVENT_TABLE(wxFrameManager, wxEvtHandler) END_EVENT_TABLE() -wxFrameManager::wxFrameManager(wxFrame* frame, unsigned int flags) +wxFrameManager::wxFrameManager(wxWindow* managed_wnd, unsigned int flags) { m_action = actionNone; m_last_mouse_move = wxPoint(); @@ -396,9 +400,9 @@ wxFrameManager::wxFrameManager(wxFrame* frame, unsigned int flags) m_hint_wnd = NULL; m_flags = flags; - if (frame) + if (managed_wnd) { - SetFrame(frame); + SetManagedWindow(managed_wnd); } } @@ -496,10 +500,25 @@ unsigned int wxFrameManager::GetFlags() const } -// SetFrame() is usually called once when the frame +// don't use these anymore as they are deprecated +// use Set/GetManagedFrame() instead +void wxFrameManager::SetFrame(wxFrame* frame) +{ + SetManagedWindow((wxWindow*)frame); +} + +wxFrame* wxFrameManager::GetFrame() const +{ + return (wxFrame*)m_frame; +} + + + + +// SetManagedWindow() is usually called once when the frame // manager class is being initialized. "frame" specifies // the frame which should be managed by the frame mananger -void wxFrameManager::SetFrame(wxFrame* frame) +void wxFrameManager::SetManagedWindow(wxWindow* frame) { wxASSERT_MSG(frame, wxT("specified frame must be non-NULL")); @@ -534,8 +553,8 @@ void wxFrameManager::UnInit() m_frame->RemoveEventHandler(this); } -// GetFrame() returns the frame pointer being managed by wxFrameManager -wxFrame* wxFrameManager::GetFrame() const +// GetManagedWindow() returns the window pointer being managed +wxWindow* wxFrameManager::GetManagedWindow() const { return m_frame; } @@ -1168,7 +1187,9 @@ void wxFrameManager::LayoutAddPane(wxSizer* cont, { sizer_item = vert_pane_sizer->Add(pane.window, 1, wxEXPAND); // Don't do this because it breaks the pane size in floating windows - // vert_pane_sizer->SetItemMinSize(pane.window, 1, 1); + // BIW: Right now commenting this out is causing problems with + // an mdi client window as the center pane. + vert_pane_sizer->SetItemMinSize(pane.window, 1, 1); } part.type = wxDockUIPart::typePane; @@ -1818,7 +1839,8 @@ void wxFrameManager::Update() if (p.frame->GetPosition() != p.floating_pos) { p.frame->SetSize(p.floating_pos.x, p.floating_pos.y, - -1, -1, wxSIZE_USE_EXISTING); + wxDefaultCoord, wxDefaultCoord, + wxSIZE_USE_EXISTING); //p.frame->Move(p.floating_pos.x, p.floating_pos.y); } @@ -2041,7 +2063,7 @@ int wxFrameManager::GetDockPixelOffset(wxPaneInfo& test) // if a dock operation is allowed, the new dock position is copied into // the target info. If the operation was allowed, the function returns true. -static bool ProcessDockResult(wxPaneInfo& target, +bool wxFrameManager::ProcessDockResult(wxPaneInfo& target, const wxPaneInfo& new_pos) { bool allowed = false; @@ -2433,6 +2455,7 @@ void wxFrameManager::OnHintFadeTimer(wxTimerEvent& WXUNUSED(event)) void wxFrameManager::ShowHint(const wxRect& rect) { +#if defined(__WXMSW__) || defined(__WXMAC__) // First, determine if the operating system can handle transparency. // Transparency is available on Win2000 and above @@ -2514,7 +2537,8 @@ void wxFrameManager::ShowHint(const wxRect& rect) return; } - +#endif + if (m_last_hint != rect) { // remove the last hint rectangle @@ -2605,6 +2629,7 @@ void wxFrameManager::DrawHintRect(wxWindow* pane_window, wxDockUIPartArray uiparts; wxPaneInfo hint = GetPane(pane_window); hint.name = wxT("__HINT__"); + hint.Show(); if (!hint.IsOk()) return; @@ -2804,7 +2829,7 @@ void wxFrameManager::OnFloatingPaneClosed(wxWindow* wnd, wxCloseEvent& evt) e.SetPane(&pane); e.SetCanVeto(evt.CanVeto()); ProcessMgrEvent(e); - + if (e.GetVeto()) { evt.Veto(); @@ -2835,12 +2860,14 @@ void wxFrameManager::OnFloatingPaneActivated(wxWindow* wnd) } } -// Render() draws all of the pane captions, sashes, +// OnRender() draws all of the pane captions, sashes, // backgrounds, captions, grippers, pane borders and buttons. // It renders the entire user interface. -void wxFrameManager::Render(wxDC* dc) +void wxFrameManager::OnRender(wxFrameManagerEvent& evt) { + wxDC* dc = evt.GetDC(); + #ifdef __WXMAC__ dc->Clear() ; #endif @@ -2880,6 +2907,20 @@ void wxFrameManager::Render(wxDC* dc) } } + +// Render() fire a render event, which is normally handled by +// wxFrameManager::OnRender(). This allows the render function to +// be overridden via the render event. This can be useful for paintin +// custom graphics in the main window. Default behavior can be +// invoked in the overridden function by calling OnRender() + +void wxFrameManager::Render(wxDC* dc) +{ + wxFrameManagerEvent e(wxEVT_AUI_RENDER); + e.SetDC(dc); + ProcessMgrEvent(e); +} + void wxFrameManager::Repaint(wxDC* dc) { #ifdef __WXMAC__ @@ -3521,7 +3562,7 @@ void wxFrameManager::OnChildFocus(wxChildFocusEvent& event) void wxFrameManager::OnPaneButton(wxFrameManagerEvent& evt) { wxASSERT_MSG(evt.pane, wxT("Pane Info passed to wxFrameManager::OnPaneButton must be non-null")); - + wxPaneInfo& pane = *(evt.pane); if (evt.button == wxPaneInfo::buttonClose) @@ -3530,7 +3571,7 @@ void wxFrameManager::OnPaneButton(wxFrameManagerEvent& evt) wxFrameManagerEvent e(wxEVT_AUI_PANECLOSE); e.SetPane(evt.pane); ProcessMgrEvent(e); - + if (!e.GetVeto()) { pane.Hide();