Corrected cursors for during capture mouse.
Added wxSP_LIVE_UPADTE to splitter. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5df1250b30
commit
72195a0fd2
@ -745,6 +745,7 @@ typedef wxUint16 wxWord;
|
||||
#define wxSP_3D 0x0004
|
||||
#define wxSP_BORDER 0x0008
|
||||
#define wxSP_PERMIT_UNSPLIT 0x0010
|
||||
#define wxSP_LIVE_UPDATE 0x0020
|
||||
|
||||
/*
|
||||
* wxFrame extra flags
|
||||
|
@ -160,6 +160,9 @@ public:
|
||||
// Adjusts the panes
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// In live mode, resize child windows in idle time
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Draws borders
|
||||
void DrawBorders(wxDC& dc);
|
||||
|
||||
@ -189,6 +192,7 @@ protected:
|
||||
|
||||
int m_splitMode;
|
||||
bool m_permitUnsplitAlways;
|
||||
bool m_needUpdating; // when in live mode, set the to TRUE to resize children in idle
|
||||
wxWindow* m_windowOne;
|
||||
wxWindow* m_windowTwo;
|
||||
int m_dragMode;
|
||||
|
@ -35,7 +35,8 @@ public:
|
||||
class MySplitterWindow : public wxSplitterWindow
|
||||
{
|
||||
public:
|
||||
MySplitterWindow(wxFrame *parent, wxWindowID id) : wxSplitterWindow(parent, id)
|
||||
MySplitterWindow(wxFrame *parent, wxWindowID id)
|
||||
: wxSplitterWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_LIVE_UPDATE)
|
||||
{
|
||||
m_frame = parent;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent)
|
||||
BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
|
||||
EVT_PAINT(wxSplitterWindow::OnPaint)
|
||||
EVT_SIZE(wxSplitterWindow::OnSize)
|
||||
EVT_IDLE(wxSplitterWindow::OnIdle)
|
||||
EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
|
||||
|
||||
EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged)
|
||||
@ -72,6 +73,7 @@ wxSplitterWindow::wxSplitterWindow()
|
||||
m_facePen = (wxPen *) NULL;
|
||||
m_hilightPen = (wxPen *) NULL;
|
||||
m_minimumPaneSize = 0;
|
||||
m_needUpdating = FALSE;
|
||||
}
|
||||
|
||||
wxSplitterWindow::wxSplitterWindow(wxWindow *parent, wxWindowID id,
|
||||
@ -125,6 +127,8 @@ wxSplitterWindow::wxSplitterWindow(wxWindow *parent, wxWindowID id,
|
||||
|
||||
// For debugging purposes, to see the background.
|
||||
// SetBackground(wxBLUE_BRUSH);
|
||||
|
||||
m_needUpdating = FALSE;
|
||||
}
|
||||
|
||||
wxSplitterWindow::~wxSplitterWindow()
|
||||
@ -149,6 +153,11 @@ void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
DrawSash(dc);
|
||||
}
|
||||
|
||||
void wxSplitterWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||
{
|
||||
if (m_needUpdating)
|
||||
SizeWindows();
|
||||
}
|
||||
|
||||
void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
@ -163,15 +172,6 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
SetCursor(wxCursor());
|
||||
#endif
|
||||
|
||||
// under wxGTK the method above causes the mouse
|
||||
// to flicker so we set the standard cursor only
|
||||
// when leaving the window and when moving over
|
||||
// non-sash parts of the window. this should work
|
||||
// on the other platforms as well, but who knows.
|
||||
#ifdef __WXGTK__
|
||||
if (event.Leaving())
|
||||
SetCursor(* wxSTANDARD_CURSOR);
|
||||
#endif
|
||||
|
||||
if (event.LeftDown())
|
||||
{
|
||||
@ -181,7 +181,11 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
|
||||
m_dragMode = wxSPLIT_DRAG_DRAGGING;
|
||||
|
||||
DrawSashTracker(x, y);
|
||||
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
|
||||
{
|
||||
DrawSashTracker(x, y);
|
||||
}
|
||||
|
||||
m_oldX = x;
|
||||
m_oldY = y;
|
||||
return;
|
||||
@ -194,7 +198,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
ReleaseMouse();
|
||||
|
||||
// Erase old tracker
|
||||
DrawSashTracker(m_oldX, m_oldY);
|
||||
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
|
||||
{
|
||||
DrawSashTracker(m_oldX, m_oldY);
|
||||
}
|
||||
|
||||
// Obtain window size. We are only interested in the dimension the sash
|
||||
// splits up
|
||||
@ -293,7 +300,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
}
|
||||
|
||||
// Erase old tracker
|
||||
DrawSashTracker(m_oldX, m_oldY);
|
||||
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
|
||||
{
|
||||
DrawSashTracker(m_oldX, m_oldY);
|
||||
}
|
||||
|
||||
if (m_splitMode == wxSPLIT_VERTICAL)
|
||||
x = new_sash_position;
|
||||
@ -321,7 +331,15 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
#endif // __WXMSW__
|
||||
|
||||
// Draw new one
|
||||
DrawSashTracker(m_oldX, m_oldY);
|
||||
if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
|
||||
{
|
||||
DrawSashTracker(m_oldX, m_oldY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sashPosition = new_sash_position;
|
||||
m_needUpdating = TRUE;
|
||||
}
|
||||
}
|
||||
else if ( event.LeftDClick() )
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ extern wxList wxPendingDelete;
|
||||
extern bool g_blockEventsOnDrag;
|
||||
extern bool g_blockEventsOnScroll;
|
||||
extern wxCursor g_globalCursor;
|
||||
static bool g_capturing = FALSE;
|
||||
static wxWindow *g_captureWindow = (wxWindow*) NULL;
|
||||
static wxWindow *g_focusWindow = (wxWindow*) NULL;
|
||||
|
||||
/* hack: we need something to pass to gtk_menu_popup, so we store the time of
|
||||
@ -899,7 +899,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
if (!g_captureWindow)
|
||||
{
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
@ -1009,7 +1009,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
if (!g_captureWindow)
|
||||
{
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
@ -1120,7 +1120,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
if (!g_captureWindow)
|
||||
{
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
@ -2063,18 +2063,18 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
|
||||
void wxWindow::OnInternalIdle()
|
||||
{
|
||||
GdkWindow *window = GetConnectWidget()->window;
|
||||
if (window)
|
||||
{
|
||||
wxCursor cursor = m_cursor;
|
||||
if (g_globalCursor.Ok()) cursor = g_globalCursor;
|
||||
GdkWindow *window = GetConnectWidget()->window;
|
||||
if (window)
|
||||
{
|
||||
wxCursor cursor = m_cursor;
|
||||
if (g_globalCursor.Ok()) cursor = g_globalCursor;
|
||||
|
||||
if (m_currentGdkCursor != cursor)
|
||||
{
|
||||
gdk_window_set_cursor( window, cursor.GetCursor() );
|
||||
m_currentGdkCursor = cursor;
|
||||
if (m_currentGdkCursor != cursor)
|
||||
{
|
||||
gdk_window_set_cursor( window, cursor.GetCursor() );
|
||||
m_currentGdkCursor = cursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateWindowUI();
|
||||
}
|
||||
@ -2803,35 +2803,33 @@ void wxWindow::CaptureMouse()
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
||||
|
||||
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
|
||||
wxCHECK_RET( g_captureWindow == NULL, _T("CaptureMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
|
||||
gtk_grab_add( connect_widget );
|
||||
gdk_pointer_grab( connect_widget->window, FALSE,
|
||||
(GdkEventMask)
|
||||
(GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK),
|
||||
(GdkWindow *) NULL,
|
||||
(GdkCursor *) NULL,
|
||||
m_cursor.GetCursor(),
|
||||
GDK_CURRENT_TIME );
|
||||
g_capturing = TRUE;
|
||||
g_captureWindow = this;
|
||||
}
|
||||
|
||||
void wxWindow::ReleaseMouse()
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
||||
|
||||
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
|
||||
wxCHECK_RET( g_captureWindow, _T("ReleaseMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
|
||||
gtk_grab_remove( connect_widget );
|
||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||
g_capturing = FALSE;
|
||||
g_captureWindow = (wxWindow*) NULL;
|
||||
}
|
||||
|
||||
bool wxWindow::IsRetained() const
|
||||
|
@ -131,7 +131,7 @@ extern wxList wxPendingDelete;
|
||||
extern bool g_blockEventsOnDrag;
|
||||
extern bool g_blockEventsOnScroll;
|
||||
extern wxCursor g_globalCursor;
|
||||
static bool g_capturing = FALSE;
|
||||
static wxWindow *g_captureWindow = (wxWindow*) NULL;
|
||||
static wxWindow *g_focusWindow = (wxWindow*) NULL;
|
||||
|
||||
/* hack: we need something to pass to gtk_menu_popup, so we store the time of
|
||||
@ -899,7 +899,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
if (!g_captureWindow)
|
||||
{
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
@ -1009,7 +1009,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
if (!g_captureWindow)
|
||||
{
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
@ -1120,7 +1120,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
||||
// Some control don't have their own X window and thus cannot get
|
||||
// any events.
|
||||
|
||||
if (!g_capturing)
|
||||
if (!g_captureWindow)
|
||||
{
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
@ -2063,18 +2063,18 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
|
||||
void wxWindow::OnInternalIdle()
|
||||
{
|
||||
GdkWindow *window = GetConnectWidget()->window;
|
||||
if (window)
|
||||
{
|
||||
wxCursor cursor = m_cursor;
|
||||
if (g_globalCursor.Ok()) cursor = g_globalCursor;
|
||||
GdkWindow *window = GetConnectWidget()->window;
|
||||
if (window)
|
||||
{
|
||||
wxCursor cursor = m_cursor;
|
||||
if (g_globalCursor.Ok()) cursor = g_globalCursor;
|
||||
|
||||
if (m_currentGdkCursor != cursor)
|
||||
{
|
||||
gdk_window_set_cursor( window, cursor.GetCursor() );
|
||||
m_currentGdkCursor = cursor;
|
||||
if (m_currentGdkCursor != cursor)
|
||||
{
|
||||
gdk_window_set_cursor( window, cursor.GetCursor() );
|
||||
m_currentGdkCursor = cursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateWindowUI();
|
||||
}
|
||||
@ -2803,35 +2803,33 @@ void wxWindow::CaptureMouse()
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
||||
|
||||
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
|
||||
wxCHECK_RET( g_captureWindow == NULL, _T("CaptureMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
|
||||
gtk_grab_add( connect_widget );
|
||||
gdk_pointer_grab( connect_widget->window, FALSE,
|
||||
(GdkEventMask)
|
||||
(GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK),
|
||||
(GdkWindow *) NULL,
|
||||
(GdkCursor *) NULL,
|
||||
m_cursor.GetCursor(),
|
||||
GDK_CURRENT_TIME );
|
||||
g_capturing = TRUE;
|
||||
g_captureWindow = this;
|
||||
}
|
||||
|
||||
void wxWindow::ReleaseMouse()
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
||||
|
||||
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
|
||||
wxCHECK_RET( g_captureWindow, _T("ReleaseMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
|
||||
gtk_grab_remove( connect_widget );
|
||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||
g_capturing = FALSE;
|
||||
g_captureWindow = (wxWindow*) NULL;
|
||||
}
|
||||
|
||||
bool wxWindow::IsRetained() const
|
||||
|
Loading…
Reference in New Issue
Block a user