Exemplo n.º 1
0
//
/// Handle the DRAGLISTMSGSTRING notification by calling virtual functions
/// based on the notification message.
//
/// Responds to the DL_BEGINDRAG, DL_DRAGGING, DL_DROPPED, and DL_CANCELDRAG
/// messages by calling the BeginDrag, Dragging, Dropped, and CancelDrag functions
/// respectively.
//
TResult
TDragList::DragNotify(TParam1, TParam2 lp)
{
  DRAGLISTINFO * info = (DRAGLISTINFO *)lp;
  if (info) {
    TPoint p = info->ptCursor;
    int item = ItemFromPoint(p);

    switch (info->uNotification) {
      case DL_BEGINDRAG:
        return BeginDrag(item, p);

      case DL_DRAGGING:
        return Dragging(item, p);

      case DL_DROPPED:
        Dropped(item, p);
        break;

      case DL_CANCELDRAG:
        CancelDrag(item, p);
        break;

      default:
        // Should not ever happen.
        ///TH perhaps throw an exception?
        break;
    }
  }
  return 0;
}
Exemplo n.º 2
0
status_t
TBarView::DragStart()
{
	if (!Dragging())
		return B_OK;

	BPoint loc;
	uint32 buttons;
	GetMouse(&loc, &buttons);

	if (fExpando && fExpando->Frame().Contains(loc)) {
		ConvertToScreen(&loc);
		BPoint expandoLocation = fExpando->ConvertFromScreen(loc);
		TTeamMenuItem* item = fExpando->TeamItemAtPoint(expandoLocation);

		if (fLastDragItem)
			init_tracking_hook(fLastDragItem, NULL, NULL);

		if (item != NULL) {
			if (item == fLastDragItem)
				return B_OK;

			fLastDragItem = item;
		}
	}

	return B_OK;
}
Exemplo n.º 3
0
void
TBarView::DragStop(bool full)
{
	if (!Dragging())
		return;
	
	//
	//	revert the local click to open to
	//	the launch state, cached in constructor
	_menu_info_ptr_->click_to_open = fClickToOpen;

	if (fExpando) {
		if (fLastDragItem) {
			init_tracking_hook(fLastDragItem, NULL, NULL);
			fLastDragItem = NULL;
		}
	}
	
	if (full) {
		delete fDragMessage;
		fDragMessage = NULL;
	
		delete fCachedTypesList;
		fCachedTypesList = NULL;
	}
}
Exemplo n.º 4
0
void
TBarView::CacheDragData(const BMessage* incoming)
{
	if (!incoming)
		return;

	if (Dragging() && SpringLoadedFolderCompareMessages(incoming, fDragMessage))
		return;

	// disposes then fills cached drag message and
	// mimetypes list
	SpringLoadedFolderCacheDragData(incoming, &fDragMessage, &fCachedTypesList);
}
Exemplo n.º 5
0
bool
TBarView::InvokeItem(const char* signature)
{
	// sent from TeamMenuItem
	if (Dragging() && AppCanHandleTypes(signature)) {
		SendDragMessage(signature);
		// invoking okay to toss memory
		DragStop(true);
		return true;
	}

	return false;
}
Exemplo n.º 6
0
void
TBarView::DragStop(bool full)
{
	if (!Dragging())
		return;

	if (fExpando) {
		if (fLastDragItem) {
			init_tracking_hook(fLastDragItem, NULL, NULL);
			fLastDragItem = NULL;
		}
	}

	if (full) {
		delete fDragMessage;
		fDragMessage = NULL;

		delete fCachedTypesList;
		fCachedTypesList = NULL;
	}
}
Exemplo n.º 7
0
void
TBarView::HandleDeskbarMenu(BMessage* messagewithdestination)
{
	if (!Dragging())
		return;

	// in mini-mode
	if (fVertical && fState != kExpandoState) {
		// if drop is in the team menu, bail
		if (fBarMenuBar->CountItems() >= 2) {
			uint32 buttons;
			BPoint location;
			GetMouse(&location, &buttons);
			if (fBarMenuBar->ItemAt(1)->Frame().Contains(location))
				return;
		}
	}

	if (messagewithdestination) {
		entry_ref ref;
		if (messagewithdestination->FindRef("refs", &ref) == B_OK) {
			BEntry entry(&ref, true);
			if (entry.IsDirectory()) {
				// if the ref received (should only be 1) is a directory
				// then add the drag refs to the directory
				AddRefsToDeskbarMenu(DragMessage(), &ref);
			} else
				SendDragMessage(NULL, &ref);
		}
	} else {
		// adds drag refs to top level in deskbar menu
		AddRefsToDeskbarMenu(DragMessage(), NULL);
	}

	// clean up drag message and types list
	DragStop(true);
}
Exemplo n.º 8
0
status_t
TBarView::DragStart()
{	
	//	always set the click to open state
	//	to false during a drag
	//	so that a release on a menu/menubar will not
	//	leave the menu open (ExpandoMenuBar, BarMenuBar)
	//	will get reset to actual initial system
	//	state on DragStop
	_menu_info_ptr_->click_to_open = false;

	if (!Dragging())
		return B_OK;
			
	BPoint loc;
	uint32 buttons;
	GetMouse(&loc, &buttons);

	if (fExpando && fExpando->Frame().Contains(loc)) {
		ConvertToScreen(&loc);
		BPoint expandoloc = fExpando->ConvertFromScreen(loc);		
		TTeamMenuItem *item = fExpando->ItemAtPoint(expandoloc);

		if (fLastDragItem)
			init_tracking_hook(fLastDragItem, NULL, NULL);

		if (item) {
			if (item == fLastDragItem)
				return B_OK;

			fLastDragItem = item;		
		}					
	}
	
	return B_OK;
}