Esempio n. 1
0
void
RosterView::RemoveSelected()
{
	if (CurrentItemSelection())
	{
		int32       selected = CurrentSelection();
		RosterItem *item     = CurrentItemSelection();
		if (item == NULL) return;
		RemoveItem(CurrentSelection());
		if (ItemAt(selected)) Select(selected);
		else if (ItemAt(selected - 1)) Select(selected - 1);
	}
}
Esempio n. 2
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();	
}
Esempio n. 3
0
RosterItem*
RosterView::CurrentItemSelection()
{
	int32 index = CurrentSelection();
	if (index >= 0) return dynamic_cast<RosterItem *>(ItemAt(index));
	else return NULL;
}
Esempio n. 4
0
void
FavView::_ShowPopUpMenu(BPoint screen)
{
	if (fShowingPopUpMenu)
		return;

	ContextPopUp* menu = new ContextPopUp("PopUpMenu", this);
	FavItem *currentFav = dynamic_cast<FavItem *>(ItemAt(CurrentSelection()));
	BMessage* msg = NULL;

	msg = new BMessage(FAV_EDIT);
	msg->AddPointer("fav", currentFav);
	BMenuItem* item = new BMenuItem(B_TRANSLATE("Edit title"), msg);
	menu->AddItem(item);

	msg = new BMessage(FAV_DELETE);
	msg->AddPointer("fav", currentFav);
	item = new BMenuItem(B_TRANSLATE("Remove favorite"),msg);
	menu->AddItem(item);

	msg = new BMessage(PASTE_SPRUNGE);
	msg->AddPointer("fav", currentFav);
	item = new BMenuItem(B_TRANSLATE("Paste to Sprunge.us"), msg);
	menu->AddItem(item);

	menu->SetTargetForItems(Looper());
	menu->Go(screen, true, true, true);
	fShowingPopUpMenu = true;
}
void
HEventList::SelectionChanged()
{
	BColumnListView::SelectionChanged();

	HEventRow* row = (HEventRow*)CurrentSelection();
	if (row != NULL) {
		entry_ref ref;
		BMediaFiles().GetRefFor(fType, row->Name(), &ref);

		BPath path(&ref);
		if (path.InitCheck() == B_OK || ref.name == NULL
			|| strcmp(ref.name, "") == 0) {
			row->SetPath(path.Path());
			UpdateRow(row);
		} else {
			printf("name %s\n", ref.name);
			BMediaFiles().RemoveRefFor(fType, row->Name(), ref);
			BAlert* alert = new BAlert("alert",
				B_TRANSLATE("No such file or directory"), B_TRANSLATE("OK"));
			alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
			alert->Go();
			return;
		}
		BMessage msg(M_EVENT_CHANGED);
		msg.AddString("name", row->Name());
		msg.AddString("path", row->Path());
		Window()->PostMessage(&msg);
	}
}
Esempio n. 6
0
void
ClipView::_ShowPopUpMenu(BPoint screen)
{
	if (fShowingPopUpMenu)
		return;

	ContextPopUp* menu = new ContextPopUp("PopUpMenu", this);
	ClipItem* currentClip = dynamic_cast<ClipItem *>(ItemAt(CurrentSelection()));
	BMessage* msg = NULL;

	msg = new BMessage(PASTE_SPRUNGE);
	msg->AddPointer("clip", currentClip);
	BMenuItem* item = new BMenuItem(B_TRANSLATE("Paste to Sprunge.us"), msg, 'P');
	menu->AddItem(item);

	msg = new BMessage(FAV_ADD);
	msg->AddPointer("clip", currentClip);
	item = new BMenuItem(B_TRANSLATE("Add to favorites"), msg, 'A');
	menu->AddItem(item);

	msg = new BMessage(DELETE);
	msg->AddPointer("clip", currentClip);
	item = new BMenuItem(B_TRANSLATE("Remove"), msg);
	menu->AddItem(item);

	menu->SetTargetForItems(Looper());
	menu->Go(screen, true, true, true);
	fShowingPopUpMenu = true;
}
Esempio n. 7
0
// SelectionChanged
void
DragSortableListView::SelectionChanged()
{
//printf("%s::SelectionChanged()", typeid(*this).name());
	// modify global Selection
	if (!fSelection || fSyncingToSelection)
		return;

	fModifyingSelection = true;

	BList selectables;
	for (int32 i = 0; BListItem* item = ItemAt(CurrentSelection(i)); i++) {
		Selectable* selectable = SelectableFor(item);
		if (selectable)
			selectables.AddItem((void*)selectable);
	}

	AutoNotificationSuspender _(fSelection);

	int32 count = selectables.CountItems();
	if (count == 0) {
//printf("  deselecting all\n");
		if (!fSyncingToSelection)
			fSelection->DeselectAll();
	} else {
//printf("  selecting %ld items\n", count);
		for (int32 i = 0; i < count; i++) {
			Selectable* selectable = (Selectable*)selectables.ItemAtFast(i);
			fSelection->Select(selectable, i > 0);
		}
	}

	fModifyingSelection = false;
}
Esempio n. 8
0
void _ArpControllerRangeList::SelectionChanged()
{
	inherited::SelectionChanged();
	int32	selection = CurrentSelection();
	BMessage	update('iupd');
	if (selection >= 0) {
		BListItem*	item;
		for (int32 k = 0; (item = ItemAt(k)); k++) {
			_ArpControllerRangeItem*	ccItem = dynamic_cast<_ArpControllerRangeItem*>(item);
			if (ccItem) {
				if ( IsItemSelected(k) ) {
					update.AddInt32(mSettingsKey.String(), k);
					if ( !ccItem->IsActive() ) {
						ccItem->SetActive(true);
						InvalidateItem(k);
					}
				} else {
					if ( ccItem->IsActive() ) {
						ccItem->SetActive(false);
						InvalidateItem(k);
					}
				}
			}
		}
	}

	if (mTarget) {
		mTarget->Implementation().SendConfiguration(&update);
		mTarget->Settings().Update(update);
	}
}
Esempio n. 9
0
void
ClipView::KeyDown(const char* bytes, int32 numBytes)
{
	switch (bytes[0]) {
		case B_DELETE:
		{
			ClipItem* currentClip
				= dynamic_cast<ClipItem *>(ItemAt(CurrentSelection()));
			BMessage message(DELETE);
			message.AddPointer("clip", currentClip);
			Looper()->PostMessage(&message);
			break;
		}
		case B_LEFT_ARROW:
		case B_RIGHT_ARROW:
		{
			BMessage message(SWITCHLIST);
			message.AddInt32("listview", (int32)0);
			Looper()->PostMessage(&message);
			break;
		}
		default:
		{
			BListView::KeyDown(bytes, numBytes);
			break;
		}
	}
}
Esempio n. 10
0
void _OwqList::MessageReceived(BMessage* msg)
{
	switch( msg->what ) {
		case OWQ_INVOKE_ADD:
			OpenAddWindow();
			break;
		case OWQ_ADD:
			Add( msg );
			break;
		case OWQ_CHANGE:
			Change();
			break;
		case OWQ_REMOVE:
			{
				BRow*	selection = CurrentSelection();
				if( selection ) {
					RemoveRow( selection );
					delete selection;
				}
			}
			break;
		default:
			inherited::MessageReceived(msg);
			break;
	}
}
Esempio n. 11
0
void LinkList::SelectionChanged()
{
	LinkItem *item = (LinkItem*)ItemAt(CurrentSelection());
	
	if ((item != NULL) && !(browseView->m_DontUpdateURL))
		((MainWindow*)Window())->GoTo(item->link);
}
Esempio n. 12
0
void
ListView1::SelectionChanged(void) {

			Window1 *window1=(Window1 *)Window();
			
			((BButton *)window1->view1->iconBAR->ChildViewAt("bar_deleteitem"))->SetEnabled(CurrentSelection()!=NULL);
	//be_app->PostMessage('mm05');
}
Esempio n. 13
0
void ConfigurationDialog::OnDoubleClick( wxMouseEvent& event )
{
    if(CurrentSelection() < 0)
        return;

    wxCommandEvent e;
    OnEditAlarm(e);
}
Esempio n. 14
0
void _OwqList::Change()
{
	_OwqRow*	selection = dynamic_cast<_OwqRow*>( CurrentSelection() );
	if( !selection ) return;
	BMessage	row( SET_PREFS_MSG );
	if( selection->GetPreferences( &row ) == B_OK )
		OpenAddWindow( &row );
}
Esempio n. 15
0
/*****************************************************************************
 * DragSortableListView::RemoveSelected
 *****************************************************************************/
void
DragSortableListView::RemoveSelected()
{
    BList items;
    for ( int32 i = 0; BListItem* item = ItemAt( CurrentSelection( i ) ); i++ )
        items.AddItem( (void*)item );
    RemoveItemList( items );
}
Esempio n. 16
0
// CountSelectedItems
int32
DragSortableListView::CountSelectedItems() const
{
	int32 count = 0;
	while (CurrentSelection(count) >= 0)
		count++;
	return count;
}
bool DraggableListView::InitiateDrag(BPoint point, int32 index, bool wasSelected) {
	uint32 buttons = Looper()->CurrentMessage()->FindInt32("buttons");
	if (buttons & B_PRIMARY_MOUSE_BUTTON) {
		snooze(200000);
		BPoint new_point;
		uint32 buttons;
		GetMouse(&new_point, &buttons);
		bool drag = ((new_point != point) && (buttons & B_PRIMARY_MOUSE_BUTTON));
		if (drag && list_type == addon) {
			if (!wasSelected)
				Select(index);
			BRect drag_rect;
			int32 current_item = CurrentSelection(0);
			int32 item_count = CountItems();
			drag_rect = ItemFrame(index);
			BMessage msg(SM_DRAG_FILTER);
			while (current_item < item_count) {
				if (ItemAt(current_item)->IsSelected()) {
					drag_rect = drag_rect | ItemFrame(current_item);
					if (list_type == filter) {
						msg.AddString("filter_name", ((FilterItem*)ItemAt(current_item))->Text());
						msg.AddInt32("filter_id", ((FilterItem*)ItemAt(current_item))->FilterID());
					} else {
						msg.AddString("filter_name", ((BStringItem*)ItemAt(current_item))->Text());
					}
				}
				current_item++;
			}
			DragMessage(&msg, drag_rect);
			current_item = CurrentSelection(0);
			return true;
		} else
				if (list_type == filter) {
					BMessage app_msg(SM_PREFS_VIEW);
					app_msg.AddInt32("filter_id", ((FilterItem*)ItemAt(index))->FilterID());
					be_app_messenger.SendMessage(&app_msg, Window());
				} else {
					BMessage app_msg(SM_ABOUT_VIEW);
					app_msg.AddString("addon_name", ((BStringItem*)ItemAt(index))->Text());
					be_app_messenger.SendMessage(&app_msg, Window());
				}
			return false;
	} else
		return false;
}
Esempio n. 18
0
void
BListView::SetListType(list_view_type type)
{
	if (fListType == B_MULTIPLE_SELECTION_LIST &&
		type == B_SINGLE_SELECTION_LIST)
		Select(CurrentSelection(0));

	fListType = type;
}
Esempio n. 19
0
void
AddPrinterView::Save()
{
	ProtocolClassItem* item = CurrentSelection();
	if (item != NULL) {
		fPrinterData->SetProtocolClass(item->GetProtocolClass());
		fPrinterData->Save();
	}
}
Esempio n. 20
0
void ColumnListView :: Pulse()
{
   int32 curSel = CurrentSelection();
   if (curSel >= 0) 
   {
      CLVListItem * item = (CLVListItem *) ItemAt(curSel);
      item->Pulse(this);
   } 
}
Esempio n. 21
0
void LinkList2::SelectionChanged()
{
	LinkItem2 *item = (LinkItem2*)ItemAt(CurrentSelection());
	
	if (item != NULL)
		if ((!browse->NewLinksList(item->link)) && !(browse->m_DontUpdateURL))
			// si la liste de liens est vide, on ouvre le lien du père
			((MainWindow*)Window())->GoTo(item->link->link);
}
Esempio n. 22
0
void ConfigurationDialog::OnEditAlarm( wxCommandEvent& event )
{
    EditAlarmDialog dlg(this, CurrentAlarm());
    if(dlg.ShowModal() == wxID_OK) {
        dlg.Save();
        UpdateItem(CurrentSelection());
        m_bOnEditAlarmOK = true;
    } else
        m_bOnEditAlarmOK = false;
}
void DraggableListView::KeyDown(const char* bytes, int32 numBytes) {
	if (numBytes == 1) {
		switch (bytes[0]) {
			case B_BACKSPACE: {
				if (list_type == filter) {
					BMessage msg(SM_REMOVE_FILTER);
					msg.AddInt32("filter_id", ((FilterItem*)ItemAt(CurrentSelection()))->FilterID());
					be_app_messenger.SendMessage(&msg);
					delete RemoveItem(CurrentSelection());
				}
				break;
			}
			default: {
				BListView::KeyDown(bytes, numBytes);
				break;
			}
		}
	}
}
Esempio n. 24
0
// RemoveSelected
void
DragSortableListView::RemoveSelected()
{
//	if (fFocusedIndex >= 0)
//		return;

	BList items;
	for (int32 i = 0; BListItem* item = ItemAt(CurrentSelection(i)); i++)
		items.AddItem((void*)item);
	RemoveItemList(items);
}
Esempio n. 25
0
// MakeDragMessage
void
SimpleListView::MakeDragMessage(BMessage* message) const
{
	if (message) {
		message->AddPointer("list",
			(void*)dynamic_cast<const DragSortableListView*>(this));
		int32 index;
		for (int32 i = 0; (index = CurrentSelection(i)) >= 0; i++)
			message->AddInt32("index", index);
	}
}
Esempio n. 26
0
status_t _ArpControllerRangeList::GetCurrentRange(int32* cc, int32* low, int32* high) const
{
	int32							selection = CurrentSelection();
	if (selection < 0) return B_ERROR;
	_ArpControllerRangeItem*		item = dynamic_cast<_ArpControllerRangeItem*>(ItemAt(selection));
	if (!item) return  B_ERROR;
	if (cc) *cc = selection;
	if (low) *low = item->low;
	if (high) *high = item->high;
	return B_OK;
}
Esempio n. 27
0
void
AudioListView::GetSelectedItems(BList& indices)
{
	for (int32 i = 0; true; i++) {
		int32 index = CurrentSelection(i);
		if (index < 0)
			break;
		if (!indices.AddItem((void*)(addr_t)index))
			break;
	}
}
Esempio n. 28
0
void SmartTreeListView::MouseUp(BPoint point)
{
    int curSelection = CurrentSelection();
    ColumnListView::MouseUp(point);
    if (curSelection >= 0 && curSelection != lastSelection)
    {
        TreeItem *item = (TreeItem *) ItemAt(curSelection);
        item->ItemSelected();
        lastSelection = curSelection;
    }
}
Esempio n. 29
0
void
MimeTypeListView::UpdateItem(MimeTypeItem* item)
{
	int32 selected = -1;
	if (IndexOf(item) == CurrentSelection())
		selected = CurrentSelection();

	item->UpdateText();
	_MakeTypesUnique(dynamic_cast<MimeTypeItem*>(Superitem(item)));

	if (selected != -1) {
		int32 index = IndexOf(item);
		if (index != selected) {
			Select(index);
			ScrollToSelection();
		}
	}
	if (Window())
		InvalidateItem(IndexOf(item));
}
Esempio n. 30
0
void SmartColumnListView::KeyUp(const char *bytes, int32 numBytes)
{
	if (*bytes == B_DELETE)
	{
		int index = CurrentSelection();
		if (index >= 0)
		{
			ListItem *item = (ListItem *) ItemAt(index);
			DeleteItem(index, item);
		}
	}
}