]>
Commit | Line | Data |
---|---|---|
7dab9892 KO |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/dnd_osx.cpp | |
3 | // Purpose: Mac common wxDropTarget, wxDropSource implementations | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id: dnd.cpp 61724 2009-08-21 10:41:26Z VZ $ | |
8 | // Copyright: (c) 1998 Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #if wxUSE_DRAG_AND_DROP | |
15 | ||
16 | #include "wx/dnd.h" | |
17 | ||
18 | #ifndef WX_PRECOMP | |
19 | #include "wx/app.h" | |
20 | #include "wx/toplevel.h" | |
21 | #include "wx/gdicmn.h" | |
22 | #endif // WX_PRECOMP | |
23 | ||
24 | #include "wx/osx/private.h" | |
25 | ||
26 | //---------------------------------------------------------------------------- | |
27 | // wxDropTarget | |
28 | //---------------------------------------------------------------------------- | |
29 | ||
30 | wxDragResult wxDropTarget::OnDragOver( | |
31 | wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), | |
32 | wxDragResult def ) | |
33 | { | |
34 | return CurrentDragHasSupportedFormat() ? def : wxDragNone; | |
35 | } | |
36 | ||
37 | wxDataFormat wxDropTarget::GetMatchingPair() | |
38 | { | |
39 | wxFAIL_MSG("wxDropTarget::GetMatchingPair() not implemented in src/osx/carbon/dnd.cpp"); | |
40 | return wxDF_INVALID; | |
41 | } | |
42 | ||
43 | bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) | |
44 | { | |
45 | if (m_dataObject == NULL) | |
46 | return false; | |
47 | ||
48 | return CurrentDragHasSupportedFormat(); | |
49 | } | |
50 | ||
51 | wxDragResult wxDropTarget::OnData( | |
52 | wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), | |
53 | wxDragResult def ) | |
54 | { | |
55 | if (m_dataObject == NULL) | |
56 | return wxDragNone; | |
57 | ||
58 | if (!CurrentDragHasSupportedFormat()) | |
59 | return wxDragNone; | |
60 | ||
61 | return GetData() ? def : wxDragNone; | |
62 | } | |
63 | ||
64 | //------------------------------------------------------------------------- | |
65 | // wxDropSource | |
66 | //------------------------------------------------------------------------- | |
67 | ||
68 | //----------------------------------------------------------------------------- | |
69 | // drag request | |
70 | ||
71 | wxDropSource::~wxDropSource() | |
72 | { | |
73 | } | |
74 | ||
75 | bool wxDropSource::MacInstallDefaultCursor(wxDragResult effect) | |
76 | { | |
77 | const wxCursor& cursor = GetCursor(effect); | |
78 | bool result = cursor.Ok(); | |
79 | ||
80 | if ( result ) | |
81 | cursor.MacInstall(); | |
82 | ||
83 | return result; | |
84 | } | |
85 | ||
86 | #endif // wxUSE_DRAG_AND_DROP | |
87 |