void wxDynamicSashWindowImpl::OnMouseMove(wxMouseEvent &event) { if (m_dragging) { DrawSash(m_drag_x, m_drag_y); m_drag_x = event.m_x; m_drag_y = event.m_y; DrawSash(m_drag_x, m_drag_y); } else if (m_leaf) { m_leaf->OnMouseMove(event); } }
void wxSashWindow::DrawSashes(wxDC& dc) { int i; for (i = 0; i < 4; i++) if (m_sashes[i].m_show) DrawSash((wxSashEdgePosition) i, dc); }
void wxSplitWindow::RedrawIfHotSensitive (bool isHot) { if (wxRendererNative::Get().GetSplitterParams(this).isHotSensitive ) { m_isHot = isHot; wxClientDC dc(this); DrawSash(dc); } //else: we don't change our appearance, don't redraw to avoid flicker }
static void PanedDisplay(void *recordPtr, Drawable d) { Paned *pw = recordPtr; int i, nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; TtkWidgetDisplay(recordPtr, d); for (i = 0; i < nSashes; ++i) { DrawSash(pw, i, d); } }
void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); #ifdef __WXOSX__ // as subpanels might have a transparent background we must erase the background // at least on OSX, otherwise traces of the sash will remain // test with: splitter sample->replace right window dc.Clear(); #endif DrawSash(dc); }
void wxDynamicSashWindowImpl::OnPress(wxMouseEvent &event) { if (m_leaf) { m_leaf->OnPress(event); } else { m_dragging = m_split; m_drag_x = event.m_x; m_drag_y = event.m_y; DrawSash(m_drag_x, m_drag_y); m_container->CaptureMouse(); } }
void wxDynamicSashWindowImpl::OnRelease(wxMouseEvent &event) { if ((m_dragging == DSR_CORNER) && (m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0) { DrawSash(m_drag_x, m_drag_y); m_container->ReleaseMouse(); Resize(event.m_x, event.m_y); m_dragging = DSR_NONE; } else if (m_dragging) { DrawSash(m_drag_x, m_drag_y); m_container->ReleaseMouse(); wxSize size = m_container->GetSize(); int px = (int)((event.m_x * 100) / size.GetWidth() + 0.5); int py = (int)((event.m_y * 100) / size.GetHeight() + 0.5); if ((m_dragging == DSR_HORIZONTAL_TAB && py >= 10 && py <= 90) || (m_dragging == DSR_VERTICAL_TAB && px >= 10 && px <= 90)) { if (m_child[0] == NULL) { Split(px, py); } else { /* It would be nice if moving *this* sash didn't implicitly move the sashes of our children (if any). But this will do. */ wxLayoutConstraints *layout = m_child[0]->m_container->GetConstraints(); if (m_split == DSR_HORIZONTAL_TAB) { layout->height.PercentOf(m_container, wxHeight, py); } else { layout->width.PercentOf(m_container, wxWidth, px); } m_container->Layout(); } } else { if (m_child[0] != NULL) { if ((m_dragging == DSR_HORIZONTAL_TAB && py <= 10) || (m_dragging == DSR_VERTICAL_TAB && px <= 10)) { Unify(1); } else { Unify(0); } } } wxCursor cursor; if (m_split == DSR_HORIZONTAL_TAB) cursor = wxCursor(wxCURSOR_SIZENS); else if (m_split == DSR_VERTICAL_TAB) cursor = wxCursor(wxCURSOR_SIZEWE); else cursor = wxCursor(wxCURSOR_ARROW); m_container->SetCursor(cursor); m_dragging = DSR_NONE; } else if (m_leaf) { m_leaf->OnRelease(event); } }
// Position and size subwindows. // Note that the border size applies to each subwindow, not // including the edges next to the sash. void wxSplitterWindow::SizeWindows() { // check if we have delayed setting the real sash position if ( m_requestedSashPosition != INT_MAX ) { int newSashPosition = ConvertSashPosition(m_requestedSashPosition); if ( newSashPosition != m_sashPosition ) { DoSetSashPosition(newSashPosition); } if ( newSashPosition <= m_sashPosition && newSashPosition >= m_sashPosition - GetBorderSize() ) { // don't update it any more m_requestedSashPosition = INT_MAX; } } int w, h; GetClientSize(&w, &h); if ( GetWindow1() && !GetWindow2() ) { GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(), w - 2*GetBorderSize(), h - 2*GetBorderSize()); } else if ( GetWindow1() && GetWindow2() ) { const int border = GetBorderSize(), sash = GetSashSize(); int size1 = GetSashPosition() - border, size2 = GetSashPosition() + sash; int x2, y2, w1, h1, w2, h2; if ( GetSplitMode() == wxSPLIT_VERTICAL ) { w1 = size1; w2 = w - 2*border - sash - w1; if (w2 < 0) w2 = 0; h2 = h - 2*border; if (h2 < 0) h2 = 0; h1 = h2; x2 = size2; y2 = border; } else // horz splitter { w2 = w - 2*border; if (w2 < 0) w2 = 0; w1 = w2; h1 = size1; h2 = h - 2*border - sash - h1; if (h2 < 0) h2 = 0; x2 = border; y2 = size2; } GetWindow2()->SetSize(x2, y2, w2, h2); GetWindow1()->SetSize(border, border, w1, h1); } wxClientDC dc(this); DrawSash(dc); }
void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); DrawSash(dc); }
// Position and size subwindows. // Note that the border size applies to each subwindow, not // including the edges next to the sash. void wxSplitWindow::SizeWindows() { // check if we have delayed setting the real sash position if (m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX) { int newSashPosition = ConvertSashPosition (m_requestedSashPosition); if (newSashPosition != m_sashPosition) DoSetSashPosition (newSashPosition); if (newSashPosition <= m_sashPosition && newSashPosition >= m_sashPosition - GetBorderSize()) { // don't update it any more m_requestedSashPosition = INT_MAX; } } int w, h; GetClientSize(&w, &h); const int border = GetBorderSize(); const int sash = GetSashSize(); if (m_windowOne && m_windowTwo) { int size = GetWindowSize(); int size1; int size2; if (m_sashPosition == 0) { size1 = 0; size2 = size - 2*border; }else if (m_sashPosition > 0 && m_sashPosition < size) { size1 = m_sashPosition - border; size2 = size - m_sashPosition - sash - border; }else{ size1 = size; size2 = 0 - 2*border; } int x2, y2, w1, h1, w2, h2; if (m_splitMode == wxSPLIT_VERTICAL) { w1 = size1; w2 = size2; h1 = h - 2*border; h2 = h1; x2 = size - (size2 - border); y2 = border; } else // horz splitwindow { w1 = w - 2*border; w2 = w1; h1 = size1; h2 = size2; x2 = border; y2 = size - (size2 - border); } m_windowOne->SetSize (border, border, w1, h1); m_windowTwo->SetSize (x2, y2, w2, h2); } wxClientDC dc(this); DrawSash(dc); SetNeedUpdating (false); }