projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do nothing in Freeze/Thaw() if the window is hidden, otherwise the window is not...
[wxWidgets.git]
/
src
/
msw
/
ole
/
droptgt.cpp
diff --git
a/src/msw/ole/droptgt.cpp
b/src/msw/ole/droptgt.cpp
index 37818b5760f2a346ef58cdd4674405ac3b3329df..7072586f09c8c9241cddd744562368fb73855c32 100644
(file)
--- a/
src/msw/ole/droptgt.cpp
+++ b/
src/msw/ole/droptgt.cpp
@@
-17,7
+17,7
@@
// headers
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
-#if
def __GNUG__
+#if
defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "droptgt.h"
#endif
#pragma implementation "droptgt.h"
#endif
@@
-43,7
+43,7
@@
#ifdef __WIN32__
#if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS
#if wxCHECK_W32API_VERSION( 1, 0 )
#ifdef __WIN32__
#if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS
#if wxCHECK_W32API_VERSION( 1, 0 )
- #include
<windows.h>
+ #include
"wx/msw/wrapwin.h"
#endif
#include <shlobj.h> // for DROPFILES structure
#endif
#endif
#include <shlobj.h> // for DROPFILES structure
#endif
@@
-85,7
+85,7
@@
protected:
HWND m_hwnd; // window we're associated with
// get default drop effect for given keyboard flags
HWND m_hwnd; // window we're associated with
// get default drop effect for given keyboard flags
- static inline DWORD GetDropEffect(DWORD flags);
+ static inline DWORD GetDropEffect(DWORD flags
, wxDragResult defaultAction
);
DECLARE_NO_COPY_CLASS(wxIDropTarget)
};
DECLARE_NO_COPY_CLASS(wxIDropTarget)
};
@@
-109,8
+109,10
@@
static DWORD ConvertDragResultToEffect(wxDragResult result);
// Notes : We do "move" normally and "copy" if <Ctrl> is pressed,
// which is the standard behaviour (currently there is no
// way to redefine it)
// Notes : We do "move" normally and "copy" if <Ctrl> is pressed,
// which is the standard behaviour (currently there is no
// way to redefine it)
-DWORD wxIDropTarget::GetDropEffect(DWORD flags)
+DWORD wxIDropTarget::GetDropEffect(DWORD flags
, wxDragResult defaultAction
)
{
{
+ if (defaultAction == wxDragCopy)
+ return flags & MK_SHIFT ? DROPEFFECT_MOVE : DROPEFFECT_COPY;
return flags & MK_CONTROL ? DROPEFFECT_COPY : DROPEFFECT_MOVE;
}
return flags & MK_CONTROL ? DROPEFFECT_COPY : DROPEFFECT_MOVE;
}
@@
-189,8
+191,8
@@
STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
// give some visual feedback
*pdwEffect = ConvertDragResultToEffect(
// give some visual feedback
*pdwEffect = ConvertDragResultToEffect(
- m_pTarget->OnEnter(pt.x, pt.y,
-
ConvertDragEffectToResult(GetDropEffect(grfKeyState
))
+ m_pTarget->OnEnter(pt.x, pt.y, ConvertDragEffectToResult(
+
GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction()
))
)
);
)
);
@@
-214,7
+216,8
@@
STDMETHODIMP wxIDropTarget::DragOver(DWORD grfKeyState,
wxDragResult result;
if ( m_pIDataObject ) {
wxDragResult result;
if ( m_pIDataObject ) {
- result = ConvertDragEffectToResult(GetDropEffect(grfKeyState));
+ result = ConvertDragEffectToResult(
+ GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction()));
}
else {
// can't accept data anyhow normally
}
else {
// can't accept data anyhow normally
@@
-286,7
+289,8
@@
STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource,
m_pTarget->SetDataSource(pIDataSource);
// and now it has the data
m_pTarget->SetDataSource(pIDataSource);
// and now it has the data
- wxDragResult rc = ConvertDragEffectToResult(GetDropEffect(grfKeyState));
+ wxDragResult rc = ConvertDragEffectToResult(
+ GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction()));
rc = m_pTarget->OnData(pt.x, pt.y, rc);
if ( wxIsDragResultOk(rc) ) {
// operation succeeded
rc = m_pTarget->OnData(pt.x, pt.y, rc);
if ( wxIsDragResultOk(rc) ) {
// operation succeeded
@@
-294,7
+298,7
@@
STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource,
}
//else: *pdwEffect is already DROPEFFECT_NONE
}
}
//else: *pdwEffect is already DROPEFFECT_NONE
}
- //else: OnDrop() returned
FALSE
, no need to copy data
+ //else: OnDrop() returned
false
, no need to copy data
// release the held object
RELEASE_AND_NULL(m_pIDataObject);
// release the held object
RELEASE_AND_NULL(m_pIDataObject);
@@
-330,6
+334,14
@@
wxDropTarget::~wxDropTarget()
bool wxDropTarget::Register(WXHWND hwnd)
{
bool wxDropTarget::Register(WXHWND hwnd)
{
+ // FIXME
+ // RegisterDragDrop not available on Windows CE >= 400?
+ // Or maybe we can dynamically load them from ceshell.dll
+ // or similar.
+#if defined(__WXWINCE__) && _WIN32_WCE >= 400
+ wxUnusedVar(hwnd);
+ return false;
+#else
HRESULT hr;
// May exist in later WinCE versions
HRESULT hr;
// May exist in later WinCE versions
@@
-337,7
+349,7
@@
bool wxDropTarget::Register(WXHWND hwnd)
hr = ::CoLockObjectExternal(m_pIDropTarget, TRUE, FALSE);
if ( FAILED(hr) ) {
wxLogApiError(wxT("CoLockObjectExternal"), hr);
hr = ::CoLockObjectExternal(m_pIDropTarget, TRUE, FALSE);
if ( FAILED(hr) ) {
wxLogApiError(wxT("CoLockObjectExternal"), hr);
- return
FALSE
;
+ return
false
;
}
#endif
}
#endif
@@
-348,17
+360,22
@@
bool wxDropTarget::Register(WXHWND hwnd)
::CoLockObjectExternal(m_pIDropTarget, FALSE, FALSE);
#endif
wxLogApiError(wxT("RegisterDragDrop"), hr);
::CoLockObjectExternal(m_pIDropTarget, FALSE, FALSE);
#endif
wxLogApiError(wxT("RegisterDragDrop"), hr);
- return
FALSE
;
+ return
false
;
}
// we will need the window handle for coords transformation later
m_pIDropTarget->SetHwnd((HWND)hwnd);
}
// we will need the window handle for coords transformation later
m_pIDropTarget->SetHwnd((HWND)hwnd);
- return TRUE;
+ return true;
+#endif
}
void wxDropTarget::Revoke(WXHWND hwnd)
{
}
void wxDropTarget::Revoke(WXHWND hwnd)
{
+#if defined(__WXWINCE__) && _WIN32_WCE >= 400
+ // Not available, see note above
+ wxUnusedVar(hwnd);
+#else
HRESULT hr = ::RevokeDragDrop((HWND) hwnd);
if ( FAILED(hr) ) {
HRESULT hr = ::RevokeDragDrop((HWND) hwnd);
if ( FAILED(hr) ) {
@@
-371,17
+388,18
@@
void wxDropTarget::Revoke(WXHWND hwnd)
#endif
m_pIDropTarget->SetHwnd(0);
#endif
m_pIDropTarget->SetHwnd(0);
+#endif
}
// ----------------------------------------------------------------------------
// base class pure virtuals
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
// base class pure virtuals
// ----------------------------------------------------------------------------
-// OnDrop() is called only if we previously returned
TRUE
from
+// OnDrop() is called only if we previously returned
true
from
// IsAcceptedData(), so no need to check anything here
bool wxDropTarget::OnDrop(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
// IsAcceptedData(), so no need to check anything here
bool wxDropTarget::OnDrop(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
- return
TRUE
;
+ return
true
;
}
// copy the data from the data source to the target data object
}
// copy the data from the data source to the target data object
@@
-392,7
+410,7
@@
bool wxDropTarget::GetData()
// this is strange because IsAcceptedData() succeeded previously!
wxFAIL_MSG(wxT("strange - did supported formats list change?"));
// this is strange because IsAcceptedData() succeeded previously!
wxFAIL_MSG(wxT("strange - did supported formats list change?"));
- return
FALSE
;
+ return
false
;
}
STGMEDIUM stm;
}
STGMEDIUM stm;
@@
-403,7
+421,7
@@
bool wxDropTarget::GetData()
fmtMemory.lindex = -1;
fmtMemory.tymed = TYMED_HGLOBAL; // TODO to add other media
fmtMemory.lindex = -1;
fmtMemory.tymed = TYMED_HGLOBAL; // TODO to add other media
- bool rc =
FALSE
;
+ bool rc =
false
;
HRESULT hr = m_pIDataSource->GetData(&fmtMemory, &stm);
if ( SUCCEEDED(hr) ) {
HRESULT hr = m_pIDataSource->GetData(&fmtMemory, &stm);
if ( SUCCEEDED(hr) ) {
@@
-411,7
+429,7
@@
bool wxDropTarget::GetData()
hr = dataObject->SetData(&fmtMemory, &stm, TRUE);
if ( SUCCEEDED(hr) ) {
hr = dataObject->SetData(&fmtMemory, &stm, TRUE);
if ( SUCCEEDED(hr) ) {
- rc =
TRUE
;
+ rc =
true
;
}
else {
wxLogApiError(wxT("IDataObject::SetData()"), hr);
}
else {
wxLogApiError(wxT("IDataObject::SetData()"), hr);