X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/41286fd1def19641be3ae5bb9666c84a1c0b5525..af01f1ba0d697c07173f436ab661b4c833258a91:/contrib/src/gizmos/dynamicsash.cpp?ds=sidebyside diff --git a/contrib/src/gizmos/dynamicsash.cpp b/contrib/src/gizmos/dynamicsash.cpp index 37d37bf15c..9317b5f4f0 100644 --- a/contrib/src/gizmos/dynamicsash.cpp +++ b/contrib/src/gizmos/dynamicsash.cpp @@ -10,6 +10,23 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ + #pragma implementation "splittree.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers (this file is usually all you +// need because it includes almost all "standard" wxWindows headers) +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + #include "wx/gizmos/dynamicsash.h" /* @@ -83,8 +100,9 @@ class wxDynamicSashReparentEvent : public wxEvent { public: wxDynamicSashReparentEvent(); wxDynamicSashReparentEvent(wxObject *object); + wxDynamicSashReparentEvent(const wxDynamicSashReparentEvent& evt); - virtual wxEvent* Clone() const { return NULL; } + virtual wxEvent* Clone() const { return new wxDynamicSashReparentEvent(*this); } DECLARE_DYNAMIC_CLASS(wxDynamicSashReparentEvent); }; @@ -330,7 +348,8 @@ void wxDynamicSashWindowImpl::DrawSash(int x, int y) const { dc.SetBrush(brush); dc.SetLogicalFunction(wxXOR); - if (m_dragging == DSR_CORNER) { + if ((m_dragging == DSR_CORNER) && + (m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0) { int cx = 0; int cy = 0; @@ -532,7 +551,6 @@ void wxDynamicSashWindowImpl::Unify(int panel) { } void wxDynamicSashWindowImpl::Split(int px, int py) { - m_window->Hide(); m_add_child_target = NULL; @@ -579,10 +597,9 @@ void wxDynamicSashWindowImpl::Split(int px, int py) { m_leaf = NULL; m_container->Layout(); - - m_window->Show(); } + /* This code is called when you finish resizing a view by dragging the corner tab, but I think this implementation is lousy and will surprise the user more often than it will do what they are trying to do. What @@ -774,7 +791,8 @@ void wxDynamicSashWindowImpl::OnPress(wxMouseEvent &event) { } void wxDynamicSashWindowImpl::OnRelease(wxMouseEvent &event) { - if (m_dragging == DSR_CORNER) { + if ((m_dragging == DSR_CORNER) && + (m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0) { DrawSash(m_drag_x, m_drag_y); m_container->ReleaseMouse(); @@ -876,7 +894,7 @@ bool wxDynamicSashWindowLeaf::Create() { m_viewport->SetEventHandler(this); Connect(-1, wxEVT_DYNAMIC_SASH_REPARENT, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnReparent); - if (m_impl->m_window->GetWindowStyle() & wxMANAGE_SCROLLBARS) { + if (m_impl->m_window->GetWindowStyle() & wxDS_MANAGE_SCROLLBARS) { m_hscroll->SetEventHandler(this); m_vscroll->SetEventHandler(this); @@ -973,7 +991,7 @@ DynamicSashRegion wxDynamicSashWindowLeaf::GetRegion(int x, int y) { void wxDynamicSashWindowLeaf::ResizeChild(wxSize size) { if (m_child) { - if (m_impl->m_window->GetWindowStyle() & wxMANAGE_SCROLLBARS) { + if (m_impl->m_window->GetWindowStyle() & wxDS_MANAGE_SCROLLBARS) { m_child->SetSize(size); wxSize best_size = m_child->GetBestSize(); if (best_size.GetWidth() < size.GetWidth()) { @@ -1084,7 +1102,6 @@ void wxDynamicSashWindowLeaf::OnPaint(wxPaintEvent &event) { dc.DrawLine(9, h - sh - 3, 9, h - 4); dc.DrawLine(9, h - 4, 3, h - 4); - int cy = (h - sh + h - 6) / 2 + 1; int cx = (w - sw + w - 6) / 2 + 1; int sy = cy; @@ -1137,7 +1154,8 @@ void wxDynamicSashWindowLeaf::OnMouseMove(wxMouseEvent &event) { cursor = wxCursor(wxCURSOR_SIZENS); } else if (region == DSR_VERTICAL_TAB) { cursor = wxCursor(wxCURSOR_SIZEWE); - } else if (region == DSR_CORNER) { + } else if ((region == DSR_CORNER) && + (m_impl->m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0) { cursor = wxCursor(wxCURSOR_SIZENWSE); } else if (region == DSR_LEFT_EDGE || region == DSR_TOP_EDGE || region == DSR_RIGHT_EDGE || region == DSR_BOTTOM_EDGE) { @@ -1162,6 +1180,9 @@ void wxDynamicSashWindowLeaf::OnLeave(wxMouseEvent &event) { void wxDynamicSashWindowLeaf::OnPress(wxMouseEvent &event) { DynamicSashRegion region = GetRegion(event.m_x, event.m_y); + if ((region == DSR_CORNER) && (m_impl->m_window->GetWindowStyle() & wxDS_DRAG_CORNER) == 0) + return; + if (region == DSR_HORIZONTAL_TAB || region == DSR_VERTICAL_TAB || region == DSR_CORNER) { m_impl->m_dragging = region; m_impl->m_drag_x = event.m_x; @@ -1239,6 +1260,11 @@ wxDynamicSashReparentEvent::wxDynamicSashReparentEvent(wxObject *object) { m_eventType = wxEVT_DYNAMIC_SASH_REPARENT; } +wxDynamicSashReparentEvent::wxDynamicSashReparentEvent(const wxDynamicSashReparentEvent& evt) + : wxEvent(evt) +{ +} + IMPLEMENT_DYNAMIC_CLASS(wxDynamicSashReparentEvent, wxEvent) /////////////////////////////////////////////////////////////////////////////