本文整理汇总了C++中BStringItem::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringItem::SetText方法的具体用法?C++ BStringItem::SetText怎么用?C++ BStringItem::SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BStringItem
的用法示例。
在下文中一共展示了BStringItem::SetText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BStringItem
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...");
}
}
示例2: MessageReceived
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 */