#include "wx/settings.h"
#endif
+#ifdef __WXMAC__
+ #include "wx/mac/private.h"
+#endif
+
#include "wx/renderer.h"
#include "wx/splitter.h"
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();
}
// following the mouse movement while it drags the sash, without it we only
// draw the sash at the new position but only resize the windows when the
// dragging is finished
+#if defined( __WXMAC__ ) && TARGET_API_MAC_OSX == 1
+ bool isLive = true ;
+#else
bool isLive = (GetWindowStyleFlag() & wxSP_LIVE_UPDATE) != 0;
-
+#endif
if (event.LeftDown())
{
if ( SashHitTest(x, y) )
{
// 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;
}
if ( minSize == -1 || m_minimumPaneSize > minSize )
minSize = m_minimumPaneSize;
- int maxSize = window_size - minSize - GetBorderSize();
+ int maxSize = window_size - minSize - GetBorderSize() - GetSashSize();
if ( sashPos > maxSize )
sashPos = maxSize;
}
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();