Blender V2.61 - r43446

GHOST_DropTargetWin32.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef _GHOST_DROP_TARGET_WIN32_H_
00033 #define _GHOST_DROP_TARGET_WIN32_H_
00034 
00035 #include <string.h>
00036 #include <GHOST_Types.h>
00037 #include "GHOST_WindowWin32.h"
00038 #include "GHOST_SystemWin32.h"
00039 
00040 class GHOST_DropTargetWin32 : public IDropTarget
00041 {
00042 public:
00043     /* IUnknownd implementation.
00044      * Enables clients to get pointers to other interfaces on a given object 
00045      * through the QueryInterface method, and manage the existence of the object
00046      * through the AddRef and Release methods. All other COM interfaces are 
00047      * inherited, directly or indirectly, from IUnknown. Therefore, the three 
00048      * methods in IUnknown are the first entries in the VTable for every interface. 
00049      */
00050     HRESULT __stdcall QueryInterface (REFIID riid, void ** ppvObj);
00051     ULONG   __stdcall AddRef (void);
00052     ULONG   __stdcall Release (void);
00053 
00054     /* IDropTarget implementation
00055      + The IDropTarget interface is one of the interfaces you implement to
00056      provide drag-and-drop operations in your application. It contains methods 
00057      used in any application that can be a target for data during a 
00058      drag-and-drop operation. A drop-target application is responsible for:
00059      * 
00060      *  - Determining the effect of the drop on the target application.
00061      *  - Incorporating any valid dropped data when the drop occurs.
00062      *  - Communicating target feedback to the source so the source application
00063      *    can provide appropriate visual feedback such as setting the cursor.
00064      *  - Implementing drag scrolling.
00065      *  - Registering and revoking its application windows as drop targets.
00066      * 
00067      * The IDropTarget interface contains methods that handle all these 
00068      * responsibilities except registering and revoking the application window 
00069      * as a drop target, for which you must call the RegisterDragDrop and the 
00070      * RevokeDragDrop functions.
00071      */
00072     
00073     HRESULT __stdcall DragEnter (IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
00074     HRESULT __stdcall DragOver (DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
00075     HRESULT __stdcall DragLeave (void);
00076     HRESULT __stdcall Drop (IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
00077 
00086     GHOST_DropTargetWin32(GHOST_WindowWin32 * window, GHOST_SystemWin32 * system);
00087 
00092     ~GHOST_DropTargetWin32();
00093 
00094 private:
00095 
00096     /* Internal helper functions */
00097 
00103     DWORD allowedDropEffect(DWORD dwAllowed);
00104 
00110     GHOST_TDragnDropTypes getGhostType(IDataObject * pDataObject);
00111 
00118     void * getGhostData(IDataObject * pDataObject);
00119 
00125     void * getDropDataAsFilenames(IDataObject * pDataObject);
00126 
00132     void * getDropDataAsString(IDataObject * pDataObject);
00133 
00142     int WideCharToANSI(LPCWSTR in, char * &out);
00143 
00144     /* Private member variables */
00145     /* COM reference count. */
00146     LONG    m_cRef; 
00147     /* Handle of the associated window. */
00148     HWND    m_hWnd;
00149     /* The associated GHOST_WindowWin32. */
00150     GHOST_WindowWin32 * m_window;
00151     /* The System. */
00152     GHOST_SystemWin32 * m_system;
00153     /* Data type of the dragged object */
00154     GHOST_TDragnDropTypes m_draggedObjectType;
00155 
00156 };
00157 
00158 #endif  // _GHOST_DROP_TARGET_WIN32_H_