Exemplo n.º 1
0
//////////////////
// Handle button-up: drop the data and return to home state (NONE).
//
BOOL CDragDropMgr::OnButtonUp(const MSG& msg)
{
	if (!IsDragging()) 
    {
		SetState(NONE); 
		return FALSE;
	}

	if (IsTargetWnd(m_ddi.hwndTarget)) 
    {
		CPoint pt = GETPOINT(msg.lParam);

		CWnd* pWndSource = CWnd::FromHandle(m_ddi.hwndSource);
		CWnd* pWndTarget = CWnd::FromHandle(m_ddi.hwndTarget);

		pWndSource->ClientToScreen(&pt);
		pWndTarget->ScreenToClient(&pt);
		m_ddi.pt = pt;

		SendDragMessage(WM_DD_DRAGDROP);
	} 
    else 
    {
		SendDragMessage(WM_DD_DRAGABORT);
	}

	SetState(NONE);
    
	return TRUE;
}
Exemplo n.º 2
0
void ReImagePanel::mouseReleaseEvent( QMouseEvent* _event )
{
	if( HasContent() )
	{
		if( IsDragging() )
			m_dragStart.setX( -1 );
	}
}
Exemplo n.º 3
0
void CDragDropMgr::CancelDrag()
{
    if (IsDragging())
    {
        SendDragMessage(WM_DD_DRAGABORT);
        SetState(NONE);
    }
}
Exemplo n.º 4
0
void SpeedDialThumbnail::OnMouseLeave()
{
	if (IsDragging())
	{
		StopDragging();
		return;
	}

	GenericThumbnail::OnMouseLeave();
}
Exemplo n.º 5
0
void CTreeFileCtrl::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (IsDragging())
  {
    CRect clientRect;
    GetClientRect(&clientRect);

    //Draw the drag
    POINT pt = point;
    ClientToScreen(&pt);
    CImageList::DragMove(pt);

    //Only select the drop item if we are in the client area
    HTREEITEM hItem = NULL;
    if (clientRect.PtInRect(point))
    {
      UINT flags;
      hItem = HitTest(point, &flags);
      if (m_hItemDrop != hItem)
      {
        CImageList::DragShowNolock(FALSE);
        SelectDropTarget(hItem);
        m_hItemDrop = hItem;
        CImageList::DragShowNolock(TRUE);
      }
    }
    
    if (hItem)
      hItem = GetDropTarget(hItem);

    //Change the cursor to give feedback
    if (hItem)
    {
      if ((GetKeyState(VK_CONTROL) & 0x8000))
        SetCursor(m_DropCopyCursor);
      else
        SetCursor(m_DropMoveCursor);
    }
    else
    {
      if ((GetKeyState(VK_CONTROL) & 0x8000))
        SetCursor(m_NoDropCopyCursor);
      else
        SetCursor(m_NoDropMoveCursor);
    }
  }

  //Let the parent class do its thing	
	CTreeCtrl::OnMouseMove(nFlags, point);
}
Exemplo n.º 6
0
void ReImagePanel::mouseMoveEvent( QMouseEvent* _event )
{
	if( HasContent() )
	{
		if( IsDragging() )
		{
			// Dragging: vertical only.
			QPoint delta = _event->pos() - m_dragStart;
			m_contentOrigin = m_contentOriginBackup + delta;

			update();
		}
	}
}
Exemplo n.º 7
0
void wxHeaderCtrl::OnKeyDown(wxKeyEvent& event)
{
    if ( event.GetKeyCode() == WXK_ESCAPE )
    {
        if ( IsDragging() )
        {
            ReleaseMouse();
            CancelDragging();

            return;
        }
    }

    event.Skip();
}
Exemplo n.º 8
0
void SpeedDialThumbnail::OnMouseUp(const OpPoint& point, MouseButton button, UINT8 nclicks)
{
	m_mouse_down_active = false;

	if (IsDragging())
	{
		StopDragging();
		return;
	}

	if (!GetAnimation() || !GetAnimation()->IsAnimating())
		SetFloating(false);

	GenericThumbnail::OnMouseUp(point, button, nclicks);
}
Exemplo n.º 9
0
void SpeedDialThumbnail::StopDragging()
{
	if (!IsDragging())
		return;

	// Animate it back to its original position.
	QuickAnimationParams params(this);
	params.duration       = 0.2;
	params.curve          = ANIM_CURVE_SLOW_DOWN;
	params.move_type      = ANIM_MOVE_RECT_TO_ORIGINAL;
	params.listener       = this;
	params.callback_param = ANIMATE_MOVE;
	g_animation_manager->startAnimation(params);

	OP_DELETE(m_drag_object);
	m_drag_object = NULL;
}
Exemplo n.º 10
0
void wxHeaderCtrl::CancelDragging()
{
    wxASSERT_MSG( IsDragging(),
                  "shouldn't be called if we're not dragging anything" );

    EndDragging();

    unsigned int& col = IsResizing() ? m_colBeingResized : m_colBeingReordered;

    wxHeaderCtrlEvent event(wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED, GetId());
    event.SetEventObject(this);
    event.SetColumn(col);

    GetEventHandler()->ProcessEvent(event);

    col = COL_NONE;
}
Exemplo n.º 11
0
/**
* Calculates distance between drag start mouse pos and
* current mouse pos. Returns 0 if drag is not in progress.
*/
float tcDragStatus::CurrentDragDistance() const
{
    if (IsDragging())
    {
        wxPoint pos = wxGetMousePosition();
        wxPoint delta = pos - dragStartPos;

        float dx = float(delta.x);
        float dy = float(delta.y);
            
        return sqrtf(dx*dx + dy*dy);
    }
    else
    {
        return 0;
    }
}
Exemplo n.º 12
0
//////////////////
// Handle button-down message: enter CAPTURED state.
//
BOOL CDragDropMgr::OnButtonDown(const MSG& msg)
{
	ASSERT (IsSourceWnd(msg.hwnd));

	// if we're already dragging then this must be a click with another mouse button
	// so we just abort
	if (IsDragging())
	{
		SendDragMessage(WM_DD_DRAGABORT);
		SetState(NONE);

		return TRUE;
	}
	
	// convert m_ptOrg to client coords
	if (msg.message == WM_NCLBUTTONDOWN || msg.message == WM_NCRBUTTONDOWN)
	{
		// check we're not on a scrollbar
		UINT nHitTest = SendMessage(msg.hwnd, WM_NCHITTEST, 0, msg.lParam);
		
		if (nHitTest == HTHSCROLL || nHitTest == HTVSCROLL)
			return FALSE;
		
		CPoint pt = GETPOINT(msg.lParam);
		::ScreenToClient(msg.hwnd, &pt);
		
		// or above or below the client area
		CRect rClient;
		::GetClientRect(msg.hwnd, rClient);
		
		if (pt.y < rClient.top || pt.y > rClient.bottom)
			return FALSE;
		
		m_ptOrg = pt;
	}
	else
		m_ptOrg = GETPOINT(msg.lParam);
	
	m_hwndTracking = msg.hwnd;
	SetState(CAPTURED);
	
	return FALSE;
}
Exemplo n.º 13
0
void ReImagePanel::Tick( qreal _delta )
{
	bool isDirty = false;

	// Update item positioning.
	TItemListItor itor = m_itemList.begin();
	TItemListItor itorEnd = m_itemList.end();	

	for( ; itor != itorEnd; ++itor )
	{
		ReImageItem* item = *itor;
		if( NULL != item )
		{
			static qreal sXSpeed = 200.0f;
			static qreal sYSpeed = 200.0f;
			int x = item->m_pos.x();
			int newX = item->m_newPos.x();			
			int y = item->m_pos.y();
			int newY = item->m_newPos.y();

			if( x != newX )
			{
				bool sign = x < newX;
				x += sign ? 10 : -10;
				if( sign != ( x < newX ) )
					x = newX;

				item->m_pos.setX( x );
				isDirty = true;
			}

			if( y != newY )
			{				
				bool sign = y < newY;
				y += sign ? 10 : -10;
				if( sign != ( y < newY ) )
					y = newY;

				item->m_pos.setY( y );
				isDirty = true;
			}
		}
	}

	// Rect enveloping.
	if( HasContent() && !IsDragging() )
	{
		int newViewportOriginX = m_contentOrigin.x();
		int newViewportOriginY = m_contentOrigin.y();
		QSize bv = GetBv();
		if( ReRectEnveloper::sTick( newViewportOriginX, newViewportOriginY, m_contentOrigin.x(), m_contentOrigin.y(),
			bv.width(), bv.height(), 0, 0, width(), height(), ReRectEnveloper::EAlign_MiddleH ) )
		{
			m_contentOrigin.setX( newViewportOriginX );
			m_contentOrigin.setY( newViewportOriginY );
			isDirty = true;
		}
	}

	if( isDirty )
		update();
}
Exemplo n.º 14
0
void CTreeFileCtrl::EndDragging(BOOL bCancel)
{
  if (IsDragging())
  {
    KillTimer(m_nTimerID);

    CImageList::DragLeave(this);
    CImageList::EndDrag();
    ReleaseCapture();

    delete m_pilDrag;
    m_pilDrag = NULL;

    //Remove drop target highlighting
    SelectDropTarget(NULL);

    m_hItemDrop = GetDropTarget(m_hItemDrop);
    if (m_hItemDrop == NULL)
      return;

    if (!bCancel)
    {
      //Also need to make the change on disk
      CString sFromPath = ItemToPath(m_hItemDrag);
      CString sToPath = ItemToPath(m_hItemDrop);

      int nFromLength = sFromPath.GetLength();
      int nToLength = sToPath.GetLength();
      SHFILEOPSTRUCT shfo;
      ZeroMemory(&shfo, sizeof(SHFILEOPSTRUCT));
      shfo.hwnd = GetSafeHwnd();

      if ((GetKeyState(VK_CONTROL) & 0x8000))
        shfo.wFunc = FO_COPY;
      else
        shfo.wFunc = FO_MOVE;

      shfo.fFlags = FOF_SILENT | FOF_NOCONFIRMMKDIR;
      //Undo is not allowed if the SHIFT key is held down
      if (!(GetKeyState(VK_SHIFT) & 0x8000))
        shfo.fFlags |= FOF_ALLOWUNDO;

      TCHAR* pszFrom = new TCHAR[nFromLength + 2];
      _tcscpy(pszFrom, sFromPath);
      pszFrom[nFromLength+1] = _T('\0');
      shfo.pFrom = pszFrom;

      TCHAR* pszTo = new TCHAR[nToLength + 2];
      _tcscpy(pszTo, sToPath);
      pszTo[nToLength+1] = _T('\0');
      shfo.pTo = pszTo;

      //Let the shell perform the actual deletion
      BOOL bSuccess = ((SHFileOperation(&shfo) == 0) && (shfo.fAnyOperationsAborted == FALSE));

      //Free up the memory we had allocated
      delete [] pszFrom;
      delete [] pszTo;

      if (bSuccess)
      {
        //Only copy the item in the tree if there is not an item with the same
        //text under m_hItemDrop
        CString sText = GetItemText(m_hItemDrag);
        if (!HasChildWithText(m_hItemDrop, sText))
        {
          //Do the actual copy
          BOOL bHadChildren = (GetChildItem(m_hItemDrop) != NULL);
          CopyBranch(m_hItemDrag, m_hItemDrop);

          //Update the children indicator for the folder we just dropped into
          if (!bHadChildren)
          {
            TV_ITEM tvItem;
            tvItem.hItem = m_hItemDrop;
            tvItem.mask = TVIF_CHILDREN;  
            tvItem.cChildren = 1;
            SetItem(&tvItem);
          }
        }

        BOOL bExpanded = (GetChildItem(m_hItemDrop) != NULL); 
        if (shfo.wFunc == FO_MOVE)
        {
          //Get the parent of the item we moved prior to deleting it
          HTREEITEM hParent = GetParentItem(m_hItemDrag);

          //Delete the item we just moved
          DeleteItem(m_hItemDrag);

          //Update the children indicator for the item we just dragged from
          BOOL bHasChildren = (GetChildItem(hParent) != NULL);
          if (hParent && !bHasChildren)
          {
            TV_ITEM tvItem;
            tvItem.hItem = hParent;
            tvItem.mask = TVIF_CHILDREN;  
            tvItem.cChildren = 0;
            SetItem(&tvItem);
          }
        }
        SetSelectedPath(sToPath, bExpanded);
      }
    }
  }
}
Exemplo n.º 15
0
void SpeedDialThumbnail::OnMouseMove(const OpPoint& point)
{
	if (g_widget_globals->captured_widget != this
			|| !m_mouse_down_active
			|| m_entry->IsEmpty()
			|| GetLocked())
		return GenericThumbnail::OnMouseMove(point);

	if (!IsDragging())
	{
		const int drag_treshold = 5;
		const bool treshold_reached = ((labs(point.x - m_mousedown_point.x) > drag_treshold) ||
		                               (labs(point.y - m_mousedown_point.y) > drag_treshold));
		if (treshold_reached)
		{
			if (StartDragging(point.x, point.y))
			{
				SetZ(Z_TOP);
			}
		}
	}

	if (IsDragging())
	{
		OpPoint parent_point = point;
		parent_point.x += rect.x;
		parent_point.y += rect.y;
		if (!GetParent()->GetBounds().Contains(parent_point) && !g_drag_manager->IsDragging())
		{
			if(g_input_manager->GetTouchInputState() & TOUCH_INPUT_ACTIVE)
			{
				// if this is caused by inertia, we don't want it flying off the viewport, nor
				// do we want to start an drag and drop outside Opera with touch
				StopDragging();
				return;
			}
			// Stop dragging and start drag'n'drop when we move it out from the viewport.
			StopDragging();
			if (StartDragging(parent_point.x, parent_point.y) && m_drag_object)
			{
				// Yes, that's on purpose: reset member first, then call StartDrag().
				DesktopDragObject* object = m_drag_object;
				m_drag_object = NULL;
				// This transfers drag object ownership to OpDragManager:
				g_drag_manager->StartDrag(object, NULL, FALSE);
			}
			return;
		}

		// Drag the floating thumbnail widget.
		int x = rect.x + point.x - m_mousedown_point.x;
		int y = rect.y + point.y - m_mousedown_point.y;
		SetRect(OpRect(x, y, rect.width, rect.height));

		// See if we are hovering over another thumbnail, and if so,
		// move the thumbnails to the new positions.
		SpeedDialThumbnail *other_sdt = GetDropThumbnail();
		if (other_sdt && other_sdt->GetContent()->AcceptsDragDrop(*m_drag_object))
		{
			other_sdt->GetContent()->HandleDragDrop(*m_drag_object);

			int target_pos = g_speeddial_manager->FindSpeedDial(m_entry);
			m_drag_object->SetID(target_pos);

			GetParent()->Relayout(true, false);
		}
	}
}
Exemplo n.º 16
0
//////////////////
// Handle mousemove: enter DRAGGING state.
//
BOOL CDragDropMgr::OnMouseMove(const MSG& msg)
{
	if (!IsCaptured())
		return FALSE;

	BOOL bLButtonDown = (GetKeyState(VK_LBUTTON) & 0x8000);
	BOOL bRButtonDown = (GetKeyState(VK_RBUTTON) & 0x8000);

	// check mouse button is still down
	if (!bLButtonDown && !bRButtonDown)
	{
		SetState(NONE); 
		return FALSE;
	}

	CWnd* pWnd = CWnd::FromHandle(m_hwndTracking);
	CPoint pt = GETPOINT(msg.lParam);

	if (IsDragging()) 
    {
		// already dragging: move drag image
		pWnd->ClientToScreen(&pt); // convert to screen coords

		// get new target window if any
		m_ddi.pt = pt;

		m_pMainWnd->ScreenToClient(&m_ddi.pt); // convert to main window coords
		HWND hwndTarget = ::ChildWindowFromPoint(*m_pMainWnd, m_ddi.pt);

		if (hwndTarget)
		{
			m_pMainWnd->ClientToScreen(&m_ddi.pt); // back to screen
			ScreenToClient(hwndTarget, &m_ddi.pt); // then to target client coords
		}
		else
			m_ddi.pt.x = m_ddi.pt.y = -10000;
		
		m_ddi.hwndTarget = hwndTarget;

		// m_ddi.pt is current pos in client coords of current target window
		SendDragMessage(WM_DD_PREDRAGMOVE);

		// now move drag image
		m_pDragImage->DragMove(pt);

		// update ui
		UINT nDropEffect = SendDragMessage(WM_DD_DRAGOVER);

		// set the cursor
        if (!(m_ddi.hwndTarget && IsTargetWnd(m_ddi.hwndTarget)))
			nDropEffect = DROPEFFECT_NONE;

		HCURSOR hCur = NULL;

		if (!m_hInstOle32)
			m_hInstOle32 = LoadLibrary(_T("Ole32.dll"));

		switch (nDropEffect)
		{
		case DD_DROPEFFECT_COPY:
			hCur = LoadCursor(m_hInstOle32, MAKEINTRESOURCE(3));
			break;

		case DD_DROPEFFECT_MOVE:
			hCur = LoadCursor(m_hInstOle32, MAKEINTRESOURCE(2));
			break;

		case DD_DROPEFFECT_LINK:
			hCur = LoadCursor(m_hInstOle32, MAKEINTRESOURCE(4));
			break;

		case DD_DROPEFFECT_NONE:
		default:
			hCur = LoadCursor(m_hInstOle32, MAKEINTRESOURCE(1));
			break;
		}

		if (hCur)
			SetCursor(hCur);
	} 
    else // if (IsCaptured())
    {
		// Not dragging yet: enter drag mode if mouse moves beyond threshhold.
		CPoint delta = pt - m_ptOrg;
		static CPoint jog(GetSystemMetrics(SM_CXDRAG), GetSystemMetrics(SM_CYDRAG));

		if (abs(delta.x) > jog.x || abs(delta.y) > jog.y) 
        {
			m_ddi.hwndSource = m_hwndTracking;
			m_ddi.pt = m_ptOrg;	// start from ORIGINAL point, not where now
			m_ddi.hwndTarget = m_hwndTracking;
			m_ddi.pData = NULL;
			m_ddi.bLeftDrag = bLButtonDown;

			// Send main window a message: enter drag mode. 
			BOOL bDrag = SendDragMessage(WM_DD_DRAGENTER);

			if (bDrag && m_ddi.pData) 
            {
				SetState(bLButtonDown ? LDRAGGING : RDRAGGING);	// I am now dragging
				OnMouseMove(msg);

				CRect rc;
				m_pDragImage = m_ddi.pData->CreateDragImage(pWnd, rc);
				m_pDragImage->BeginDrag(0, rc.BottomRight());

				pWnd->ClientToScreen(&pt);
				m_pDragImage->DragEnter(NULL, pt);
			} 
            else
                SetState(NONE);
		}
	}
	return TRUE;
}
Exemplo n.º 17
0
BOOL CTreeFileCtrl::PreTranslateMessage(MSG* pMsg) 
{
  // When an item is being edited make sure the edit control
  // receives certain important key strokes
  if (GetEditControl())
  {
    ::TranslateMessage(pMsg);
    ::DispatchMessage(pMsg);
    return TRUE; // DO NOT process further
  }

  //Context menu via the keyboard
	if ((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) && // If we hit a key and
    	(pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) ||   // it's Shift+F10 OR
		  (pMsg->message == WM_CONTEXTMENU))						                   	   // Natural keyboard key
	{
		CRect rect;
		GetItemRect(GetSelectedItem(), rect, TRUE);
		ClientToScreen(rect);
		OnContextMenu(NULL, rect.CenterPoint());
		return TRUE;
	}
  //Hitting the Escape key, Cancelling drag & drop
	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE && IsDragging())
  {
    EndDragging(TRUE);
    return TRUE;
  }
  //Hitting the Alt-Enter key combination, show the properties sheet 
	else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN)
  {
    OnFileProperties();
    return TRUE;
  }
  //Hitting the Enter key, open the item
	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
  {
    OnFileOpen();
    return TRUE;
  }
  //Hitting the delete key, delete the item
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE)
  {
    OnFileDelete();
    return TRUE;
  }
  //hitting the backspace key, go to the parent folder
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_BACK)
  {
    UpOneLevel();
    return TRUE;
  }
  //hitting the F2 key, being in-place editing of an item
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F2)
  {
    OnFileRename();
    return TRUE;
  }
  //hitting the F5 key, force a refresh of the whole tree
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F5)
  {
    OnViewRefresh();
    return TRUE;
  }

  //Let the parent class do its thing
	return CTreeCtrl::PreTranslateMessage(pMsg);
}
Exemplo n.º 18
0
void wxHeaderCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
{
    if ( IsDragging() )
        CancelDragging();
}
Exemplo n.º 19
0
void psSlotManager::Handle( pawsDnDButton* target )
{
    if( target==NULL )
    {
       return;
    }
    if ( !IsDragging() )
    {
        // Make sure other code isn't drag-and-dropping a different object.
        pawsWidget *dndWidget = PawsManager::GetSingleton().GetDragDropWidget();
        if (dndWidget)
        {
            return;
        }

        if( (target->GetMaskingImage()==NULL || *(target->GetMaskingImage()->GetName())==0) && (target->GetName()==NULL || *(target->GetName())==0 ) )
        { //there's nothing in this button, don't drag it.
           return;
        }

        pawsDnDButton* widget = new pawsDnDButton();
        widget->SetRelativeFrame( 0,0, target->GetDefaultFrame().Width(), target->GetDefaultFrame().Height() );
        widget->PlaceItem( target->GetMaskingImage()!=NULL?target->GetMaskingImage()->GetName():NULL, target->GetName(), target->GetToolTip(), target->GetAction() );
        if( target->GetMaskingImage()==NULL || *(target->GetMaskingImage()->GetName()) == 0 )
        {
            widget->SetText(target->GetName());
        }

        widget->SetBackgroundAlpha(0);
        widget->SetParent( NULL );
        widget->SetIndexBase( target->GetIndexBase() );

        //SetDragDetails(parent, 0);

        SetDragDetails(target);
        isDragging = true;
        PawsManager::GetSingleton().SetDragDropWidget( widget );
    }
    else if( draggingSlot.stackCount == 0 ) //dragging from a dndbutton
    {
        //do nothing if it's the same slot and we aren't dragging a split item
        if(target == (pawsDnDButton *)draggingSlot.slot )
        {
            CancelDrag();
            return;
        }
        if ( target->GetDnDLock() ) //state "down" == true == editable
        {
            target->Clear();

            target->SetImageNameCallback( ((pawsDnDButton *)draggingSlot.slot)->GetImageNameCallback() );
            target->SetNameCallback( ((pawsDnDButton *)draggingSlot.slot)->GetNameCallback() );
            target->SetActionCallback( ((pawsDnDButton *)draggingSlot.slot)->GetActionCallback() );

            if( target->PlaceItem( ((pawsDnDButton *)draggingSlot.slot)->GetMaskingImage()!=NULL?((pawsDnDButton *)draggingSlot.slot)->GetMaskingImage()->GetName():NULL,  ((pawsDnDButton *)draggingSlot.slot)->GetName(), ((pawsDnDButton *)draggingSlot.slot)->GetToolTip(),  ((pawsDnDButton *)draggingSlot.slot)->GetAction() ) )
            {
                //move key bindings
                csString          editedCmd;
                const psControl*  keyBinding;
                csString          keyName;
                uint32            keyButton,
                                  keyMods;
                psControl::Device           keyDevice;

              
                editedCmd.Format("Shortcut %d",((pawsDnDButton *)draggingSlot.slot)->GetButtonIndex()+1 );
                keyBinding =  psengine->GetCharControl()->GetTrigger( editedCmd );

                if( keyBinding->name.Length()>0 )
                {
                    keyButton  = keyBinding->button;
                    keyMods    = keyBinding->mods;
                    keyDevice  = keyBinding->device;

                    psengine->GetCharControl()->RemapTrigger(editedCmd,psControl::NONE,0,0);
             
                    editedCmd.Format("Shortcut %d",target->GetButtonIndex()+1 );
                    psengine->GetCharControl()->RemapTrigger( editedCmd, keyDevice, keyButton, keyMods );
                }

                //set text if there's no icon
                if(  ((pawsDnDButton *)draggingSlot.slot)->GetMaskingImage()==NULL || *(((pawsDnDButton *)draggingSlot.slot)->GetMaskingImage()->GetName()) == 0 )
                {
                    target->SetText( ((pawsDnDButton *)draggingSlot.slot)->GetName() );
                }

                //clear contents of the originating button
                ((pawsDnDButton *)draggingSlot.slot)->Clear();

                //redraw the parent window to change layout
                target->SetParent( ((pawsDnDButton *)draggingSlot.slot)->GetParent() );
                target->GetParent()->GetParent()->OnResize(); // parent is the buttonHolder, grandparent is the shortcut window.

            }
            CancelDrag();
        }
    }
    else //dragging from a Slot
    {
        CancelDrag();
        if( !draggingSlot.Action.IsEmpty() )
        {
            target->PlaceItem( ((pawsSlot *)draggingSlot.slot)->ImageName(), draggingSlot.toolTip, draggingSlot.toolTip, draggingSlot.Action );
        }
        else
        {
            csString t = "/use " + draggingSlot.toolTip;
            target->PlaceItem( ((pawsSlot *)draggingSlot.slot)->ImageName(), draggingSlot.toolTip, draggingSlot.toolTip, t );
            draggingSlot.stackCount--;
        }
    }

}