diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp new file mode 100644 index 0000000..bea7736 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 | ||
3 | */ | ||
4 | |||
5 | #ifdef HAVE_CONFIG_H | ||
6 | # include <config.h> | ||
7 | #endif | ||
8 | |||
9 | #include <assert.h> | ||
10 | |||
11 | #include "ecore_win32_dnd_drop_source.h" | ||
12 | |||
13 | #include "ecore_win32_private.h" | ||
14 | |||
15 | // structors | ||
16 | |||
17 | // reference count must ALWAYS start at 1 | ||
18 | DropSource::DropSource() : ref_count_(1) | ||
19 | { } | ||
20 | |||
21 | |||
22 | // IUnknown | ||
23 | |||
24 | HRESULT DropSource::QueryInterface(REFIID iid, void **ppvObject) | ||
25 | { | ||
26 | // check to see what interface has been requested | ||
27 | if (iid == IID_IDropSource || iid == IID_IUnknown) | ||
28 | { | ||
29 | AddRef(); | ||
30 | *ppvObject = this; | ||
31 | return S_OK; | ||
32 | } | ||
33 | *ppvObject = 0; | ||
34 | return E_NOINTERFACE; | ||
35 | } | ||
36 | |||
37 | ULONG DropSource::AddRef() | ||
38 | { | ||
39 | return InterlockedIncrement(&ref_count_); | ||
40 | } | ||
41 | |||
42 | ULONG DropSource::Release() | ||
43 | { | ||
44 | LONG count = InterlockedDecrement(&ref_count_); | ||
45 | if(count == 0) | ||
46 | { | ||
47 | delete this; | ||
48 | return 0; | ||
49 | } | ||
50 | return count; | ||
51 | } | ||
52 | |||
53 | |||
54 | // IDropSource | ||
55 | |||
56 | HRESULT DropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) | ||
57 | { | ||
58 | // if the Escape key has been pressed since the last call, cancel the drop | ||
59 | if(fEscapePressed == TRUE) | ||
60 | return DRAGDROP_S_CANCEL; | ||
61 | |||
62 | // if the LeftMouse button has been released, then do the drop! | ||
63 | if((grfKeyState & MK_LBUTTON) == 0) | ||
64 | return DRAGDROP_S_DROP; | ||
65 | |||
66 | // continue with the drag-drop | ||
67 | return S_OK; | ||
68 | } | ||
69 | |||
70 | HRESULT DropSource::GiveFeedback(DWORD dwEffect __UNUSED__) | ||
71 | { | ||
72 | return DRAGDROP_S_USEDEFAULTCURSORS; | ||
73 | } | ||
74 | |||
75 | |||
76 | // ecore_win32 private functions | ||
77 | |||
78 | void *_ecore_win32_dnd_drop_source_new() | ||
79 | { | ||
80 | IDropSource *object = new DropSource(); | ||
81 | assert(object != NULL); | ||
82 | return object; | ||
83 | } | ||
84 | |||
85 | void _ecore_win32_dnd_drop_source_free(void *drop_source) | ||
86 | { | ||
87 | if (!drop_source) | ||
88 | return; | ||
89 | |||
90 | IDropSource *object = (IDropSource *)drop_source; | ||
91 | object->Release(); | ||
92 | } | ||