IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
/*
- TODO PROPERTIES
- style wxSP_3D
- sashpos (long , 0 )
- minsize (long -1 )
- object, object_ref
- orientation
+ TODO PROPERTIES
+ style wxSP_3D
+ sashpos (long , 0 )
+ minsize (long -1 )
+ object, object_ref
+ orientation
*/
IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent)
SizeWindows();
return; // it won't needUpdating in this case
}
-
+
if (m_needUpdating)
SizeWindows();
}
{
// Start the drag now
m_dragMode = wxSPLIT_DRAG_DRAGGING;
-
+
// Capture mouse and set the cursor
CaptureMouse();
SetResizeCursor();
{
// We can stop dragging now and see what we've got.
m_dragMode = wxSPLIT_DRAG_NONE;
-
+
// Release mouse and unset the cursor
ReleaseMouse();
SetCursor(* wxSTANDARD_CURSOR);
int z = m_splitMode == wxSPLIT_VERTICAL ? x : y;
int hitMin = m_sashPosition - tolerance;
int hitMax = m_sashPosition + GetSashSize() + tolerance;
-
+
return z >= hitMin && z <= hitMax;
}
void wxSplitterWindow::SetSashPositionAndNotify(int sashPos)
{
+ // we must reset the request here, otherwise the sash would be stuck at
+ // old position if the user attempted to move the sash after invalid
+ // (e.g. smaller than minsize) sash position was requested using
+ // SetSashPosition():
+ m_requestedSashPosition = INT_MAX;
+
if ( DoSetSashPosition(sashPos) )
{
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, this);
// Set pane for unsplit window
void wxSplitterWindow::Initialize(wxWindow *window)
{
- wxASSERT_MSG( window && window->GetParent() == this,
+ wxASSERT_MSG( (!window || (window && window->GetParent() == this)),
_T("windows in the splitter should have it as parent!") );
m_windowOne = window;
// right now (e.g. because the window is too small)
m_requestedSashPosition = sashPosition;
m_checkRequestedSashPosition = false;
-
+
DoSetSashPosition(ConvertSashPosition(sashPosition));
SizeWindows();
// right now (e.g. because the window is too small)
m_requestedSashPosition = position;
m_checkRequestedSashPosition = false;
-
+
DoSetSashPosition(ConvertSashPosition(position));
if ( redraw )
}
}
+// Make sure the child window sizes are updated. This is useful
+// for reducing flicker by updating the sizes before a
+// window is shown, if you know the overall size is correct.
+void wxSplitterWindow::UpdateSize()
+{
+ m_checkRequestedSashPosition = true;
+ SizeWindows();
+ m_checkRequestedSashPosition = false;
+}
+
bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event)
{
return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();