CMFCTabDropTarget Class
Provides the communication mechanism between a tab control and the OLE libraries.
class CMFCTabDropTarget : public COleDropTarget
Name | Description |
---|---|
CMFCTabDropTarget::CMFCTabDropTarget |
Default constructor. |
Name | Description |
---|---|
CMFCTabDropTarget::OnDragEnter | Called by the framework when the user drags an object into a tab window. (Overrides COleDropTarget::OnDragEnter.) |
CMFCTabDropTarget::OnDragLeave | Called by the framework when the user drags an object outside of the tab window that has focus. (Overrides COleDropTarget::OnDragLeave.) |
CMFCTabDropTarget::OnDragOver | Called by the framework when the user drags an object onto the tab window that has focus. (Overrides COleDropTarget::OnDragOver.) |
CMFCTabDropTarget::OnDropEx | Called by the framework when the user releases the mouse button at the end of a drag operation. (Overrides COleDropTarget::OnDropEx.) |
CMFCTabDropTarget::Register | Registers the control as one that can be the target of an OLE drag-and-drop operation. |
This class provides drag-and-drop support to the CMFCBaseTabCtrl
class. If your application initializes the OLE libraries by using the AfxOleInit function, CMFCBaseTabCtrl
objects register themselves for drag-and-drop operations.
The CMFCTabDropTarget
class extends its base class by making the tab that is under the cursor when a drag operation occurs active. For more information about drag-and-drop operations, see OLE drag and drop.
The following example demonstrates how to construct a CMFCTabDropTarget
object and use its Register
method.
HWND hWndTab = NULL;
CBasePane *basePane = new CBasePane();
CMFCBaseTabCtrl *pTabParent = basePane->GetParentTabWnd(hWndTab);
CMFCTabDropTarget *dropTarget = new CMFCTabDropTarget();
dropTarget->Register(pTabParent);
Header: afxbasetabctrl.h
Called by the framework when the user drags an object into a tab window.
virtual DROPEFFECT OnDragEnter(
CWnd* pWnd,
COleDataObject* pDataObject,
DWORD dwKeyState,
CPoint point);
pWnd
[in] Unused.
pDataObject
[in] A pointer to the object that the user drags.
dwKeyState
[in] Contains the state of the modifier keys. This is a combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.
point
[in] The location of the cursor in client coordinates.
The effect that results if the drop occurs at the location specified by point. It can be one or more of the following:
DROPEFFECT_NONE
DROPEFFECT_COPY
DROPEFFECT_MOVE
DROPEFFECT_LINK
DROPEFFECT_SCROLL
This method returns DROPEFFECT_NONE if the toolbar framework is not in customization mode or the Clipboard data format is unavailable. Otherwise, it returns the result of calling CMFCBaseTabCtrl::OnDragEnter
with the provided parameters.
For more information about customization mode, see CMFCToolBar::IsCustomizeMode. For more information about Clipboard data formats, see COleDataObject::IsDataAvailable.
Called by the framework when the user drags an object outside of the tab window that has focus.
virtual void OnDragLeave(CWnd* pWnd);
pWnd
[in] Unused.
This method calls the CMFCBaseTabCtrl::OnDragLeave
method to perform the drag operation.
Called by the framework when the user drags an object onto the tab window that has focus.
virtual DROPEFFECT OnDragOver(
CWnd* pWnd,
COleDataObject* pDataObject,
DWORD dwKeyState,
CPoint point);
pWnd
[in] Unused.
pDataObject
[in] A pointer to the object that the user drags.
dwKeyState
[in] Contains the state of the modifier keys. This is a combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.
point
[in] The location of the mouse pointer in client coordinates.
The effect that results if the drop occurs at the location specified by point. It can be one or more of the following:
DROPEFFECT_NONE
DROPEFFECT_COPY
DROPEFFECT_MOVE
DROPEFFECT_LINK
DROPEFFECT_SCROLL
This method makes the tab that is under the cursor when a drag operation occurs active. It returns DROPEFFECT_NONE if the toolbar framework is not in customization mode or the Clipboard data format is unavailable. Otherwise, it returns the result of calling CMFCBaseTabCtrl::OnDragOver
with the provided parameters.
For more information about customization mode, see CMFCToolBar::IsCustomizeMode. For more information about Clipboard data formats, see COleDataObject::IsDataAvailable.
Called by the framework when the user releases the mouse button at the end of a drag operation.
virtual DROPEFFECT OnDropEx(
CWnd* pWnd,
COleDataObject* pDataObject,
DROPEFFECT dropEffect,
DROPEFFECT dropList,
CPoint point);
pWnd
[in] Unused.
pDataObject
[in] A pointer to the object that the user drags.
dropEffect
[in] The default drop operation.
dropList
[in] Unused.
point
[in] The location of the mouse pointer in client coordinates.
The resulting drop effect. It can be one or more of the following:
DROPEFFECT_NONE
DROPEFFECT_COPY
DROPEFFECT_MOVE
DROPEFFECT_LINK
DROPEFFECT_SCROLL
This method calls CMFCBaseTabCtrl::OnDrop
if the toolbar framework is in customization mode and the Clipboard data format is available. If the call to CMFCBaseTabCtrl::OnDrop
returns a nonzero value, this method returns the default drop effect specified by dropEffect. Otherwise, this method returns DROPEFFECT_NONE. For more information about drop effects, see COleDropTarget::OnDropEx.
For more information about customization mode, see CMFCToolBar::IsCustomizeMode. For more information about Clipboard data formats, see COleDataObject::IsDataAvailable.
Registers the control as one that can be the target of an OLE drag-and-drop operation.
BOOL Register(CMFCBaseTabCtrl *pOwner);
pOwner
[in] The tab control to register as a drop target.
Nonzero if registration was successful; otherwise 0.
This method calls COleDropTarget::Register to register the control for drag-and-drop operations.