void
EditListView::MouseDown(BPoint where)
{
	BListView::MouseDown(where);

	int32 index = IndexOf(where);
	EditableListItem* handler = dynamic_cast<EditableListItem*>(ItemAt(index));
	if (handler == NULL)
		return;

	fLastMouseDown = handler;
	handler->MouseDown(where);
	SetMouseEventMask(B_POINTER_EVENTS);
}
예제 #2
0
int32
BListView::IndexOf(BListItem* item) const
{
	if (Window()) {
		if (item != NULL) {
			int32 index = IndexOf(BPoint(0.0, item->Top()));
			if (index >= 0 && fList.ItemAt(index) == item)
				return index;

			return -1;
		}
	}
	return fList.IndexOf(item);
}
예제 #3
0
/**
 @return 	0 or a positive integer if a plugin was released and deleted, otherwise KErrNotFound
 @internalComponent
 @released
 */
TInt CSusUtilServer::UnLoadUtilityPluginL(TSsmSupInfo& aSupInfo)
	{
	RLibrary lib;
	SusPluginLoader::LoadDllFileLC(lib, aSupInfo); // open handle on CleanupStack
	const TInt index = IndexOf(lib, aSupInfo.NewLOrdinal());
	if( index > KErrNotFound )
		{
		CSusPluginFrame* frame = iLoadedPlugins[index];
		iLoadedPlugins.Remove(index);
		delete frame;
		}
	CleanupStack::PopAndDestroy(&lib);
	return index;
	}
예제 #4
0
파일: manager.cpp 프로젝트: CyberShadow/FAR
void Manager::ExecuteNonModal()
{
	_MANAGER(CleverSysLog clv(L"Manager::ExecuteNonModal ()"));
	_MANAGER(SysLog(L"ExecutedFrame=%p, InsertedFrame=%p, DeletedFrame=%p",ExecutedFrame, InsertedFrame, DeletedFrame));
	Frame *NonModal=InsertedFrame?InsertedFrame:(ExecutedFrame?ExecutedFrame:ActivatedFrame);

	if (!NonModal)
	{
		return;
	}

	/* $ 14.05.2002 SKV
	  Положим текущий фрэйм в список "родителей" полумодальных фрэймов
	*/
	//Frame *SaveFrame=CurrentFrame;
	//AddSemiModalBackFrame(SaveFrame);
	int NonModalIndex=IndexOf(NonModal);

	if (-1==NonModalIndex)
	{
		InsertedFrame=NonModal;
		ExecutedFrame=nullptr;
		InsertCommit();
		InsertedFrame=nullptr;
	}
	else
	{
		ActivateFrame(NonModalIndex);
	}

	//Frame* ModalStartLevel=NonModal;
	for (;;)
	{
		Commit();

		if (CurrentFrame!=NonModal || EndLoop)
		{
			break;
		}

		ProcessMainLoop();
	}

	//ExecuteModal(NonModal);
	/* $ 14.05.2002 SKV
	  ... и уберём его же.
	*/
	//RemoveSemiModalBackFrame(SaveFrame);
}
예제 #5
0
/*****************************************************************************
 * DragSortableListView::MouseMoved
 *****************************************************************************/
void
DragSortableListView::MouseMoved(BPoint where, uint32 transit, const BMessage *msg)
{
    if ( msg && ( msg->what == B_SIMPLE_DATA || msg->what == MSG_SOUNDPLAY ) )
    {
        bool replaceAll = !msg->HasPointer("list") && !(modifiers() & B_SHIFT_KEY);
        switch ( transit )
        {
            case B_ENTERED_VIEW:
                // remember drag message
                // this is needed to react on modifier changes
                fDragMessageCopy = *msg;
            case B_INSIDE_VIEW:
            {
                if ( replaceAll )
                {
                    BRect r( Bounds() );
                    r.bottom--;    // compensate for scrollbar offset
                    _SetDropAnticipationRect( r );
                    fDropIndex = -1;
                }
                else
                {
                    // offset where by half of item height
                    BRect r( ItemFrame( 0 ) );
                    where.y += r.Height() / 2.0;
    
                    int32 index = IndexOf( where );
                    if ( index < 0 )
                        index = CountItems();
                    _SetDropIndex( index );
                }
                break;
            }
            case B_EXITED_VIEW:
                // forget drag message
                fDragMessageCopy.what = 0;
            case B_OUTSIDE_VIEW:
                _RemoveDropAnticipationRect();
                break;
        }
    }
    else
    {
        _RemoveDropAnticipationRect();
        BListView::MouseMoved(where, transit, msg);
        fDragMessageCopy.what = 0;
    }
}
예제 #6
0
/*
 * Finds the following sibling of aNode and returns it. If a sibling
 * is found, mCurrentNode is set to that node.
 * @param aNode     Node to start search at.
 * @param aReversed Reverses search to find the previous sibling
 *                  instead of next.
 * @param aIndexPos Position of aNode in mPossibleIndexes.
 * @param _retval   Returned node. Null if no sibling is found
 * @returns         Errorcode
 */
nsresult
nsTreeWalker::NextSiblingOf(nsINode* aNode,
                            PRBool aReversed,
                            PRInt32 aIndexPos,
                            nsINode** _retval)
{
    nsresult rv;
    nsCOMPtr<nsINode> node = aNode;
    PRInt16 filtered;
    PRInt32 childNum;

    if (node == mRoot) {
        *_retval = nsnull;
        return NS_OK;
    }

    while (1) {
        nsCOMPtr<nsINode> parent = node->GetNodeParent();

        if (!parent)
            break;

        childNum = IndexOf(parent, node, aIndexPos);
        NS_ENSURE_TRUE(childNum >= 0, NS_ERROR_UNEXPECTED);

        // Search siblings
        rv = ChildOf(parent, childNum, aReversed, aIndexPos, _retval);
        NS_ENSURE_SUCCESS(rv, rv);

        if (*_retval)
            return NS_OK;

        // Is parent the root?
        if (parent == mRoot)
            break;

        // Is parent transparent in filtered view?
        rv = TestNode(parent, &filtered);
        NS_ENSURE_SUCCESS(rv, rv);
        if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT)
            break;

        node = parent;
        aIndexPos = aIndexPos < 0 ? -1 : aIndexPos-1;
    }

    *_retval = nsnull;
    return NS_OK;
}
예제 #7
0
void
SearchListView::ItemInvoked(void)
{
	BIntegerField* pageField = (BIntegerField*)CurrentSelection()->GetField(0);

    if (pageField == nullptr)
        return;
	
	BMessage msg(MSG_HIGHLIGHT_RECT);
	msg.AddInt32("page", pageField->Value() - 1);
	msg.AddRect("rect", fRectVec[IndexOf(CurrentSelection())]);
    Window()->PostMessage(&msg);
    
    BColumnListView::ItemInvoked();	
}
예제 #8
0
void
PrefListView::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case 'ITEM':
		{
			puts("We have a winner, supposably ;-)");
			BPoint dropzone;
			msg->FindPoint("_drop_point_", &dropzone);
			dropzone = ConvertFromScreen(dropzone);

			int32 i, nr;
			msg->FindInt32("Item", &i);
			msg->FindInt32("Item_nr", &nr);

			XmlNode* Item = (XmlNode*)i;
			XmlNode* toItem = dynamic_cast<XmlNode*>(ItemAt(IndexOf(dropzone)));

			// Only proceed if valid
			if (toItem && Item && toItem!=Item) {
				XmlNode* parent = Item->Parent();

				uint32 index = parent->IndexOf(Item);
				uint32 toIndex = toItem->Parent()->IndexOf(toItem);
				if (index<toIndex)
					toIndex++;

				parent->DetachChild(index);

				if (toItem->Attribute(OPML_URL)!=NULL) {
					toItem->Parent()->AddChild(Item, toIndex);
				}
				else {
					toItem->AddChild(Item,0);
				}

				MakeEmpty();
				BuildView(root);

				Invalidate();
			}
		}
		break;

		default:
			BOutlineListView::MessageReceived(msg);
	}
}
예제 #9
0
//! Returns false, if item is NULL or memory is insufficient, true otherwise.
bool
ResourcesContainer::AddResource(ResourceItem *item, int32 index, bool replace)
{
	bool result = false;
	if (item) {
		// replace an item with the same type and id
		if (replace)
			delete RemoveResource(IndexOf(item->Type(), item->ID()));
		int32 count = CountResources();
		if (index < 0 || index > count)
			index = count;
		result = fResources.AddItem(item, count);
		SetModified(true);
	}
	return result;
}
bool
OverscrollHandoffChain::CanBePanned(const AsyncPanZoomController* aApzc) const
{
  // Find |aApzc| in the handoff chain.
  uint32_t i = IndexOf(aApzc);

  // See whether any APZC in the handoff chain starting from |aApzc|
  // has room to be panned.
  for (uint32_t j = i; j < Length(); ++j) {
    if (mChain[j]->IsPannable()) {
      return true;
    }
  }

  return false;
}
void
EditListView::MouseUp(BPoint where)
{
	BListView::MouseUp(where);
	if (fLastMouseDown) {
		fLastMouseDown->MouseUp(where);
		fLastMouseDown = NULL;
	}

	int32 index = IndexOf(where);
	EditableListItem* handler = dynamic_cast<EditableListItem*>(ItemAt(index));
	if (handler == NULL)
		return;

	handler->MouseUp(where);
}
bool
OverscrollHandoffChain::CanScrollInDirection(const AsyncPanZoomController* aApzc,
                                             Layer::ScrollDirection aDirection) const
{
  // Find |aApzc| in the handoff chain.
  uint32_t i = IndexOf(aApzc);

  // See whether any APZC in the handoff chain starting from |aApzc|
  // has room to scroll in the given direction.
  for (uint32_t j = i; j < Length(); ++j) {
    if (mChain[j]->CanScroll(aDirection)) {
      return true;
    }
  }

  return false;
}
예제 #13
0
void ff::SmallDict::Set(ff::StringRef key, Value *value)
{
	if (value == nullptr)
	{
		Remove(key);
		return;
	}

	size_t index = IndexOf(key);
	if (index != INVALID_SIZE)
	{
		SetAt(index, value);
		return;
	}

	Add(key, value);
}
예제 #14
0
void
MimeTypeListView::_AddNewType(const char* type)
{
	MimeTypeItem* item = FindItem(type);

	BMimeType mimeType(type);
	bool isApp = mimetype_is_application_signature(mimeType);
	if (fApplicationMode ^ isApp || !mimeType.IsInstalled()) {
		if (item != NULL) {
			// type doesn't belong here
			RemoveItem(item);
			delete item;
		}
		return;
	}

	if (item != NULL) {
		// for some reason, the type already exists
		return;
	}

	BMimeType superType;
	MimeTypeItem* superItem = NULL;
	if (mimeType.GetSupertype(&superType) == B_OK)
		superItem = FindItem(superType.Type());

	item = new MimeTypeItem(mimeType, fShowIcons, fSupertype.Type() != NULL);

	if (item->IsSupertypeOnly())
		item->ShowIcon(false);
	item->SetApplicationMode(isApp);

	if (superItem != NULL) {
		AddUnder(item, superItem);
		InvalidateItem(IndexOf(superItem));
			// the super item is not picked up from the class (ie. bug)
	} else
		AddItem(item);

	UpdateItem(item);

	if (!fSelectNewType.ICompare(mimeType.Type())) {
		SelectItem(item);
		fSelectNewType = "";
	}
}
void DraggableListView::MouseDown(BPoint point) {
	uint32 buttons = Looper()->CurrentMessage()->FindInt32("buttons");
	int32 index = IndexOf(point);
	if (buttons & B_SECONDARY_MOUSE_BUTTON && index >= 0) {
		Select(index);
		if (list_type == filter) {
			BPopUpMenu popup_menu("popup_menu", false, false);
			popup_menu.SetFont(be_plain_font);
			BMessage* del_msg = new BMessage(SM_REMOVE_FILTER);
			del_msg->AddInt32("filter_id", ((FilterItem*)ItemAt(index))->FilterID());
			BMessage* help_msg = new BMessage(SM_HELP_REQUESTED);
			help_msg->AddString("addon_name", ((FilterItem*)ItemAt(index))->Text());
			popup_menu.AddItem(new BMenuItem("Delete", del_msg));
			popup_menu.AddItem(new BMenuItem("Add-on Help"B_UTF8_ELLIPSIS, help_msg));
			BMenuItem* item = popup_menu.Go(ConvertToScreen(point));
			if (item != NULL) {
				if (strcmp(item->Label(),"Delete") == 0) {
					be_app_messenger.SendMessage(item->Message());
					delete RemoveItem(index);
				if (strcmp(item->Label(),"Add-on Help"B_UTF8_ELLIPSIS) == 0)
					Window()->PostMessage(item->Message());
				}
			}
		} else {
			BView* active_list = Window()->FindView("active_list");
			if (active_list != NULL) {
				BPopUpMenu popup_menu("popup_menu", false, false);
				popup_menu.SetFont(be_plain_font);
				BMessage* add_msg = new BMessage(SM_DRAG_FILTER);
				add_msg->AddString("filter_name", ((BStringItem*)ItemAt(index))->Text());
				BMessage* help_msg = new BMessage(SM_HELP_REQUESTED);
				help_msg->AddString("addon_name", ((BStringItem*)ItemAt(index))->Text());
				popup_menu.AddItem(new BMenuItem("Add", add_msg));
				popup_menu.AddItem(new BMenuItem("Add-on Help"B_UTF8_ELLIPSIS, help_msg));
				BMenuItem* item = popup_menu.Go(ConvertToScreen(point));
				if (item != NULL) {
					if (strcmp(item->Label(),"Add") == 0)
						active_list->MessageReceived(item->Message());
					if (strcmp(item->Label(),"Add-on Help"B_UTF8_ELLIPSIS) == 0)
						Window()->PostMessage(item->Message());
				}
			}
		}
	}
	BListView::MouseDown(point);
}
예제 #16
0
/*****************************************************************************
 * PlaylistView::CopyItems
 *****************************************************************************/
void
PlaylistView::CopyItems( BList& items, int32 toIndex )
{
#if 0
    DeselectAll();
    // we remove the items while we look at them, the insertion index is decreased
    // when the items index is lower, so that we insert at the right spot after
    // removal
    if ( fVlcWrapper->PlaylistLock() )
    {
        BList clonedItems;
        int32 count = items.CountItems();
        // remember currently playing item
        BListItem* playingItem = _PlayingItem();
        // collect cloned item pointers
        for ( int32 i = 0; i < count; i++ )
        {
            int32 index = IndexOf( (BListItem*)items.ItemAt( i ) );
            void* item = fVlcWrapper->PlaylistItemAt( index );
            void* cloned = fVlcWrapper->PlaylistCloneItem( item );
            if ( cloned && !clonedItems.AddItem( cloned ) )
                free( cloned );
            
        }
        // add cloned items at index
        int32 index = toIndex;
        for ( int32 i = 0; void* item = clonedItems.ItemAt( i ); i++ )
        {
            if ( fVlcWrapper->PlaylistAddItem( item, index ) )
                // next items will be inserted after this one
                index++;
            else
                free( item );
        }
        // update GUI
        DragSortableListView::CopyItems( items, toIndex );
        // restore currently playing item
        _SetPlayingIndex( playingItem );
        // update interface (in case it isn't playing,
        // there is a chance that it needs to update)
        fMainWindow->PostMessage( MSG_UPDATE );
        fVlcWrapper->PlaylistUnlock();
    }
#endif
}
예제 #17
0
int SudokuGrid::Value(int row, int column) const noexcept
{
    int index = IndexOf(row, column);
    int result = NoValues;

    for (int i = 0; i < 9; ++i)
    {
        if (!_banned.test(index + i))
        {
            if (result == NoValues)
                result = i;
            else
                return MultipleValues;
        }
    }

    return result;
}
예제 #18
0
void CMessageBox::AddButton(const CString & strCaption, UINT id, bool bEnabled/*=true*/)
{
#ifdef _DEBUG
	ASSERT(-1==IndexOf(id));
	for(unsigned int i=0;i<ButtonCount();i++){
		if(0==m_arBInfo[i].m_strCaption.Compare(strCaption)){
			ASSERT(FALSE);
		}
	}
#endif
	if(bEnabled){
		if(IDCANCEL==id || (IDOK==id && -1==m_nEscapeButton)){
			m_nEscapeButton=ButtonCount();
		} 
	}
	CButtonInfo info(id,bEnabled,strCaption);
	m_arBInfo.Add(info);
}
예제 #19
0
void
AudioListView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kDraggedItem:
		{
			BPoint dropPoint = message->DropPoint();
			int32 dropIndex = IndexOf(ConvertFromScreen(dropPoint));
			int32 count = CountItems();
			if (dropIndex < 0 || dropIndex > count)
				dropIndex = count;

			BList indices;
			GetSelectedItems(indices);
			MoveItems(indices, dropIndex);

			RenumberTracks();
			break;
		}
		case kDeleteItem:
		{
			if (!IsEmpty()) {
				RemoveSelected();

				if (!IsEmpty())
					RenumberTracks();
			}
			// fake to update button state and calculate SizeBar
			Looper()->PostMessage(B_REFS_RECEIVED);
			break;
		}
		case kPopupClosed:
		{
			fShowingPopUpMenu = false;
			break;
		}
		default:
		{
			BListView::MessageReceived(message);
			break;
		}
	}
}
예제 #20
0
/**
 Attempt to load the DLL file named in aSupInfo. If successful, instantiate, initialize and start
 the contained uitility plugin using the ordinal function specified in aSupInfo and the MSsmUtility
 interface.
 @internalComponent
 @released
 */
void CSusUtilServer::LoadUtilityPluginL(TSsmSupInfo& aSupInfo)
	{
	RLibrary lib;
	SusPluginLoader::LoadDllFileLC(lib, aSupInfo); // open handle on CleanupStack

	if (KErrNotFound != IndexOf(lib, aSupInfo.NewLOrdinal()))
		{
		//will leave in release builds as well
		SSMLOGLEAVE(KErrAlreadyExists); //lint !e527 Unreachable
		}

	const TInt newL = aSupInfo.NewLOrdinal();
	CSusPluginFrame* plugin = SusPluginLoader::CreatePluginLC(lib, newL);
	iLoadedPlugins.AppendL(plugin);
	CleanupStack::Pop(plugin);
	plugin->SetLibrary(lib); // takes ownership of open library handle

	CleanupStack::Pop(&lib);
	}
eDynamicDeviceReturnCode cDynamicDevice::SetGetTSTimeoutHandlerArg(const char *DevPath, const char *Arg)
{
  if (!DevPath || !Arg)
     return ddrcNotSupported;

  cMutexLock lock(&arrayMutex);
  int freeIndex = -1;
  int index = -1;
  if (isnumber(DevPath))
     index = strtol(DevPath, NULL, 10) - 1;
  else
     index = IndexOf(DevPath, freeIndex, -1);

  if ((index < 0) || (index >= numDynamicDevices))
     return ddrcNotFound;

  dynamicdevice[index]->InternSetGetTSTimeoutHandlerArg(Arg);
  return ddrcSuccess;
}
eDynamicDeviceReturnCode cDynamicDevice::SetLockDevice(const char *DevPath, bool Lock)
{
  if (!DevPath)
     return ddrcNotSupported;

  cMutexLock lock(&arrayMutex);
  int freeIndex = -1;
  int index = -1;
  if (isnumber(DevPath))
     index = strtol(DevPath, NULL, 10) - 1;
  else
     index = IndexOf(DevPath, freeIndex, -1);

  if ((index < 0) || (index >= numDynamicDevices))
     return ddrcNotFound;

  dynamicdevice[index]->InternSetLock(Lock);
  return ddrcSuccess;
}
eDynamicDeviceReturnCode cDynamicDevice::SetAutoIdle(const char *DevPath, bool Disable)
{
  if (!DevPath)
     return ddrcNotSupported;

  cMutexLock lock(&arrayMutex);
  int freeIndex = -1;
  int index = -1;
  if (isnumber(DevPath))
     index = strtol(DevPath, NULL, 10) - 1;
  else
     index = IndexOf(DevPath, freeIndex, -1);

  if ((index < 0) || (index >= numDynamicDevices))
     return ddrcNotFound;

  isyslog("dynamite: %s auto-idle mode on device %s", (Disable ? "disable" : "enable"), DevPath);
  dynamicdevice[index]->disableAutoIdle = Disable;
  return ddrcSuccess;
}
예제 #24
0
void
BOutlineListView::MouseDown(BPoint point)
{
	MakeFocus();

	int32 index = IndexOf(point);

	if (index != -1) {
		BListItem* item = ItemAt(index);

		if (item->fHasSubitems
			&& LatchRect(ItemFrame(index), item->fLevel).Contains(point)) {
			if (item->IsExpanded())
				Collapse(item);
			else
				Expand(item);
		} else
			BListView::MouseDown(point);
	}
}
예제 #25
0
bool ListView1::InitiateDrag(BPoint point,  bool wasSelected) {
printf("InitiateDrag():");
	
	point.PrintToStream();
	BRow	*row=FocusRow();
	if (row==NULL) return false;
/*	
	if ((CDMode==DATACD_INDEX) || (CDMode==BOOTABLECD_INDEX)) {	// yes? then we are not in audio mode
		folderRow=new FolderRow(((FolderRow *)row)->GetFilename(),
						((FolderRow *)row)->IsFolder(),
						((FolderRow *)row)->GetBitmap());
	} else */
	if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)){
		audioRow=new AudioRow(((AudioRow *)row)->GetTrackNumber(),((AudioRow *)row)->GetFilename(),
						((AudioRow *)row)->GetPregap(),
						((AudioRow *)row)->GetBytes(),
						((AudioRow *)row)->GetLength());
		audioRow->SetCDTitle(((AudioRow *)row)->GetCDTitle());
		audioRow->SetIndexList(((AudioRow *)row)->GetIndexList());
		audioRow->SetPregap(((AudioRow *)row)->GetPregap());
		audioRow->SetStartFrame(((AudioRow *)row)->GetStartFrame());
		audioRow->SetEndFrame(((AudioRow *)row)->GetEndFrame());
//		audioRow->SetStartTime(((AudioRow *)row)->GetStartTime());
//		audioRow->SetEndTime(((AudioRow *)row)->GetEndTime());
		//audioRow=new AudioRow(*((AudioRow *)row));
	}
	
	BMessage	*message=new BMessage(LISTITEM_DROPPED);
	BRect		rect;
	if (GetRowRect(row, &rect)) {
		void *r=(void *)row;
		message->AddPointer("from", r);
		if (!((FolderRow *)row)->IsFolder())
			message->AddInt32("index", (int32)IndexOf(row));
		DragMessage(message, rect);
//		if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX))
//			RemoveRow(IndexOf(row));
		//delete row;
	}
	return true;
}
예제 #26
0
void
MimeTypeListView::SelectItem(MimeTypeItem* item)
{
	if (item == NULL) {
		Select(-1);
		return;
	}

	// Make sure the item is visible

	BListItem* superItem = item;
	while ((superItem = Superitem(superItem)) != NULL) {
		Expand(superItem);
	}

	// Select it, and make it visible

	int32 index = IndexOf(item);
	Select(index);
	ScrollToSelection();
}
예제 #27
0
CXTPControl* CXTPRibbonGroup::SetControlType(CXTPControl* pControl, XTPControlType type)
{
    ASSERT(pControl);
    if (!pControl)
        return NULL;

    if (IsPopupControlType(pControl->GetType()) && IsPopupControlType(type))
    {
        pControl->m_controlType = type;
        return pControl;
    }

    CXTPControl* pNew = Add(type, 0, _T(""), IndexOf(pControl) + 1, FALSE);
    pNew->CXTPControl::Copy(pControl, FALSE);
    pNew->m_controlType = type;

    Remove(pControl);

    return pNew;

}
예제 #28
0
bool
PrefListView::InitiateDrag(BPoint point, int32 index, bool wasSelected)
{
	BOutlineListView::InitiateDrag(point,index,wasSelected);
	if (wasSelected) {
		int idx = IndexOf(point);
		if (idx == B_ERROR)
			return false;
		BStringItem* item = (BStringItem*)ItemAt(idx);
		BRect r = ItemFrame(idx);
		
		BMessage msg('ITEM');
		msg.AddInt32("Item", (int)item);
		msg.AddInt32("Item_nr", (int)index);
		msg.AddPoint("click_location", point);
		
		DragMessage( &msg, r, NULL );
		return true;
	}
	return false;
}
예제 #29
0
void
AudioListView::MouseMoved(BPoint where, uint32 transit,
	const BMessage* dragMessage)
{
	if (dragMessage != NULL) {
		switch (transit) {
			case B_ENTERED_VIEW:
			case B_INSIDE_VIEW:
			{
				int32 index = IndexOf(where);
				if (index < 0)
					index = CountItems();

				fDropRect = ItemFrame(index);
				if (fDropRect.IsValid()) {
					fDropRect.top = fDropRect.top -1;
					fDropRect.bottom = fDropRect.top + 1;
				} else {
					fDropRect = ItemFrame(index - 1);
					if (fDropRect.IsValid())
						fDropRect.top = fDropRect.bottom - 1;
					else {
						// empty view, show indicator at top
						fDropRect = Bounds();
						fDropRect.bottom = fDropRect.top + 1;
					}
				}
				Invalidate();
				break;
			}
			case B_EXITED_VIEW:
			{
				fDropRect = BRect(-1, -1, -1, -1);
				Invalidate();
				break;
			}
		}
	}
	BListView::MouseMoved(where, transit, dragMessage);
}
예제 #30
0
void DormantNodeView::MouseDown(
	BPoint point) {
	D_HOOK(("DormantNodeView::MouseDown()\n"));

	BMessage* message = Window()->CurrentMessage();
	int32 buttons = message->FindInt32("buttons");
	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
		int32 index;
		if ((index = IndexOf(point)) >= 0) {
			DormantNodeListItem *item = dynamic_cast<DormantNodeListItem *>(ItemAt(index));
			if (item) {
				Select(index);
				BRect r = item->getRealFrame(be_plain_font);
				if (r.Contains(point)) {
					item->showContextMenu(point, this);
				}
			}
		}
	}

	_inherited::MouseDown(point);
}