aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2000-11-30 05:16:11 +0000
committernyamatongwe <devnull@localhost>2000-11-30 05:16:11 +0000
commitef89374a1b993b738c4ecee577191af793e322cc (patch)
treec911146f43ced616d58bf707eeb6159ff9f2c1a6
parentb5fbb54d3bf072efb04f7784a686a12ebf8aeec5 (diff)
downloadscintilla-mirror-ef89374a1b993b738c4ecee577191af793e322cc.tar.gz
Dragging shows no-go cursor if no good text format in drag.
-rw-r--r--win32/ScintillaWin.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 17206906b..e86d23e33 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -99,6 +99,8 @@ class ScintillaWin :
bool capturedMouse;
+ bool hasOKText;
+
CLIPFORMAT cfColumnSelect;
DropSource ds;
@@ -190,6 +192,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
capturedMouse = false;
+ hasOKText = false;
+
// There does not seem to be a real standard for indicating that the clipboard contains a rectangular
// selection, so copy Developer Studio.
cfColumnSelect = static_cast<CLIPFORMAT>(
@@ -1328,8 +1332,25 @@ STDMETHODIMP_(ULONG) ScintillaWin::Release() {
}
// Implement IDropTarget
-STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT, DWORD grfKeyState,
+STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT pIDataSource, DWORD grfKeyState,
POINTL, PDWORD pdwEffect) {
+ if (pIDataSource == NULL)
+ return E_POINTER;
+ if (IsUnicodeMode()) {
+ FORMATETC fmtu = {CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ HRESULT hrHasUText = pIDataSource->QueryGetData(&fmtu);
+ hasOKText = hrHasUText == S_OK;
+ }
+ if (!hasOKText) {
+ FORMATETC fmte = {CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ HRESULT hrHasText = pIDataSource->QueryGetData(&fmte);
+ hasOKText = hrHasText == S_OK;
+ }
+ if (!hasOKText) {
+ *pdwEffect = DROPEFFECT_NONE;
+ return S_OK;
+ }
+
if (inDragDrop) // Internal defaults to move
*pdwEffect = DROPEFFECT_MOVE;
else
@@ -1342,6 +1363,11 @@ STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT, DWORD grfKeyState,
}
STDMETHODIMP ScintillaWin::DragOver(DWORD grfKeyState, POINTL pt, PDWORD pdwEffect) {
+ if (!hasOKText) {
+ *pdwEffect = DROPEFFECT_NONE;
+ return S_OK;
+ }
+
// These are the Wordpad semantics.
if (inDragDrop) // Internal defaults to move
*pdwEffect = DROPEFFECT_MOVE;