Correction to dnd.h; EVT_MOUSE_EVENTS now includes LEAVE/ENTER events;
Windows LEAVE/ENTER events now work git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@86 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
#define __DNDH_BASE__
|
#define __DNDH_BASE__
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
|
#include "wx/msw/ole/dropsrc.h"
|
||||||
|
#include "wx/msw/ole/droptgt.h"
|
||||||
#elif defined(__MOTIF__)
|
#elif defined(__MOTIF__)
|
||||||
#elif defined(__GTK__)
|
#elif defined(__GTK__)
|
||||||
#include "wx/gtk/dnd.h"
|
#include "wx/gtk/dnd.h"
|
||||||
|
@@ -1108,7 +1108,9 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
|||||||
{ wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
{ wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
||||||
{ wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
{ wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
||||||
{ wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
{ wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
||||||
{ wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
|
{ wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
||||||
|
{ wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
|
||||||
|
{ wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
|
||||||
|
|
||||||
// EVT_COMMAND
|
// EVT_COMMAND
|
||||||
#define EVT_COMMAND(id, cmd, fn) { cmd, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
#define EVT_COMMAND(id, cmd, fn) { cmd, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
// function to return symbolic name of clipboard format (debug messages)
|
// function to return symbolic name of clipboard format (debug messages)
|
||||||
static const char *GetFormatName(wxDataFormat format);
|
static const char *GetFormatName(wxDataFormat format);
|
||||||
#else // not used in release mode
|
#else // not used in release mode
|
||||||
#define GetFormatName(format) ""
|
inline const char* GetFormatName(wxDataFormat format) { return ""; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ctor & dtor
|
// ctor & dtor
|
||||||
|
@@ -1,19 +1,14 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dnd.cpp
|
// Name: dnd.cpp
|
||||||
// Purpose: Drag and drop sample
|
// Purpose: Drag and drop sample
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 13.11.97
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID:
|
||||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
// Copyright:
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// headers & declarations
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
@@ -79,7 +74,11 @@ public:
|
|||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnQuit (wxCommandEvent& event);
|
void OnQuit (wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
void OnDrag (wxCommandEvent& event);
|
||||||
void OnHelp (wxCommandEvent& event);
|
void OnHelp (wxCommandEvent& event);
|
||||||
|
void OnLogClear(wxCommandEvent& event);
|
||||||
|
|
||||||
|
void OnMouseBtnDown(wxMouseEvent& event);
|
||||||
|
|
||||||
bool OnClose();
|
bool OnClose();
|
||||||
|
|
||||||
@@ -90,7 +89,9 @@ private:
|
|||||||
*m_ctrlText;
|
*m_ctrlText;
|
||||||
wxTextCtrl *m_ctrlLog;
|
wxTextCtrl *m_ctrlLog;
|
||||||
|
|
||||||
wxLogTarget *m_pLog, *m_pLogPrev;
|
wxLog *m_pLog, *m_pLogPrev;
|
||||||
|
|
||||||
|
wxString m_strText;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -99,16 +100,22 @@ private:
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Menu_Quit = 1,
|
Menu_Quit = 1,
|
||||||
|
Menu_Drag,
|
||||||
Menu_About = 101,
|
Menu_About = 101,
|
||||||
Menu_Help,
|
Menu_Help,
|
||||||
|
Menu_Clear,
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
|
BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
|
||||||
EVT_MENU(Menu_Quit, DnDFrame::OnQuit)
|
EVT_MENU(Menu_Quit, DnDFrame::OnQuit)
|
||||||
EVT_MENU(Menu_About, DnDFrame::OnAbout)
|
EVT_MENU(Menu_About, DnDFrame::OnAbout)
|
||||||
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
|
EVT_MENU(Menu_Drag, DnDFrame::OnDrag)
|
||||||
|
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
|
||||||
|
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
|
||||||
|
|
||||||
//EVT_PAINT(DnDFrame::OnPaint)
|
EVT_LEFT_DOWN(OnMouseBtnDown)
|
||||||
|
EVT_RIGHT_DOWN(OnMouseBtnDown)
|
||||||
|
EVT_MIDDLE_DOWN(OnMouseBtnDown)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// `Main program' equivalent, creating windows and returning main app frame
|
// `Main program' equivalent, creating windows and returning main app frame
|
||||||
@@ -127,18 +134,34 @@ bool DnDApp::OnInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
||||||
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
|
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)),
|
||||||
|
m_strText("wxWindows drag & drop works :-)")
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// frame icon and status bar
|
||||||
SetIcon(wxIcon("mondrian"));
|
SetIcon(wxIcon("mondrian"));
|
||||||
|
const int widths[] = { -1 };
|
||||||
|
CreateStatusBar();
|
||||||
|
|
||||||
// construct menu
|
// construct menu
|
||||||
wxMenu *file_menu = new wxMenu;
|
wxMenu *file_menu = new wxMenu;
|
||||||
file_menu->Append(Menu_Help, "&Help");
|
file_menu->Append(Menu_Drag, "&Test drag...");
|
||||||
file_menu->Append(Menu_About, "&About");
|
|
||||||
file_menu->AppendSeparator();
|
file_menu->AppendSeparator();
|
||||||
file_menu->Append(Menu_Quit, "E&xit");
|
file_menu->Append(Menu_Quit, "E&xit");
|
||||||
|
|
||||||
|
wxMenu *log_menu = new wxMenu;
|
||||||
|
log_menu->Append(Menu_Clear, "Clear");
|
||||||
|
|
||||||
|
wxMenu *help_menu = new wxMenu;
|
||||||
|
help_menu->Append(Menu_Help, "&Help...");
|
||||||
|
help_menu->AppendSeparator();
|
||||||
|
help_menu->Append(Menu_About, "&About");
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
menu_bar->Append(file_menu, "&File");
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
menu_bar->Append(log_menu, "&Log");
|
||||||
|
menu_bar->Append(help_menu, "&Help");
|
||||||
|
|
||||||
SetMenuBar(menu_bar);
|
SetMenuBar(menu_bar);
|
||||||
|
|
||||||
// make a panel with 3 subwindows
|
// make a panel with 3 subwindows
|
||||||
@@ -154,9 +177,8 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
wxSUNKEN_BORDER| wxHSCROLL);
|
wxSUNKEN_BORDER| wxHSCROLL);
|
||||||
|
|
||||||
// redirect log messages to the text window (don't forget to delete it!)
|
// redirect log messages to the text window (don't forget to delete it!)
|
||||||
// m_pLog = new wxLogTextCtrl(m_ctrlLog);
|
m_pLog = new wxLogTextCtrl(m_ctrlLog);
|
||||||
m_pLog = NULL;
|
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
|
||||||
m_pLogPrev = wxLogTarget::SetActiveTarget(m_pLog);
|
|
||||||
|
|
||||||
// associate drop targets with 2 text controls
|
// associate drop targets with 2 text controls
|
||||||
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
|
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
|
||||||
@@ -168,21 +190,21 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
c->left.SameAs (this, wxLeft);
|
c->left.SameAs (this, wxLeft);
|
||||||
c->top.SameAs (this, wxTop);
|
c->top.SameAs (this, wxTop);
|
||||||
c->right.PercentOf(this, wxRight, 50);
|
c->right.PercentOf(this, wxRight, 50);
|
||||||
c->height.PercentOf(this, wxHeight, 50);
|
c->height.PercentOf(this, wxHeight, 40);
|
||||||
m_ctrlFile->SetConstraints(c);
|
m_ctrlFile->SetConstraints(c);
|
||||||
|
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->left.SameAs (m_ctrlFile, wxRight);
|
c->left.SameAs (m_ctrlFile, wxRight);
|
||||||
c->top.SameAs (this, wxTop);
|
c->top.SameAs (this, wxTop);
|
||||||
c->right.SameAs (this, wxRight);
|
c->right.SameAs (this, wxRight);
|
||||||
c->height.PercentOf(this, wxHeight, 50);
|
c->height.PercentOf(this, wxHeight, 40);
|
||||||
m_ctrlText->SetConstraints(c);
|
m_ctrlText->SetConstraints(c);
|
||||||
|
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->left.SameAs (this, wxLeft);
|
c->left.SameAs (this, wxLeft);
|
||||||
c->right.SameAs (this, wxRight);
|
c->right.SameAs (this, wxRight);
|
||||||
c->height.PercentOf(this, wxHeight, 50);
|
c->height.PercentOf(this, wxHeight, 40);
|
||||||
c->bottom.SameAs(this, wxBottom);
|
c->top.SameAs(m_ctrlText, wxBottom);
|
||||||
|
|
||||||
m_ctrlLog->SetConstraints(c);
|
m_ctrlLog->SetConstraints(c);
|
||||||
|
|
||||||
@@ -194,11 +216,26 @@ void DnDFrame::OnQuit(wxCommandEvent& /* event */)
|
|||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DnDFrame::OnDrag(wxCommandEvent& /* event */)
|
||||||
|
{
|
||||||
|
wxString strText = wxGetTextFromUser
|
||||||
|
(
|
||||||
|
"After you enter text in this dialog, press any mouse\n"
|
||||||
|
"button in the bottom (empty) part of the frame and \n"
|
||||||
|
"drag it anywhere - you will be in fact dragging the\n"
|
||||||
|
"text object containing this text",
|
||||||
|
"Please enter some text", m_strText, this
|
||||||
|
);
|
||||||
|
|
||||||
|
m_strText = strText;
|
||||||
|
}
|
||||||
|
|
||||||
void DnDFrame::OnAbout(wxCommandEvent& /* event */)
|
void DnDFrame::OnAbout(wxCommandEvent& /* event */)
|
||||||
{
|
{
|
||||||
wxMessageDialog dialog(this,
|
wxMessageDialog dialog(this,
|
||||||
"Drag-&-Drop Demo\n"
|
"Drag-&-Drop Demo\n"
|
||||||
"Please see File|Help for details",
|
"Please see \"Help|Help...\" for details\n"
|
||||||
|
"Copyright (c) 1998 Vadim Zeitlin",
|
||||||
"About wxDnD");
|
"About wxDnD");
|
||||||
|
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
@@ -207,35 +244,68 @@ void DnDFrame::OnAbout(wxCommandEvent& /* event */)
|
|||||||
void DnDFrame::OnHelp(wxCommandEvent& /* event */)
|
void DnDFrame::OnHelp(wxCommandEvent& /* event */)
|
||||||
{
|
{
|
||||||
wxMessageDialog dialog(this,
|
wxMessageDialog dialog(this,
|
||||||
"This small program demonstrates drag & drop support in wxWindows.\n"
|
"This small program demonstrates drag & drop support in wxWindows. "
|
||||||
"The program window consists of 3 parts: the bottom pane is for\n"
|
"The program window consists of 3 parts: the bottom pane is for "
|
||||||
"debug messages, so that you can see what's going on inside.\n"
|
"debug messages, so that you can see what's going on inside. "
|
||||||
"The top part is split into 2 listboxes, the left one accepts\n"
|
"The top part is split into 2 listboxes, the left one accepts "
|
||||||
"files and the right one accepts text.\n"
|
"files and the right one accepts text."
|
||||||
"\n"
|
"\n\n"
|
||||||
"To test it: open wordpad (write.exe), select some text in it and\n"
|
"To test wxDropTarget: open wordpad (write.exe), select some text in "
|
||||||
"drag it to the right listbox (you'll notice the usual visual\n"
|
"it and drag it to the right listbox (you'll notice the usual visual "
|
||||||
"feedback, i.e. the cursor will change). Also, try dragging some\n"
|
"feedback, i.e. the cursor will change). Also, try dragging some "
|
||||||
"files (you can select several at once) from Windows Explorer (or\n"
|
"files (you can select several at once) from Windows Explorer (or "
|
||||||
"File Manager) to the left pane. Hold down Ctrl/Shift keys when\n"
|
"File Manager) to the left pane. Hold down Ctrl/Shift keys when "
|
||||||
"you drop text (doesn't work with files) and see what changes.\n"
|
"you drop text (doesn't work with files) and see what changes. "
|
||||||
"\n"
|
"\n\n"
|
||||||
"Please address any questions/bug reports/suggestions &c to\n"
|
"To test wxDropSource: just press any mouse button on the empty zone of "
|
||||||
|
"the window and drag it to wordpad or any other droptarget accepting "
|
||||||
|
"text (and of course you can just drag it to the right pane). Due to "
|
||||||
|
"a lot of trace messages, the cursor might take some time to change, "
|
||||||
|
"don't release the mouse button until it does. You can change the "
|
||||||
|
"string being dragged in in \"File|Test drag...\" dialog."
|
||||||
|
"\n\n"
|
||||||
|
"Please send all questions/bug reports/suggestions &c to "
|
||||||
"Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
|
"Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
|
||||||
"wxDnD Help");
|
"wxDnD Help");
|
||||||
|
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DnDFrame::OnLogClear(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
m_ctrlLog->Clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool DnDFrame::OnClose()
|
bool DnDFrame::OnClose()
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DnDFrame::OnMouseBtnDown(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
if ( !m_strText.IsEmpty() ) {
|
||||||
|
// start drag operation
|
||||||
|
wxTextDataObject data(m_strText);
|
||||||
|
wxDropSource dragSource(data);
|
||||||
|
const char *pc;
|
||||||
|
|
||||||
|
switch ( dragSource.DoDragDrop(TRUE) ) {
|
||||||
|
case wxDropSource::Error: pc = "Error!"; break;
|
||||||
|
case wxDropSource::None: pc = "Nothing"; break;
|
||||||
|
case wxDropSource::Copy: pc = "Copied"; break;
|
||||||
|
case wxDropSource::Move: pc = "Moved"; break;
|
||||||
|
case wxDropSource::Cancel: pc = "Cancelled"; break;
|
||||||
|
default: pc = "Huh?"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetStatusText(wxString("Drag result: ") + pc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DnDFrame::~DnDFrame()
|
DnDFrame::~DnDFrame()
|
||||||
{
|
{
|
||||||
if ( m_pLog != NULL ) {
|
if ( m_pLog != NULL ) {
|
||||||
if ( wxLogTarget::SetActiveTarget(m_pLogPrev) == m_pLog )
|
if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog )
|
||||||
delete m_pLog;
|
delete m_pLog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -795,6 +795,8 @@ void wxToolBarBase::CalcUnscrolledPosition(const int x, const int y, float *xx,
|
|||||||
|
|
||||||
void wxToolBarBase::OnIdle(wxIdleEvent& event)
|
void wxToolBarBase::OnIdle(wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
|
wxWindow::OnIdle(event);
|
||||||
|
|
||||||
DoToolbarUpdates();
|
DoToolbarUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -175,25 +175,20 @@ wxControl *wxFakeItemEvent(wxWindow *parent, wxControl *item, wxMouseEvent& even
|
|||||||
|
|
||||||
void wxControl::MSWOnMouseMove(const int x, const int y, const WXUINT flags)
|
void wxControl::MSWOnMouseMove(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
// 'normal' move event...
|
|
||||||
// Set cursor, but only if we're not in 'busy' mode
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Trouble with this is that it sets the cursor for controls too :-(
|
// Trouble with this is that it sets the cursor for controls too :-(
|
||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
if (m_windowCursor.Ok() && !wxIsBusy())
|
||||||
::SetCursor(m_windowCursor.GetHCURSOR());
|
::SetCursor(m_windowCursor.GetHCURSOR());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_MOTION);
|
if (!m_mouseInWindow)
|
||||||
|
{
|
||||||
|
// Generate an ENTER event
|
||||||
|
m_mouseInWindow = TRUE;
|
||||||
|
MSWOnMouseEnter(x, y, flags);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
wxMouseEvent event(wxEVT_MOTION);
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
@@ -207,16 +202,16 @@ void wxControl::MSWOnMouseMove(const int x, const int y, const WXUINT flags)
|
|||||||
// Window gets a click down message followed by a mouse move
|
// Window gets a click down message followed by a mouse move
|
||||||
// message even if position isn't changed! We want to discard
|
// message even if position isn't changed! We want to discard
|
||||||
// the trailing move event if x and y are the same.
|
// the trailing move event if x and y are the same.
|
||||||
if ((m_lastEvent == wxEVENT_TYPE_RIGHT_DOWN || m_lastEvent == wxEVENT_TYPE_LEFT_DOWN ||
|
if ((m_lastEvent == wxEVT_RIGHT_DOWN || m_lastEvent == wxEVT_LEFT_DOWN ||
|
||||||
m_lastEvent == wxEVENT_TYPE_MIDDLE_DOWN) &&
|
m_lastEvent == wxEVT_MIDDLE_DOWN) &&
|
||||||
(m_lastXPos == event.GetX() && m_lastYPos == event.GetY()))
|
(m_lastXPos == event.GetX() && m_lastYPos == event.GetY()))
|
||||||
{
|
{
|
||||||
m_lastXPos = event.GetX(); m_lastYPos = event.GetY();
|
m_lastXPos = event.GetX(); m_lastYPos = event.GetY();
|
||||||
m_lastEvent = wxEVENT_TYPE_MOTION;
|
m_lastEvent = wxEVT_MOTION;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastEvent = wxEVENT_TYPE_MOTION;
|
m_lastEvent = wxEVT_MOTION;
|
||||||
m_lastXPos = event.GetX(); m_lastYPos = event.GetY();
|
m_lastXPos = event.GetX(); m_lastYPos = event.GetY();
|
||||||
GetEventHandler()->OldOnMouseEvent(event);
|
GetEventHandler()->OldOnMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
@@ -184,6 +184,8 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\wave.obj \
|
$(MSWDIR)\wave.obj \
|
||||||
$(MSWDIR)\window.obj \
|
$(MSWDIR)\window.obj \
|
||||||
$(MSWDIR)\droptgt.obj \
|
$(MSWDIR)\droptgt.obj \
|
||||||
|
$(MSWDIR)\dropsrc.obj \
|
||||||
|
$(MSWDIR)\dataobj.obj \
|
||||||
$(MSWDIR)\oleutils.obj \
|
$(MSWDIR)\oleutils.obj \
|
||||||
$(MSWDIR)\uuid.obj
|
$(MSWDIR)\uuid.obj
|
||||||
|
|
||||||
@@ -366,6 +368,10 @@ $(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\droptgt.obj: $(OLEDIR)\droptgt.$(SRCSUFF)
|
$(MSWDIR)\droptgt.obj: $(OLEDIR)\droptgt.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\dropsrc.obj: $(OLEDIR)\dropsrc.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\dataobj.obj: $(OLEDIR)\dataobj.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\oleutils.obj: $(OLEDIR)\oleutils.$(SRCSUFF)
|
$(MSWDIR)\oleutils.obj: $(OLEDIR)\oleutils.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\uuid.obj: $(OLEDIR)\uuid.$(SRCSUFF)
|
$(MSWDIR)\uuid.obj: $(OLEDIR)\uuid.$(SRCSUFF)
|
||||||
|
@@ -180,6 +180,8 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\wave.obj \
|
$(MSWDIR)\wave.obj \
|
||||||
$(MSWDIR)\window.obj \
|
$(MSWDIR)\window.obj \
|
||||||
$(OLEDIR)\droptgt.obj \
|
$(OLEDIR)\droptgt.obj \
|
||||||
|
$(OLEDIR)\dropsrc.obj \
|
||||||
|
$(OLEDIR)\dataobj.obj \
|
||||||
$(OLEDIR)\oleutils.obj \
|
$(OLEDIR)\oleutils.obj \
|
||||||
$(OLEDIR)\uuid.obj
|
$(OLEDIR)\uuid.obj
|
||||||
|
|
||||||
@@ -602,6 +604,16 @@ $(OLEDIR)/droptgt.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(OLEDIR)/dropsrc.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(OLEDIR)/dataobj.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
$(OLEDIR)/oleutils.obj: $*.$(SRCSUFF)
|
$(OLEDIR)/oleutils.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
@@ -190,6 +190,8 @@ MSWOBJS = \
|
|||||||
wave.$(OBJSUFF) \
|
wave.$(OBJSUFF) \
|
||||||
window.$(OBJSUFF) \
|
window.$(OBJSUFF) \
|
||||||
$(OLEDIR)/droptgt.$(OBJSUFF) \
|
$(OLEDIR)/droptgt.$(OBJSUFF) \
|
||||||
|
$(OLEDIR)/dropsrc.$(OBJSUFF) \
|
||||||
|
$(OLEDIR)/dataobj.$(OBJSUFF) \
|
||||||
$(OLEDIR)/oleutils.$(OBJSUFF) \
|
$(OLEDIR)/oleutils.$(OBJSUFF) \
|
||||||
$(OLEDIR)/uuid.$(OBJSUFF)
|
$(OLEDIR)/uuid.$(OBJSUFF)
|
||||||
|
|
||||||
|
@@ -190,9 +190,12 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\wave.obj \
|
$(MSWDIR)\wave.obj \
|
||||||
$(MSWDIR)\window.obj \
|
$(MSWDIR)\window.obj \
|
||||||
$(OLEDIR)\droptgt.obj \
|
$(OLEDIR)\droptgt.obj \
|
||||||
|
$(OLEDIR)\dropsrc.obj \
|
||||||
|
$(OLEDIR)\dataobj.obj \
|
||||||
$(OLEDIR)\oleutils.obj \
|
$(OLEDIR)\oleutils.obj \
|
||||||
$(OLEDIR)\uuid.obj
|
$(OLEDIR)\uuid.obj
|
||||||
|
|
||||||
|
|
||||||
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS)
|
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS)
|
||||||
|
|
||||||
# Normal, static library
|
# Normal, static library
|
||||||
@@ -644,6 +647,18 @@ $(OLEDIR)/droptgt.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(OLEDIR)/dropsrc.obj: $*.$(SRCSUFF)
|
||||||
|
echo $(CPPFLAGS)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(OLEDIR)/dataobj.obj: $*.$(SRCSUFF)
|
||||||
|
echo $(CPPFLAGS)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
$(OLEDIR)/oleutils.obj: $*.$(SRCSUFF)
|
$(OLEDIR)/oleutils.obj: $*.$(SRCSUFF)
|
||||||
echo $(CPPFLAGS)
|
echo $(CPPFLAGS)
|
||||||
cl @<<
|
cl @<<
|
||||||
|
@@ -2235,18 +2235,8 @@ void wxWindow::MSWOnLButtonDown(const int x, const int y, const WXUINT flags)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//wxDebugMsg("LButtonDown\n") ;
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_LEFT_DOWN);
|
wxMouseEvent event(wxEVENT_TYPE_LEFT_DOWN);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2262,18 +2252,8 @@ void wxWindow::MSWOnLButtonDown(const int x, const int y, const WXUINT flags)
|
|||||||
|
|
||||||
void wxWindow::MSWOnLButtonUp(const int x, const int y, const WXUINT flags)
|
void wxWindow::MSWOnLButtonUp(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("LButtonUp\n") ;
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_LEFT_UP);
|
wxMouseEvent event(wxEVENT_TYPE_LEFT_UP);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2290,20 +2270,10 @@ void wxWindow::MSWOnLButtonUp(const int x, const int y, const WXUINT flags)
|
|||||||
|
|
||||||
void wxWindow::MSWOnLButtonDClick(const int x, const int y, const WXUINT flags)
|
void wxWindow::MSWOnLButtonDClick(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("LButtonDClick\n") ;
|
|
||||||
/* MATTHEW: If dclick not allowed, generate another single-click */
|
/* MATTHEW: If dclick not allowed, generate another single-click */
|
||||||
wxMouseEvent event(m_doubleClickAllowed ?
|
wxMouseEvent event(m_doubleClickAllowed ?
|
||||||
wxEVENT_TYPE_LEFT_DCLICK : wxEVENT_TYPE_LEFT_DOWN);
|
wxEVENT_TYPE_LEFT_DCLICK : wxEVENT_TYPE_LEFT_DOWN);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2342,18 +2312,8 @@ void wxWindow::MSWOnMButtonDown(const int x, const int y, const WXUINT flags)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//wxDebugMsg("MButtonDown\n") ;
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_MIDDLE_DOWN);
|
wxMouseEvent event(wxEVENT_TYPE_MIDDLE_DOWN);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2372,15 +2332,6 @@ void wxWindow::MSWOnMButtonUp(const int x, const int y, const WXUINT flags)
|
|||||||
//wxDebugMsg("MButtonUp\n") ;
|
//wxDebugMsg("MButtonUp\n") ;
|
||||||
wxMouseEvent event(wxEVENT_TYPE_MIDDLE_UP);
|
wxMouseEvent event(wxEVENT_TYPE_MIDDLE_UP);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2401,15 +2352,6 @@ void wxWindow::MSWOnMButtonDClick(const int x, const int y, const WXUINT flags)
|
|||||||
wxMouseEvent event((m_doubleClickAllowed) ?
|
wxMouseEvent event((m_doubleClickAllowed) ?
|
||||||
wxEVENT_TYPE_MIDDLE_DCLICK : wxEVENT_TYPE_MIDDLE_DOWN);
|
wxEVENT_TYPE_MIDDLE_DCLICK : wxEVENT_TYPE_MIDDLE_DOWN);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2447,18 +2389,8 @@ void wxWindow::MSWOnRButtonDown(const int x, const int y, const WXUINT flags)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//wxDebugMsg("RButtonDown\n") ;
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_RIGHT_DOWN);
|
wxMouseEvent event(wxEVENT_TYPE_RIGHT_DOWN);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2474,18 +2406,8 @@ void wxWindow::MSWOnRButtonDown(const int x, const int y, const WXUINT flags)
|
|||||||
|
|
||||||
void wxWindow::MSWOnRButtonUp(const int x, const int y, const WXUINT flags)
|
void wxWindow::MSWOnRButtonUp(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("RButtonUp\n") ;
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_RIGHT_UP);
|
wxMouseEvent event(wxEVENT_TYPE_RIGHT_UP);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2501,20 +2423,10 @@ void wxWindow::MSWOnRButtonUp(const int x, const int y, const WXUINT flags)
|
|||||||
|
|
||||||
void wxWindow::MSWOnRButtonDClick(const int x, const int y, const WXUINT flags)
|
void wxWindow::MSWOnRButtonDClick(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("RButtonDClick\n") ;
|
|
||||||
/* MATTHEW: If dclick not allowed, generate another single-click */
|
/* MATTHEW: If dclick not allowed, generate another single-click */
|
||||||
wxMouseEvent event((m_doubleClickAllowed) ?
|
wxMouseEvent event((m_doubleClickAllowed) ?
|
||||||
wxEVENT_TYPE_RIGHT_DCLICK : wxEVENT_TYPE_RIGHT_DOWN);
|
wxEVENT_TYPE_RIGHT_DCLICK : wxEVENT_TYPE_RIGHT_DOWN);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2538,17 +2450,15 @@ void wxWindow::MSWOnMouseMove(const int x, const int y, const WXUINT flags)
|
|||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
if (m_windowCursor.Ok() && !wxIsBusy())
|
||||||
::SetCursor((HCURSOR) m_windowCursor.GetHCURSOR());
|
::SetCursor((HCURSOR) m_windowCursor.GetHCURSOR());
|
||||||
|
|
||||||
|
if (!m_mouseInWindow)
|
||||||
|
{
|
||||||
|
// Generate an ENTER event
|
||||||
|
m_mouseInWindow = TRUE;
|
||||||
|
MSWOnMouseEnter(x, y, flags);
|
||||||
|
}
|
||||||
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_MOTION);
|
wxMouseEvent event(wxEVENT_TYPE_MOTION);
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||||
@@ -2575,135 +2485,9 @@ void wxWindow::MSWOnMouseMove(const int x, const int y, const WXUINT flags)
|
|||||||
GetEventHandler()->OldOnMouseEvent(event);
|
GetEventHandler()->OldOnMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO put back leave/enter code if required
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
void wxWindow::MSWOnMouseMove(int x, int y, WXUINT flags)
|
|
||||||
{
|
|
||||||
//wxDebugMsg("Client 0x%08x Move Msg %d,%d\n",this,x,y) ;
|
|
||||||
|
|
||||||
// #if MOUSE_EXIT_FIX //Should work now!!
|
|
||||||
|
|
||||||
// Don't do the Leave/Enter fix if we've captured the window,
|
|
||||||
// or SetCapture won't work properly.
|
|
||||||
if (!m_winCaptured)
|
|
||||||
{
|
|
||||||
HWND hunder ;
|
|
||||||
POINT pt ;
|
|
||||||
// See if we Leave/Enter the window.
|
|
||||||
GetCursorPos(&pt) ;
|
|
||||||
hunder = WindowFromPoint(pt) ;
|
|
||||||
if (hunder==m_hWnd)
|
|
||||||
{
|
|
||||||
// I'm in the Window, but perhaps in NC area.
|
|
||||||
RECT wind ;
|
|
||||||
RECT nc ;
|
|
||||||
GetClientRect(m_hWnd,&wind) ;
|
|
||||||
GetWindowRect(m_hWnd,&nc) ;
|
|
||||||
pt.x -= nc.left ;
|
|
||||||
pt.y -= nc.top ;
|
|
||||||
wind.left += WINDOW_MARGIN ; // to be able to 'see' leave
|
|
||||||
wind.top += WINDOW_MARGIN ; // to be able to 'see' leave
|
|
||||||
wind.right -= WINDOW_MARGIN ; // to be able to 'see' leave
|
|
||||||
wind.bottom -= WINDOW_MARGIN ; // to be able to 'see' leave
|
|
||||||
|
|
||||||
if (!PtInRect(&wind,pt))
|
|
||||||
hunder = NULL ; // So, I can simulate a Leave event...
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hunder!=m_hWnd)
|
|
||||||
{
|
|
||||||
if (m_mouseInWindow)
|
|
||||||
{
|
|
||||||
m_mouseInWindow = FALSE ;
|
|
||||||
// Capture/Release is no more needed...
|
|
||||||
//ReleaseCapture() ;
|
|
||||||
MSWOnMouseLeave(x,y,flags) ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
// We never want to see Enter or Motion in this part of the Window...
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Event was triggered while I'm really into my client area.
|
|
||||||
// Do an Enter if not done.
|
|
||||||
if (!m_mouseInWindow)
|
|
||||||
{
|
|
||||||
m_mouseInWindow = TRUE ;
|
|
||||||
// Capture/Release is no more needed...
|
|
||||||
//SetCapture(m_hWnd) ;
|
|
||||||
// Set cursor, but only if we're not in 'busy' mode
|
|
||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
|
||||||
::SetCursor(m_windowCursor.ms_cursor);
|
|
||||||
MSWOnMouseEnter(x,y,flags) ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// #endif //MOUSE_EXIT_FIX
|
|
||||||
|
|
||||||
// 'normal' move event...
|
|
||||||
// Set cursor, but only if we're not in 'busy' mode
|
|
||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
|
||||||
::SetCursor(m_windowCursor.ms_cursor);
|
|
||||||
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_MOTION);
|
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
|
||||||
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
|
|
||||||
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
|
|
||||||
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
|
|
||||||
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
|
|
||||||
event.m_eventObject = this;
|
|
||||||
|
|
||||||
// Window gets a click down message followed by a mouse move
|
|
||||||
// message even if position isn't changed! We want to discard
|
|
||||||
// the trailing move event if x and y are the same.
|
|
||||||
if ((m_lastEvent == wxEVENT_TYPE_RIGHT_DOWN || m_lastEvent == wxEVENT_TYPE_LEFT_DOWN ||
|
|
||||||
m_lastEvent == wxEVENT_TYPE_MIDDLE_DOWN) &&
|
|
||||||
(m_lastXPos == event.m_x && m_lastYPos == event.m_y))
|
|
||||||
{
|
|
||||||
m_lastXPos = event.m_x; m_lastYPos = event.m_y;
|
|
||||||
m_lastEvent = wxEVENT_TYPE_MOTION;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_lastEvent = wxEVENT_TYPE_MOTION;
|
|
||||||
m_lastXPos = event.m_x; m_lastYPos = event.m_y;
|
|
||||||
GetEventHandler()->OldOnMouseEvent(event);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void wxWindow::MSWOnMouseEnter(const int x, const int y, const WXUINT flags)
|
void wxWindow::MSWOnMouseEnter(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("Client 0x%08x Enter %d,%d\n",this,x,y) ;
|
wxMouseEvent event(wxEVT_ENTER_WINDOW);
|
||||||
|
|
||||||
// Set cursor, but only if we're not in 'busy' mode
|
|
||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
|
||||||
::SetCursor((HCURSOR) m_windowCursor.GetHCURSOR());
|
|
||||||
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_ENTER_WINDOW);
|
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
@@ -2714,29 +2498,14 @@ void wxWindow::MSWOnMouseEnter(const int x, const int y, const WXUINT flags)
|
|||||||
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
|
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
|
||||||
event.m_eventObject = this;
|
event.m_eventObject = this;
|
||||||
|
|
||||||
m_lastEvent = wxEVENT_TYPE_ENTER_WINDOW;
|
m_lastEvent = wxEVT_ENTER_WINDOW;
|
||||||
m_lastXPos = event.m_x; m_lastYPos = event.m_y;
|
m_lastXPos = event.m_x; m_lastYPos = event.m_y;
|
||||||
GetEventHandler()->OldOnMouseEvent(event);
|
GetEventHandler()->OldOnMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::MSWOnMouseLeave(const int x, const int y, const WXUINT flags)
|
void wxWindow::MSWOnMouseLeave(const int x, const int y, const WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("Client 0x%08x Leave %d,%d\n",this,x,y) ;
|
wxMouseEvent event(wxEVT_LEAVE_WINDOW);
|
||||||
|
|
||||||
// Set cursor, but only if we're not in 'busy' mode
|
|
||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
|
||||||
::SetCursor((HCURSOR) m_windowCursor.GetHCURSOR());
|
|
||||||
|
|
||||||
wxMouseEvent event(wxEVENT_TYPE_LEAVE_WINDOW);
|
|
||||||
|
|
||||||
/*
|
|
||||||
float px = (float)x;
|
|
||||||
float py = (float)y;
|
|
||||||
|
|
||||||
MSWDeviceToLogical(&px, &py);
|
|
||||||
|
|
||||||
CalcUnscrolledPosition((int)px, (int)py, &event.m_x, &event.m_y);
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||||
@@ -2747,7 +2516,7 @@ void wxWindow::MSWOnMouseLeave(const int x, const int y, const WXUINT flags)
|
|||||||
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
|
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
|
||||||
event.m_eventObject = this;
|
event.m_eventObject = this;
|
||||||
|
|
||||||
m_lastEvent = wxEVENT_TYPE_LEAVE_WINDOW;
|
m_lastEvent = wxEVT_LEAVE_WINDOW;
|
||||||
m_lastXPos = event.m_x; m_lastYPos = event.m_y;
|
m_lastXPos = event.m_x; m_lastYPos = event.m_y;
|
||||||
GetEventHandler()->OldOnMouseEvent(event);
|
GetEventHandler()->OldOnMouseEvent(event);
|
||||||
}
|
}
|
||||||
@@ -2810,13 +2579,6 @@ void wxWindow::MSWOnChar(const WXWORD wParam, const WXLPARAM lParam, const bool
|
|||||||
pt.x -= rect.left ;
|
pt.x -= rect.left ;
|
||||||
pt.y -= rect.top ;
|
pt.y -= rect.top ;
|
||||||
|
|
||||||
/*
|
|
||||||
float fx,fy ;
|
|
||||||
fx = (float)pt.x ;
|
|
||||||
fy = (float)pt.y ;
|
|
||||||
MSWDeviceToLogical(&fx,&fy) ;
|
|
||||||
CalcUnscrolledPosition((int)fx,(int)fy,&event.m_x,&event.m_y) ;
|
|
||||||
*/
|
|
||||||
event.m_x = pt.x; event.m_y = pt.y;
|
event.m_x = pt.x; event.m_y = pt.y;
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
@@ -4950,6 +4712,19 @@ void wxWindow::UpdateWindowUI(void)
|
|||||||
|
|
||||||
void wxWindow::OnIdle(wxIdleEvent& event)
|
void wxWindow::OnIdle(wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
|
// Check if we need to send a LEAVE event
|
||||||
|
if (m_mouseInWindow)
|
||||||
|
{
|
||||||
|
POINT pt;
|
||||||
|
::GetCursorPos(&pt);
|
||||||
|
if (::WindowFromPoint(pt) != (HWND) GetHWND())
|
||||||
|
{
|
||||||
|
// Generate a LEAVE event
|
||||||
|
m_mouseInWindow = FALSE;
|
||||||
|
MSWOnMouseLeave(pt.x, pt.y, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user