pleyo.com

/src/trunk2/BAL/Interfaces/DragData.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Apple Inc.  All rights reserved.
00003  * Copyright (C) 2007 Pleyo.  All rights reserved.
00004  * 
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00015  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00018  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00025  */
00026 
00027 #ifndef DragData_h
00028 #define DragData_h
00029 
00030 #include "ClipboardAccessPolicy.h"
00031 #include "Color.h"
00032 #include "DragActions.h"
00033 #include "IntPoint.h"
00034 
00035 #include <wtf/Forward.h>
00036 #include <wtf/Vector.h>
00037 
00038 #if PLATFORM(MAC)
00039 #ifdef __OBJC__ 
00040 #import <Foundation/Foundation.h>
00041 #import <AppKit/NSDragging.h>
00042 typedef id <NSDraggingInfo> DragDataRef;
00043 #else
00044 typedef void* DragDataRef;
00045 #endif
00046 #elif PLATFORM(QT)
00047 class QMimeData;
00048 typedef const QMimeData* DragDataRef;
00049 #elif PLATFORM(WIN)
00050 typedef struct IDataObject* DragDataRef;
00051 #elif PLATFORM(GTK)
00052 // FIXME: this should probably be something gdk-specific
00053 typedef void* DragDataRef;
00054 #elif defined __OWB__
00055 typedef void* DragDataRef;
00056 #endif
00057 
00058 
00059 namespace WebCore {
00060     
00061     class Clipboard;
00062     class Document;
00063     class DocumentFragment;
00064     class KURL;
00065     
00066 #if PLATFORM(MAC)
00067     class PasteboardHelper;
00068 #endif
00069 
00070     
00071     class DragData {
00072     public:
00073 #if PLATFORM(MAC)
00074         //FIXME: In the future the WebKit functions provided by the helper class should be moved into WebCore, 
00075         //after which this constructor should be removed
00076         DragData(DragDataRef data, const IntPoint& clientPosition, const IntPoint& globalPosition,
00077                  DragOperation operation, PasteboardHelper*);
00078 #else
00079         //clientPosition is taken to be the position of the drag event within the target window, with (0,0) at the top left
00080         DragData(DragDataRef data, const IntPoint& clientPosition, const IntPoint& globalPosition, DragOperation operation);
00081 #endif
00082         const IntPoint& clientPosition() const { return m_clientPosition; }
00083         const IntPoint& globalPosition() const { return m_globalPosition; }
00084         DragDataRef platformData() const { return m_platformDragData; }
00085         DragOperation draggingSourceOperationMask() const { return m_draggingSourceOperationMask; }
00086         Clipboard* createClipboard(ClipboardAccessPolicy) const;
00087         bool containsURL() const;
00088         bool containsPlainText() const;
00089         bool containsCompatibleContent() const;
00090         String asURL(String* title = 0) const;
00091         String asPlainText() const;
00092         void asFilenames(Vector<String>&) const;
00093         Color asColor() const;
00094         PassRefPtr<DocumentFragment> asFragment(Document*) const;
00095         bool canSmartReplace() const;
00096         bool containsColor() const;
00097         bool containsFiles() const;
00098     private:
00099         IntPoint m_clientPosition;
00100         IntPoint m_globalPosition;
00101         DragDataRef m_platformDragData;
00102         DragOperation m_draggingSourceOperationMask;
00103 #if PLATFORM(MAC)
00104         PasteboardHelper* m_pasteboardHelper;
00105 #endif
00106 };
00107     
00108 } //namespace WebCore
00109 
00110 #endif 
00111 

Generated on Wed Nov 21 20:04:16 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com