| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 */ | |
| 25 | |
| 26 #ifndef ClipboardMac_h | |
| 27 #define ClipboardMac_h | |
| 28 | |
| 29 #include "CachedImage.h" | |
| 30 #include "CachedImageClient.h" | |
| 31 #include "Clipboard.h" | |
| 32 #include <wtf/RetainPtr.h> | |
| 33 | |
| 34 OBJC_CLASS NSImage; | |
| 35 | |
| 36 namespace WebCore { | |
| 37 | |
| 38 class Frame; | |
| 39 class FileList; | |
| 40 | |
| 41 class ClipboardMac : public Clipboard, public CachedImageClient { | |
| 42 WTF_MAKE_FAST_ALLOCATED; | |
| 43 public: | |
| 44 enum ClipboardContents { | |
| 45 DragAndDropData, | |
| 46 DragAndDropFiles, | |
| 47 CopyAndPasteGeneric | |
| 48 }; | |
| 49 | |
| 50 static PassRefPtr<ClipboardMac> create(ClipboardType clipboardType, const St
ring& pasteboardName, ClipboardAccessPolicy policy, ClipboardContents clipboardC
ontents, Frame* frame) | |
| 51 { | |
| 52 return adoptRef(new ClipboardMac(clipboardType, pasteboardName, policy,
clipboardContents, frame)); | |
| 53 } | |
| 54 | |
| 55 virtual ~ClipboardMac(); | |
| 56 | |
| 57 void clearData(const String& type); | |
| 58 void clearAllData(); | |
| 59 String getData(const String& type) const; | |
| 60 bool setData(const String& type, const String& data); | |
| 61 | |
| 62 virtual bool hasData(); | |
| 63 | |
| 64 // extensions beyond IE's API | |
| 65 virtual ListHashSet<String> types() const; | |
| 66 virtual PassRefPtr<FileList> files() const; | |
| 67 | |
| 68 void setDragImage(CachedImage*, const IntPoint&); | |
| 69 void setDragImageElement(Node *, const IntPoint&); | |
| 70 | |
| 71 virtual DragImageRef createDragImage(IntPoint& dragLoc) const; | |
| 72 #if ENABLE(DRAG_SUPPORT) | |
| 73 virtual void declareAndWriteDragImage(Element*, const KURL&, const String& t
itle, Frame*); | |
| 74 #endif | |
| 75 virtual void writeRange(Range*, Frame* frame); | |
| 76 virtual void writeURL(const KURL&, const String&, Frame* frame); | |
| 77 virtual void writePlainText(const String&); | |
| 78 | |
| 79 // Methods for getting info in Cocoa's type system | |
| 80 NSImage *dragNSImage(NSPoint&) const; // loc converted from dragLoc, based o
n whole image size | |
| 81 const String& pasteboardName() { return m_pasteboardName; } | |
| 82 | |
| 83 private: | |
| 84 ClipboardMac(ClipboardType, const String& pasteboardName, ClipboardAccessPol
icy, ClipboardContents, Frame*); | |
| 85 | |
| 86 void setDragImage(CachedImage*, Node*, const IntPoint&); | |
| 87 | |
| 88 String m_pasteboardName; | |
| 89 int m_changeCount; | |
| 90 ClipboardContents m_clipboardContents; | |
| 91 Frame* m_frame; // used on the source side to generate dragging images | |
| 92 }; | |
| 93 | |
| 94 } | |
| 95 | |
| 96 #endif | |
| OLD | NEW |