Exemplo n.º 1
0
void
ModulesView::EmptyScreenSaverList()
{
	fScreenSaversListView->DeselectAll();
	while (BListItem* item = fScreenSaversListView->RemoveItem((int32)0))
		delete item;
}
Exemplo n.º 2
0
void GuideWindow::deleteGuide(BMessage *msg)
{
	BStringItem *item = modifyGuide(msg);
	BListView *view = getCurrentListView();
	view->RemoveItem(item);
	view->Select(0);
	view->ScrollToSelection();
}
/**
 *	@brief	Removes one item from the control.
 *	@param[in]	index	item index.
 */
void BeListViewAdapter::RemoveItem(SInt32 index)
{
	BListView* listView = getListView();
	BListItem* listItem = listView->RemoveItem(index);
	if (NULL != listItem)
	{
		delete listItem;
	}
}
Exemplo n.º 4
0
void
ModulesView::PopulateScreenSaverList()
{
 	fScreenSaversListView->DeselectAll();
	while (ScreenSaverItem* item
			= (ScreenSaverItem*)fScreenSaversListView->RemoveItem((int32)0)) {
		delete item;
	}

	// Blackness is a built-in screen saver
	fScreenSaversListView->AddItem(
		new ScreenSaverItem(B_TRANSLATE("Blackness"), ""));

	// Iterate over add-on directories, and add their files to the list view

	directory_which which[] = {
		B_USER_ADDONS_DIRECTORY,
		B_COMMON_ADDONS_DIRECTORY,
		B_SYSTEM_ADDONS_DIRECTORY,
	};
	ScreenSaverItem* selectItem = NULL;

	for (uint32 i = 0; i < sizeof(which) / sizeof(which[0]); i++) {
		BPath basePath;
		find_directory(which[i], &basePath);
		basePath.Append("Screen Savers", true);

		BDirectory dir(basePath.Path());
		BEntry entry;
		while (dir.GetNextEntry(&entry, true) == B_OK) {
			char name[B_FILE_NAME_LENGTH];
			if (entry.GetName(name) != B_OK)
				continue;

			BPath path = basePath;
			path.Append(name);

			ScreenSaverItem* item = new ScreenSaverItem(name, path.Path());
			fScreenSaversListView->AddItem(item);

			if (strcmp(fSettings.ModuleName(), item->Text()) != 0
				|| (strcmp(fSettings.ModuleName(), "") != 0
					&& strcmp(item->Text(), B_TRANSLATE("Blackness")) != 0)) {
				selectItem = item;
			}
		}
	}

	fScreenSaversListView->SortItems(_CompareScreenSaverItems);

	fScreenSaversListView->Select(fScreenSaversListView->IndexOf(selectItem));
	fScreenSaversListView->ScrollToSelection();
}
/**
 *	@brief	Removes all item from the control.
 */
void BeListViewAdapter::RemoveAllItem()
{
	BListView* listView = getListView();
	int32 count = listView->CountItems();
	int32 index;
	for (index = count - 1; index >= 0; index--)
	{
		BListItem* listItem = listView->RemoveItem(index);
		if (NULL != listItem)
		{
			delete listItem;
		}
	}
}
Exemplo n.º 6
0
void iupdrvListRemoveItem(Ihandle* ih, int pos)
{
  BView* view = (BView*)ih->handle;

  BMenuField* menu = dynamic_cast<BMenuField*>(view);
  if(menu)
  {
	UNIMPLEMENTED
	return;
  }
  
  BListView* listview = iuphaikuGetListView(view);
  if(listview) {
	BListItem* item = listview->RemoveItem(pos - 1);
	delete item;
  } else {
    fprintf(stderr, "View hierarchy problem\n");
  }
}