Added wxDS_DRAG_CORNER so the corner dragging can be turned off.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
for instance, you wish to scroll a subwindow of the view you add to
|
for instance, you wish to scroll a subwindow of the view you add to
|
||||||
your wxDynamicSashWindow object, rather than scrolling the whole view.)
|
your wxDynamicSashWindow object, rather than scrolling the whole view.)
|
||||||
In this case, you will need to construct your wxDynamicSashWindow without
|
In this case, you will need to construct your wxDynamicSashWindow without
|
||||||
the wxMANAGE_SCROLLBARS style and you will need to use the
|
the wxDS_MANAGE_SCROLLBARS style and you will need to use the
|
||||||
GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
|
GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
|
||||||
controls and call SetEventHanler() on them to redirect the scrolling
|
controls and call SetEventHanler() on them to redirect the scrolling
|
||||||
events whenever your window is reparented by wxDyanmicSashWindow.
|
events whenever your window is reparented by wxDyanmicSashWindow.
|
||||||
@@ -73,11 +73,19 @@ class wxScrollBar;
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
wxMANAGE_SCROLLBARS is a default style of wxDynamicSashWindow which
|
wxDS_MANAGE_SCROLLBARS is a default style of wxDynamicSashWindow which
|
||||||
will cause it to respond to scrollbar events for your application by
|
will cause it to respond to scrollbar events for your application by
|
||||||
automatically scrolling the child view.
|
automatically scrolling the child view.
|
||||||
*/
|
*/
|
||||||
#define wxMANAGE_SCROLLBARS 0x00800000
|
#define wxDS_MANAGE_SCROLLBARS 0x0010
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
wxDS_DRAG_CORNER style indicates that the views can also be resized by
|
||||||
|
dragging the corner piece between the scrollbars, and which is reflected up
|
||||||
|
to the frame if necessary.
|
||||||
|
*/
|
||||||
|
#define wxDS_DRAG_CORNER 0x0020
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -129,13 +137,13 @@ public:
|
|||||||
wxDynamicSashWindow();
|
wxDynamicSashWindow();
|
||||||
wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
|
wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
long style = wxCLIP_CHILDREN | wxMANAGE_SCROLLBARS,
|
long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
|
||||||
const wxString& name = "dynamicSashWindow");
|
const wxString& name = "dynamicSashWindow");
|
||||||
virtual ~wxDynamicSashWindow();
|
virtual ~wxDynamicSashWindow();
|
||||||
|
|
||||||
virtual bool Create(wxWindow *parent, wxWindowID id,
|
virtual bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
long style = wxCLIP_CHILDREN | wxMANAGE_SCROLLBARS,
|
long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
|
||||||
const wxString& name = "dynamicSashWindow");
|
const wxString& name = "dynamicSashWindow");
|
||||||
virtual wxScrollBar *GetHScrollBar(const wxWindow *child) const;
|
virtual wxScrollBar *GetHScrollBar(const wxWindow *child) const;
|
||||||
virtual wxScrollBar *GetVScrollBar(const wxWindow *child) const;
|
virtual wxScrollBar *GetVScrollBar(const wxWindow *child) const;
|
||||||
|
@@ -331,7 +331,8 @@ void wxDynamicSashWindowImpl::DrawSash(int x, int y) const {
|
|||||||
dc.SetBrush(brush);
|
dc.SetBrush(brush);
|
||||||
dc.SetLogicalFunction(wxXOR);
|
dc.SetLogicalFunction(wxXOR);
|
||||||
|
|
||||||
if (m_dragging == DSR_CORNER) {
|
if ((m_dragging == DSR_CORNER) &&
|
||||||
|
(m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0) {
|
||||||
int cx = 0;
|
int cx = 0;
|
||||||
int cy = 0;
|
int cy = 0;
|
||||||
|
|
||||||
@@ -533,7 +534,6 @@ void wxDynamicSashWindowImpl::Unify(int panel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxDynamicSashWindowImpl::Split(int px, int py) {
|
void wxDynamicSashWindowImpl::Split(int px, int py) {
|
||||||
m_window->Hide();
|
|
||||||
|
|
||||||
m_add_child_target = NULL;
|
m_add_child_target = NULL;
|
||||||
|
|
||||||
@@ -580,10 +580,9 @@ void wxDynamicSashWindowImpl::Split(int px, int py) {
|
|||||||
m_leaf = NULL;
|
m_leaf = NULL;
|
||||||
|
|
||||||
m_container->Layout();
|
m_container->Layout();
|
||||||
|
|
||||||
m_window->Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This code is called when you finish resizing a view by dragging the
|
/* 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
|
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
|
the user more often than it will do what they are trying to do. What
|
||||||
@@ -775,7 +774,8 @@ void wxDynamicSashWindowImpl::OnPress(wxMouseEvent &event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxDynamicSashWindowImpl::OnRelease(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);
|
DrawSash(m_drag_x, m_drag_y);
|
||||||
m_container->ReleaseMouse();
|
m_container->ReleaseMouse();
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ bool wxDynamicSashWindowLeaf::Create() {
|
|||||||
m_viewport->SetEventHandler(this);
|
m_viewport->SetEventHandler(this);
|
||||||
Connect(-1, wxEVT_DYNAMIC_SASH_REPARENT, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnReparent);
|
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_hscroll->SetEventHandler(this);
|
||||||
m_vscroll->SetEventHandler(this);
|
m_vscroll->SetEventHandler(this);
|
||||||
|
|
||||||
@@ -974,7 +974,7 @@ DynamicSashRegion wxDynamicSashWindowLeaf::GetRegion(int x, int y) {
|
|||||||
|
|
||||||
void wxDynamicSashWindowLeaf::ResizeChild(wxSize size) {
|
void wxDynamicSashWindowLeaf::ResizeChild(wxSize size) {
|
||||||
if (m_child) {
|
if (m_child) {
|
||||||
if (m_impl->m_window->GetWindowStyle() & wxMANAGE_SCROLLBARS) {
|
if (m_impl->m_window->GetWindowStyle() & wxDS_MANAGE_SCROLLBARS) {
|
||||||
m_child->SetSize(size);
|
m_child->SetSize(size);
|
||||||
wxSize best_size = m_child->GetBestSize();
|
wxSize best_size = m_child->GetBestSize();
|
||||||
if (best_size.GetWidth() < size.GetWidth()) {
|
if (best_size.GetWidth() < size.GetWidth()) {
|
||||||
@@ -1085,7 +1085,6 @@ void wxDynamicSashWindowLeaf::OnPaint(wxPaintEvent &event) {
|
|||||||
dc.DrawLine(9, h - sh - 3, 9, h - 4);
|
dc.DrawLine(9, h - sh - 3, 9, h - 4);
|
||||||
dc.DrawLine(9, h - 4, 3, h - 4);
|
dc.DrawLine(9, h - 4, 3, h - 4);
|
||||||
|
|
||||||
|
|
||||||
int cy = (h - sh + h - 6) / 2 + 1;
|
int cy = (h - sh + h - 6) / 2 + 1;
|
||||||
int cx = (w - sw + w - 6) / 2 + 1;
|
int cx = (w - sw + w - 6) / 2 + 1;
|
||||||
int sy = cy;
|
int sy = cy;
|
||||||
@@ -1138,7 +1137,8 @@ void wxDynamicSashWindowLeaf::OnMouseMove(wxMouseEvent &event) {
|
|||||||
cursor = wxCursor(wxCURSOR_SIZENS);
|
cursor = wxCursor(wxCURSOR_SIZENS);
|
||||||
} else if (region == DSR_VERTICAL_TAB) {
|
} else if (region == DSR_VERTICAL_TAB) {
|
||||||
cursor = wxCursor(wxCURSOR_SIZEWE);
|
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);
|
cursor = wxCursor(wxCURSOR_SIZENWSE);
|
||||||
} else if (region == DSR_LEFT_EDGE || region == DSR_TOP_EDGE
|
} else if (region == DSR_LEFT_EDGE || region == DSR_TOP_EDGE
|
||||||
|| region == DSR_RIGHT_EDGE || region == DSR_BOTTOM_EDGE) {
|
|| region == DSR_RIGHT_EDGE || region == DSR_BOTTOM_EDGE) {
|
||||||
@@ -1163,6 +1163,9 @@ void wxDynamicSashWindowLeaf::OnLeave(wxMouseEvent &event) {
|
|||||||
void wxDynamicSashWindowLeaf::OnPress(wxMouseEvent &event) {
|
void wxDynamicSashWindowLeaf::OnPress(wxMouseEvent &event) {
|
||||||
DynamicSashRegion region = GetRegion(event.m_x, event.m_y);
|
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) {
|
if (region == DSR_HORIZONTAL_TAB || region == DSR_VERTICAL_TAB || region == DSR_CORNER) {
|
||||||
m_impl->m_dragging = region;
|
m_impl->m_dragging = region;
|
||||||
m_impl->m_drag_x = event.m_x;
|
m_impl->m_drag_x = event.m_x;
|
||||||
|
Reference in New Issue
Block a user