1. status bar can now be positioned on top (and anywhere, in fact)
2. status bar without wxST_SIZEGRIP style won't have the size grip (wow) 3. scrollbars don't get the cursor of the main window any more 4. introduced wxSetCursorEvent and use it in wxSplitterWindow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6665 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -54,6 +54,8 @@ wxMSW:
|
|||||||
- support for enhanced metafiles added, support for copying/pasting metafiles
|
- support for enhanced metafiles added, support for copying/pasting metafiles
|
||||||
(WMF and enhanced ones) fixed/added.
|
(WMF and enhanced ones) fixed/added.
|
||||||
- implemented setting colours for push buttons
|
- implemented setting colours for push buttons
|
||||||
|
- wxStatusBar95 may be now used in dialogs, panels (not only frames) and can be
|
||||||
|
positioned along the top of the screen and not only at the bottom
|
||||||
- wxTreeCtrl::IsVisible() bug fixed (thanks to Gary Chessun)
|
- wxTreeCtrl::IsVisible() bug fixed (thanks to Gary Chessun)
|
||||||
- loading/saving big (> 32K) files in wxTextCtrl works
|
- loading/saving big (> 32K) files in wxTextCtrl works
|
||||||
- tooltips work with wxRadioBox
|
- tooltips work with wxRadioBox
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
|
#include "wx/cursor.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/thread.h"
|
#include "wx/thread.h"
|
||||||
@@ -118,6 +119,9 @@ enum
|
|||||||
wxEVT_KEY_DOWN = wxEVT_FIRST + 215,
|
wxEVT_KEY_DOWN = wxEVT_FIRST + 215,
|
||||||
wxEVT_KEY_UP = wxEVT_FIRST + 216,
|
wxEVT_KEY_UP = wxEVT_FIRST + 216,
|
||||||
|
|
||||||
|
/* Set cursor event */
|
||||||
|
wxEVT_SET_CURSOR = wxEVT_FIRST + 230,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxScrollbar and wxSlider event identifiers
|
* wxScrollbar and wxSlider event identifiers
|
||||||
*/
|
*/
|
||||||
@@ -714,6 +718,35 @@ public:
|
|||||||
bool m_metaDown;
|
bool m_metaDown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Cursor set event
|
||||||
|
|
||||||
|
/*
|
||||||
|
wxEVT_SET_CURSOR
|
||||||
|
*/
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxSetCursorEvent : public wxEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxSetCursorEvent(wxCoord x, wxCoord y)
|
||||||
|
{
|
||||||
|
m_eventType = wxEVT_SET_CURSOR;
|
||||||
|
|
||||||
|
m_x = x;
|
||||||
|
m_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxCoord GetX() const { return m_x; }
|
||||||
|
wxCoord GetY() const { return m_y; }
|
||||||
|
|
||||||
|
void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
|
||||||
|
const wxCursor& GetCursor() const { return m_cursor; }
|
||||||
|
bool HasCursor() const { return m_cursor.Ok(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxCoord m_x, m_y;
|
||||||
|
wxCursor m_cursor;
|
||||||
|
};
|
||||||
|
|
||||||
// Keyboard input event class
|
// Keyboard input event class
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1555,6 +1588,9 @@ typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&);
|
|||||||
typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
|
typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
|
||||||
typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
|
typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
|
||||||
typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
|
typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
|
||||||
|
typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
|
||||||
|
typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
|
||||||
|
typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
|
||||||
// N.B. In GNU-WIN32, you *have* to take the address of a member function
|
// N.B. In GNU-WIN32, you *have* to take the address of a member function
|
||||||
@@ -1613,8 +1649,9 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
|||||||
#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, (wxObject *) NULL },
|
#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, (wxObject *) NULL },
|
||||||
#define EVT_PALETTE_CHANGED(func) { wxEVT_PALETTE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaletteChangedEventFunction) & func, (wxObject *) NULL },
|
#define EVT_PALETTE_CHANGED(func) { wxEVT_PALETTE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaletteChangedEventFunction) & func, (wxObject *) NULL },
|
||||||
#define EVT_QUERY_NEW_PALETTE(func) { wxEVT_QUERY_NEW_PALETTE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
|
#define EVT_QUERY_NEW_PALETTE(func) { wxEVT_QUERY_NEW_PALETTE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
|
||||||
#define EVT_WINDOW_CREATE(func) { wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
|
#define EVT_WINDOW_CREATE(func) { wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxWindowCreateEventFunction) & func, (wxObject *) NULL },
|
||||||
#define EVT_WINDOW_DESTROY(func) { wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL },
|
#define EVT_WINDOW_DESTROY(func) { wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxWindowDestroyEventFunction) & func, (wxObject *) NULL },
|
||||||
|
#define EVT_SET_CURSOR(func) { wxEVT_SET_CURSOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSetCursorEventFunction) & func, (wxObject *) NULL },
|
||||||
|
|
||||||
// Mouse events
|
// Mouse events
|
||||||
#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },
|
#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },
|
||||||
|
@@ -187,6 +187,7 @@ protected:
|
|||||||
void OnSashPosChanging(wxSplitterEvent& event);
|
void OnSashPosChanging(wxSplitterEvent& event);
|
||||||
void OnDoubleClick(wxSplitterEvent& event);
|
void OnDoubleClick(wxSplitterEvent& event);
|
||||||
void OnUnsplitEvent(wxSplitterEvent& event);
|
void OnUnsplitEvent(wxSplitterEvent& event);
|
||||||
|
void OnSetCursor(wxSetCursorEvent& event);
|
||||||
|
|
||||||
void SendUnsplitEvent(wxWindow *winRemoved);
|
void SendUnsplitEvent(wxWindow *winRemoved);
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ public:
|
|||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
|
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
|
||||||
const wxSize& WXUNUSED(size) = wxDefaultSize,
|
const wxSize& WXUNUSED(size) = wxDefaultSize,
|
||||||
long style = 0,
|
long style = wxST_SIZEGRIP,
|
||||||
const wxString& name = wxPanelNameStr)
|
const wxString& name = wxPanelNameStr)
|
||||||
{
|
{
|
||||||
Create(parent, id, style, name);
|
Create(parent, id, style, name);
|
||||||
|
@@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
|
|||||||
EVT_IDLE(wxSplitterWindow::OnIdle)
|
EVT_IDLE(wxSplitterWindow::OnIdle)
|
||||||
EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
|
EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
|
||||||
|
|
||||||
|
EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor)
|
||||||
|
|
||||||
EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged)
|
EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged)
|
||||||
// NB: we borrow OnSashPosChanged for purposes of
|
// NB: we borrow OnSashPosChanged for purposes of
|
||||||
// EVT_SPLITTER_SASH_POS_CHANGING since default implementation is identical
|
// EVT_SPLITTER_SASH_POS_CHANGING since default implementation is identical
|
||||||
@@ -234,8 +236,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_permitUnsplitAlways
|
if ( m_permitUnsplitAlways || m_minimumPaneSize == 0 )
|
||||||
|| m_minimumPaneSize == 0 )
|
|
||||||
{
|
{
|
||||||
// Deal with possible unsplit scenarios
|
// Deal with possible unsplit scenarios
|
||||||
if ( new_sash_position == 0 )
|
if ( new_sash_position == 0 )
|
||||||
@@ -930,3 +931,21 @@ void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
|
|||||||
// for compatibility, call the virtual function
|
// for compatibility, call the virtual function
|
||||||
OnUnsplit(win);
|
OnUnsplit(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxSplitterWindow::OnSetCursor(wxSetCursorEvent& event)
|
||||||
|
{
|
||||||
|
// this is currently called (and needed) under MSW only...
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
|
||||||
|
// if we don't do it, the resizing cursor might be set for child window:
|
||||||
|
// and like this we explicitly say that our cursor should not be used for
|
||||||
|
// children windows which overlap us
|
||||||
|
|
||||||
|
if ( SashHitTest(event.GetX(), event.GetY()) )
|
||||||
|
{
|
||||||
|
// default processing is ok
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
//else: do nothing, in particular, don't call Skip()
|
||||||
|
#endif // wxMSW
|
||||||
|
}
|
||||||
|
@@ -109,8 +109,22 @@ bool wxStatusBar95::Create(wxWindow *parent,
|
|||||||
m_windowId = id == -1 ? NewControlId() : id;
|
m_windowId = id == -1 ? NewControlId() : id;
|
||||||
|
|
||||||
DWORD wstyle = WS_CHILD | WS_VISIBLE;
|
DWORD wstyle = WS_CHILD | WS_VISIBLE;
|
||||||
if ( style & wxST_SIZEGRIP )
|
|
||||||
|
// setting SBARS_SIZEGRIP is perfectly useless: it's always on by default
|
||||||
|
// (at least in the version of comctl32.dll I'm using), and the only way to
|
||||||
|
// turn it off is to use CCS_TOP style - as we position the status bar
|
||||||
|
// manually anyhow (see DoMoveWindow), use CCS_TOP style if wxST_SIZEGRIP
|
||||||
|
// is not given
|
||||||
|
if ( !(style & wxST_SIZEGRIP) )
|
||||||
|
{
|
||||||
|
wstyle |= CCS_TOP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// may be some versions of comctl32.dll do need it - anyhow, it won't
|
||||||
|
// do any harm
|
||||||
wstyle |= SBARS_SIZEGRIP;
|
wstyle |= SBARS_SIZEGRIP;
|
||||||
|
}
|
||||||
|
|
||||||
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
|
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
@@ -303,8 +317,19 @@ bool wxStatusBar95::GetFieldRect(int i, wxRect& rect) const
|
|||||||
|
|
||||||
void wxStatusBar95::DoMoveWindow(int x, int y, int width, int height)
|
void wxStatusBar95::DoMoveWindow(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
// the status bar wnd proc must be forwarded the WM_SIZE message whenever
|
||||||
|
// the stat bar position/size is changed because it normally positions the
|
||||||
|
// control itself along bottom or top side of the parent window - failing
|
||||||
|
// to do so will result in nasty visual effects
|
||||||
FORWARD_WM_SIZE(GetHwnd(), SIZE_RESTORED, x, y, SendMessage);
|
FORWARD_WM_SIZE(GetHwnd(), SIZE_RESTORED, x, y, SendMessage);
|
||||||
|
|
||||||
|
// but now, when the standard status bar wnd proc did all it wanted to do,
|
||||||
|
// move the status bar to its correct location - usually this call may be
|
||||||
|
// omitted because for normal status bars (positioned along the bottom
|
||||||
|
// edge) the position is already set correctly, but if the user wants to
|
||||||
|
// position them in some exotic location, this is really needed
|
||||||
|
wxWindow::DoMoveWindow(x, y, width, height);
|
||||||
|
|
||||||
// adjust fields widths to the new size
|
// adjust fields widths to the new size
|
||||||
SetFieldsWidth();
|
SetFieldsWidth();
|
||||||
}
|
}
|
||||||
|
@@ -2667,13 +2667,48 @@ bool wxWindow::HandleSetCursor(WXHWND hWnd,
|
|||||||
int WXUNUSED(mouseMsg))
|
int WXUNUSED(mouseMsg))
|
||||||
{
|
{
|
||||||
// the logic is as follows:
|
// the logic is as follows:
|
||||||
|
// -1. don't set cursor for non client area, including but not limited to
|
||||||
|
// the title bar, scrollbars, &c
|
||||||
|
// 0. allow the user to override default behaviour by using EVT_SET_CURSOR
|
||||||
// 1. if we have the cursor set it unless wxIsBusy()
|
// 1. if we have the cursor set it unless wxIsBusy()
|
||||||
// 2. if we're a top level window, set some cursor anyhow
|
// 2. if we're a top level window, set some cursor anyhow
|
||||||
// 3. if wxIsBusy(), set the busy cursor, otherwise the global one
|
// 3. if wxIsBusy(), set the busy cursor, otherwise the global one
|
||||||
|
|
||||||
|
if ( nHitTest != HTCLIENT )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
HCURSOR hcursor = 0;
|
HCURSOR hcursor = 0;
|
||||||
|
|
||||||
|
// first ask the user code - it may wish to set the cursor in some very
|
||||||
|
// specific way (for example, depending on the current position)
|
||||||
|
POINT pt;
|
||||||
|
if ( !::GetCursorPos(&pt) )
|
||||||
|
{
|
||||||
|
wxLogLastError("GetCursorPos");
|
||||||
|
}
|
||||||
|
|
||||||
|
int x = pt.x,
|
||||||
|
y = pt.y;
|
||||||
|
ScreenToClient(&x, &y);
|
||||||
|
wxSetCursorEvent event(x, y);
|
||||||
|
|
||||||
|
bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event);
|
||||||
|
if ( processedEvtSetCursor && event.HasCursor() )
|
||||||
|
{
|
||||||
|
hcursor = GetHcursorOf(event.GetCursor());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !hcursor )
|
||||||
|
{
|
||||||
bool isBusy = wxIsBusy();
|
bool isBusy = wxIsBusy();
|
||||||
if ( m_cursor.Ok() )
|
|
||||||
|
// the test for processedEvtSetCursor is here to prevent using m_cursor
|
||||||
|
// if the user code caught EVT_SET_CURSOR() and returned nothing from
|
||||||
|
// it - this is a way to say that our cursor shouldn't be used for this
|
||||||
|
// point
|
||||||
|
if ( !processedEvtSetCursor && m_cursor.Ok() )
|
||||||
{
|
{
|
||||||
hcursor = GetHcursorOf(m_cursor);
|
hcursor = GetHcursorOf(m_cursor);
|
||||||
}
|
}
|
||||||
@@ -2693,6 +2728,7 @@ bool wxWindow::HandleSetCursor(WXHWND hWnd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( hcursor )
|
if ( hcursor )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user