当前位置: 首页>>代码示例>>C++>>正文


C++ BStringItem类代码示例

本文整理汇总了C++中BStringItem的典型用法代码示例。如果您正苦于以下问题:C++ BStringItem类的具体用法?C++ BStringItem怎么用?C++ BStringItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BStringItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: str

void BrowseView::FindInIndex(bool select, const char *s)
{
	if (s==NULL)
		s = searchTextView->Text();
	BString str(s);
	
	if(!containsSearch)
	{
		unsigned int nL = linksList->CountItems();
	
		for (unsigned int i=0; i<nL; i++)
		{
			BStringItem *it = (BStringItem*)linksList->ItemAt(i);
			if (str.ICompare(it->Text()) <= 0)
			{
				BRect r = linksList->ItemFrame(i);
				linksList->ScrollTo(r.LeftTop());
			
				if (select)
					linksList->Select(i);
				break;
			}
		}
	}
	else
	{
		tasks->GiveUp();
		linksList->MakeEmpty();

		if (str == "")
			return;

		tasks->DoFindInIndex(str,this,select);			
	}
}
开发者ID:mmadia,项目名称:behappy-svn_clone,代码行数:35,代码来源:BrowseView.cpp

示例2: file

void
MidiSettingsView::_LoadSettings()
{
	// TODO: Duplicated code between here
	// and BSoftSynth::SetDefaultInstrumentsFile
	char buffer[512];
	BPath path;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
		path.Append(SETTINGS_FILE);
		BFile file(path.Path(), B_READ_ONLY);
		if (file.InitCheck() == B_OK) {
			file.Read(buffer, sizeof(buffer));
			char soundFont[512];
			sscanf(buffer, "# Midi Settings\n soundfont = %s\n",
				soundFont);

			for (int32 i = 0; i < fListView->CountItems(); i++) {
				BStringItem* item = (BStringItem*)fListView->ItemAt(i);
				if (!strcmp(item->Text(), soundFont)) {
					fListView->Select(i);
					break;
				}
			}
		}
	}
}
开发者ID:orangejua,项目名称:haiku,代码行数:26,代码来源:MidiSettingsView.cpp

示例3: parentDomain

BStringItem*
CookieWindow::_AddDomain(BString domain, bool fake)
{
	BStringItem* parent = NULL;
	int firstDot = domain.FindFirst('.');
	if (firstDot >= 0) {
		BString parentDomain(domain);
		parentDomain.Remove(0, firstDot + 1);
		parent = _AddDomain(parentDomain, true);
	} else {
		parent = (BStringItem*)fDomains->FullListItemAt(0);
	}

	BListItem* existing;
	int i = 0;
	// check that we aren't already there
	while ((existing = fDomains->ItemUnderAt(parent, true, i++)) != NULL) {
		DomainItem* stringItem = (DomainItem*)existing;
		if (stringItem->Text() == domain) {
			if (fake == false)
				stringItem->fEmpty = false;
			return stringItem;
		}
	}

#if 0
	puts("==============================");
	for (i = 0; i < fDomains->FullListCountItems(); i++) {
		BStringItem* t = (BStringItem*)fDomains->FullListItemAt(i);
		for (unsigned j = 0; j < t->OutlineLevel(); j++)
			printf("  ");
		printf("%s\n", t->Text());
	}
#endif

	// Insert the new item, keeping the list alphabetically sorted
	BStringItem* domainItem = new DomainItem(domain, fake);
	domainItem->SetOutlineLevel(parent->OutlineLevel() + 1);
	BStringItem* sibling = NULL;
	int siblingCount = fDomains->CountItemsUnder(parent, true);
	for (i = 0; i < siblingCount; i++) {
		sibling = (BStringItem*)fDomains->ItemUnderAt(parent, true, i);
		if (strcmp(sibling->Text(), domainItem->Text()) > 0) {
			fDomains->AddItem(domainItem, fDomains->FullListIndexOf(sibling));
			return domainItem;
		}
	}

	if (sibling) {
		// There were siblings, but all smaller than what we try to insert.
		// Insert after the last one (and its subitems)
		fDomains->AddItem(domainItem, fDomains->FullListIndexOf(sibling)
			+ fDomains->CountItemsUnder(sibling, false) + 1);
	} else {
		// There were no siblings, insert right after the parent
		fDomains->AddItem(domainItem, fDomains->FullListIndexOf(parent) + 1);
	}

	return domainItem;
}
开发者ID:looncraz,项目名称:haiku,代码行数:60,代码来源:CookieWindow.cpp

示例4: switch

void
CookieWindow::MessageReceived(BMessage* message)
{
	switch(message->what) {
		case DOMAIN_SELECTED:
		{
			int32 index = message->FindInt32("index");
			BStringItem* item = (BStringItem*)fDomains->ItemAt(index);
			if (item != NULL) {
				BString domain = item->Text();
				_ShowCookiesForDomain(domain);
			}
			return;
		}

		case COOKIE_REFRESH:
			_BuildDomainList();
			return;

		case COOKIE_DELETE:
			_DeleteCookies();
			return;
	}
	BWindow::MessageReceived(message);
}
开发者ID:looncraz,项目名称:haiku,代码行数:25,代码来源:CookieWindow.cpp

示例5: OpenTable

//Opens the table that is currently selected using the given view.  Or, if the table
//is already open, brings it to the front.
void BeAccessibleWindow::OpenTable(int view)
{
	DBTabView* tab = (DBTabView*)fTabView->GetCurrentTab();
	BStringItem* selectedTable;
	
	//Find the currently selected table
	if (tab->fListView->CurrentSelection() >= 0)
	{
		selectedTable = (BStringItem*)tab->fListView->ItemAt(
		  					        tab->fListView->CurrentSelection() );
	}
	else
	{
		//No table is selected
		return;
	}
	
	
	if (!WindowExists(selectedTable->Text()))
	{
		//Open a new table window if it isn't already
		fNewGrid = new TableWindow(view, selectedTable->Text());
	}
	else
	{
		//If the table is already open, bring it to the front
		BringWindowToFront(selectedTable->Text());
	}
}
开发者ID:HaikuArchives,项目名称:BeAccessible,代码行数:31,代码来源:BeAccessibleWindow.cpp

示例6: beep

// Gets the user's selection, and parses it up to get the server,
//   then formats a BMessage and sends it to whomever opened the window.
void InexactMatchWindow::Save() 
{
	const char *selectedText;	
	int selection = cdList->CurrentSelection();
	if (selection < 0) 
	{
		beep();
		return;
	}
	
	// Copy the selected string.
	BStringItem *item; 
	item = (BStringItem *) cdList->ItemAt(selection); 
	selectedText = item->Text();
	char *parseStr= new char[strlen(selectedText)+1];
	strcpy(parseStr,selectedText);

	char *disc_id;
	char *category;
	 
	//	Send the response to the CDDB looper
	category = strtok(parseStr," ");
	disc_id = strtok(NULL," ");
	printf("Category is %s.\n",category);
	printf("New ID is %s.\n",disc_id);
	BMessage *msg = new BMessage(CDDB_READ);
	msg->AddString("category",category);
	msg->AddString("disc_id",disc_id);
	replyTo.SendMessage(msg);
	delete parseStr;
	PostMessage(B_QUIT_REQUESTED);
}
开发者ID:HaikuArchives,项目名称:UltraEncode,代码行数:34,代码来源:InexactMatchWindow.cpp

示例7: StringItemComp

static int
StringItemComp(const BListItem* first, const BListItem* second)
{
	BStringItem* firstItem = (BStringItem*)first;
	BStringItem* secondItem = (BStringItem*)second;
	return BPrivate::NaturalCompare(firstItem->Text(), secondItem->Text());
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:7,代码来源:MusicCollectionWindow.cpp

示例8: puts

	void
PrefListView::BuildView(XmlNode *node, int level, BListItem* parent)
{
	if (!node) {
		puts("Rebuild mit NULL?!");
		return;
	}

	int anz = node->Children();

	//printf("BuildView: %s %d einträge\n", node->Attribute("text"), anz);

	if (anz>0) {
		if (level==0) {
			for (int i=0;i<anz;i++) {
				XmlNode* c = (XmlNode*)node->ItemAt(i);
				const char* t = c->Attribute("text");

				BStringItem* item = new BStringItem(t);
				item->SetText( t );

				if (level>0)
					AddUnder(item, parent);
				else
					AddItem(item);

				//printf("Hinzufügen war %d\n", b);

				if (c->Children()>0) {
					BuildView(c, level+1, item);
				}
			}
			DeselectAll();
		}
		else {
			for (int i=anz-1;i>=0;i--) {
				XmlNode* c = (XmlNode*)node->ItemAt(i);
				const char* t = c->Attribute("text");

				BStringItem* item = new BStringItem(t);
				item->SetText( t );

				if (level>0)
					AddUnder(item, parent);
				else
					AddItem(item);

				//printf("Hinzufügen war %d\n", b);

				if (c->Children()>0) {
					BuildView(c, level+1, item);
				}
			}
		}
	}
	else {
		//puts("Tja...");
	}	
}
开发者ID:DarkmatterVale,项目名称:fRiSS,代码行数:59,代码来源:fr_preflistview.cpp

示例9: SetList

void FreqWindow::SetList(){

	BStringItem *it = NULL;
	for (int32 i=0; i<list->CountItems(); i++){
		it = (BStringItem*)list->ItemAt(i);
		it->Deselect();
		float frequency = atof( it->Text() );
		if (Pool.frequency == frequency){	it->Select();	text->SetValue(Pool.frequency);	}
	}
}
开发者ID:spiraleyes,项目名称:BeAE,代码行数:10,代码来源:FreqWindow.cpp

示例10: FailOSErr

void CPathsBox::MessageReceived(BMessage *msg)
{
	try
	{
		entry_ref ref;
		BEntry e;
		BPath p;
		
		if (msg->WasDropped() && msg->HasRef("refs"))
		{
			FailOSErr(msg->FindRef("refs", &ref));
			FailOSErr(e.SetTo(&ref));
			FailOSErr(e.GetPath(&p));
			
			fList->AddItem(new BStringItem(p.Path()));
			
			ListBoxChanged();
		}
		else switch (msg->what)
		{
			case msg_AddPath:
			case msg_ChangePath:
				FailOSErr(msg->FindRef("refs", &ref));
				FailOSErr(e.SetTo(&ref));
				FailOSErr(e.GetPath(&p));
				
				if (msg->what == msg_AddPath)
					fList->AddItem(new BStringItem(p.Path()));
				else
				{
					BStringItem *item;
					FailOSErr(msg->FindPointer("item", (void**)&item));
					if (fList->IndexOf(item) < 0)
						THROW(("item was removed from list!"));
					item->SetText(p.Path());
				}
				
				delete fPanel;
				fPanel = NULL;
				
				ListBoxChanged();
				break;
				
			default:
				CListBox::MessageReceived(msg);
				break;
		}
	}
	catch (HErr& e)
	{
		e.DoError();
	}
} /* CPathsBox::MessageReceived */
开发者ID:HaikuArchives,项目名称:Pe,代码行数:53,代码来源:CPathsBox.cpp

示例11: CALLED

void
GrepWindow::_OnReportResult(BMessage* message)
{
	CALLED();

	entry_ref ref;
	if (message->FindRef("ref", &ref) != B_OK)
		return;

	type_code type;
	int32 count;
	message->GetInfo("text", &type, &count);

	BStringItem* item = NULL;
	if (fModel->fState == STATE_UPDATE) {
		// During updates because of node monitor events, negatives are
		// also reported (count == 0).
		item = fSearchResults->RemoveResults(ref, count == 0);
	}

	if (count == 0)
		return;

	if (item == NULL) {
		item = new ResultItem(ref);
		fSearchResults->AddItem(item);
		item->SetExpanded(fShowLinesCheckbox->Value() == 1);
	}

	const char* buf;
	while (message->FindString("text", --count, &buf) == B_OK) {
		uchar* temp = (uchar*)strdup(buf);
		uchar* ptr = temp;

		while (true) {
			// replace all non-printable characters by spaces
			uchar c = *ptr;

			if (c == '\0')
				break;

			if (!(c & 0x80) && iscntrl(c))
				*ptr = ' ';

			++ptr;
		}

		fSearchResults->AddUnder(new BStringItem((const char*)temp), item);

		free(temp);
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:52,代码来源:GrepWindow.cpp

示例12:

void
KeymapWindow::_SetListViewSize(BListView* listView)
{
	float minWidth = 0;
	for (int32 i = 0; i < listView->CountItems(); i++) {
		BStringItem* item = (BStringItem*)listView->ItemAt(i);
		float width = listView->StringWidth(item->Text());
		if (width > minWidth)
			minWidth = width;
	}

	listView->SetExplicitMinSize(BSize(minWidth + 8, 32));
}
开发者ID:mmanley,项目名称:Antares,代码行数:13,代码来源:KeymapWindow.cpp

示例13: getListView

/**
 *	@brief	Gets a string at specified index from the control.
 *	@param[in]	index	index
 *	@param[out]	text	a string value is returned.
 */
void BeListViewAdapter::GetItemText(SInt32 index, MBCString& text)
{
	BListView* listView = getListView();
	BStringItem* listItem = dynamic_cast<BStringItem*>(listView->ItemAt(index));
	if (NULL != listItem)
	{
		text = listItem->Text();
	}
	else
	{
		text.Empty();
	}
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:18,代码来源:BeListViewAdapter.cpp

示例14: entry

void
SearchApp::LaunchFile(BMessage *message)
{
	BListView *searchResults ;
	int32 index ;
	
	message->FindPointer("source", (void**)&searchResults) ;
	message->FindInt32("index", &index) ;
	BStringItem *result = (BStringItem*)searchResults->ItemAt(index) ;
	
	entry_ref ref ;
	BEntry entry(result->Text()) ;
	entry.GetRef(&ref) ;
	be_roster->Launch(&ref) ;
}
开发者ID:HaikuArchives,项目名称:Beacon,代码行数:15,代码来源:SearchApp.cpp

示例15: OKClicked

bool CPasteFunctionDialog::OKClicked()
{
	bool result = true;
	BStringItem *item = (BStringItem *)fList->ItemAt(fList->CurrentSelection());
	char *cp;
	
	if (item)
	{
		BMessage msg(msg_FunctionChosen);
		const char *s = item->Text();
		
		msg.AddString("string", item->Text());
		
		if (strstr(s, "()") != NULL)
			;
		else if ((cp = strchr(s, '(')) != NULL)
		{
			int start;
			
			start = cp - s + 1;
			
			int end = 0;
			char *sp;
			
			if ((sp = strchr(cp, gListSeparator)) != NULL)
			{
				end = sp - cp - 1;
			}
			
			if (!end && (sp = strchr(cp, ')')) != NULL)
			{
				end = sp - cp - 1;
			}
			
			if (!end)
				end = strlen(s) - start - 1;
			
			msg.AddInt32("start", start);
			msg.AddInt32("stop", end);
		}

		fOwner->PostMessage(&msg, fOwner->GetEditBox());
	}
	else
		result = false;

	return result;
} /* CPasteFunctionDialog::OKClicked */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:48,代码来源:PasteFunctionDialog.cpp


注:本文中的BStringItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。