#endif
#if !defined(__GNUWIN32_OLD__) && !defined(__TWIN32__)
- #ifndef __WIN95__
+ #ifdef __WIN95__
#include <commctrl.h>
#endif
#else // broken compiler
static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flags);
// get the current state of SHIFT/CTRL keys
-static inline bool IsShiftDown() { return GetKeyState(VK_SHIFT)& 0x100 != 0; }
-static inline bool IsCtrlDown() { return GetKeyState(VK_CONTROL)& 0x100 != 0; }
+static inline bool IsShiftDown() { return (GetKeyState(VK_SHIFT) & 0x100) != 0; }
+static inline bool IsCtrlDown() { return (GetKeyState(VK_CONTROL) & 0x100) != 0; }
// ---------------------------------------------------------------------------
// event tables
if ( m_hWnd )
{
- if (::IsWindow(GetHwnd()))
+ // VZ: test temp removed to understand what really happens here
+ //if (::IsWindow(GetHwnd()))
{
if ( !::DestroyWindow(GetHwnd()) )
wxLogLastError("DestroyWindow");
::GetWindowRect(hWnd, &rect);
if ( ::PtInRect(&rect, point) && !wxIsBusy() )
- ::SetCursor((HCURSOR)m_cursor.GetHCURSOR());
+ ::SetCursor(GetHcursorOf(m_cursor));
return TRUE;
}
short nHitTest,
int WXUNUSED(mouseMsg))
{
- // don't set cursor for other windows, only for this one: this prevents
- // children of this window from getting the same cursor as the parent has
- // (don't forget that this message is propagated by default up the window
- // parent-child hierarchy)
- if ( GetHWND() == hWnd )
- {
- // don't set cursor when the mouse is not in the client part
- if ( nHitTest == HTCLIENT || nHitTest == HTERROR )
- {
- HCURSOR hcursor = 0;
- if ( wxIsBusy() )
- {
- // from msw\utils.cpp
- extern HCURSOR gs_wxBusyCursor;
-
- hcursor = gs_wxBusyCursor;
- }
- else
- {
- wxCursor *cursor = NULL;
+ // the logic is as follows:
+ // 1. if we have the cursor set it unless wxIsBusy()
+ // 2. if we're a top level window, set some cursor anyhow
+ // 3. if wxIsBusy(), set the busy cursor, otherwise the global one
- if ( m_cursor.Ok() )
- {
- cursor = &m_cursor;
- }
- else
- {
- // from msw\data.cpp
- extern wxCursor *g_globalCursor;
-
- if ( g_globalCursor && g_globalCursor->Ok() )
- cursor = g_globalCursor;
- }
-
- if ( cursor )
- hcursor = (HCURSOR)cursor->GetHCURSOR();
- }
+ HCURSOR hcursor = 0;
+ bool isBusy = wxIsBusy();
+ if ( m_cursor.Ok() )
+ {
+ hcursor = GetHcursorOf(m_cursor);
+ }
- if ( hcursor )
+ if ( !GetParent() )
+ {
+ if ( isBusy )
+ {
+ hcursor = wxGetCurrentBusyCursor();
+ }
+ else if ( !hcursor )
+ {
+ const wxCursor *cursor = wxGetGlobalCursor();
+ if ( cursor && cursor->Ok() )
{
- ::SetCursor(hcursor);
-
- return TRUE;
+ hcursor = GetHcursorOf(*cursor);
}
}
}
- return FALSE;
+ if ( hcursor )
+ {
+ ::SetCursor(hcursor);
+
+ // cursor set, stop here
+ return TRUE;
+ }
+ else
+ {
+ // pass up the window chain
+ return FALSE;
+ }
}
// ---------------------------------------------------------------------------
return popupMenu->MSWCommand(cmd, id);
}
- wxWindow *win;
+ wxWindow *win = (wxWindow*) NULL;
if ( cmd == 0 || cmd == 1 ) // menu or accel - use id
{
// must cast to a signed type before comparing with other ids!
win = FindItem((signed short)id);
}
- else
+
+ if (!win && control)
{
// find it from HWND - this works even with the broken programs using
// the same ids for different controls
}
if ( win )
+ {
return win->MSWCommand(cmd, id);
- else
+ }
+
+ // the messages sent from the in-place edit control used by the treectrl
+ // for label editing have id == 0, but they should _not_ be treated as menu
+ // messages (they are EN_XXX ones, in fact) so don't translate anything
+ // coming from a control to wxEVT_COMMAND_MENU_SELECTED
+ if ( !control )
{
- // If no child window, it may be an accelerator, e.g. for
- // a popup menu command.
+ // If no child window, it may be an accelerator, e.g. for a popup menu
+ // command
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
event.SetEventObject(this);
event.SetId(id);
event.SetInt(id);
- return ProcessEvent(event);
+
+ return GetEventHandler()->ProcessEvent(event);
}
return FALSE;