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