本文整理汇总了C++中BRow::GetField方法的典型用法代码示例。如果您正苦于以下问题:C++ BRow::GetField方法的具体用法?C++ BRow::GetField怎么用?C++ BRow::GetField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRow
的用法示例。
在下文中一共展示了BRow::GetField方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
NotificationsView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case kApplicationSelected:
{
BRow* row = fApplications->CurrentSelection();
if (row == NULL)
return;
BStringField* appName
= dynamic_cast<BStringField*>(row->GetField(kAppIndex));
if (appName == NULL)
break;
appusage_t::iterator it = fAppFilters.find(appName->String());
if (it != fAppFilters.end())
_Populate(it->second);
break;
}
case kNotificationSelected:
break;
default:
BView::MessageReceived(msg);
break;
}
}
示例2: lock
void
NetPrefsServerView::RemoveServer ()
{
BAutolock lock (Looper ());
if (!lock.IsLocked ())
return;
BRow *row (fServerList->CurrentSelection ());
if (row)
{
BStringField *field ((BStringField *) row->GetField (1));
int32 count;
ssize_t size;
type_code type;
fActiveNetwork->GetInfo ("server", &type, &count);
const ServerData *data;
for (int32 i = 0; i < count; i++)
{
fActiveNetwork->FindData ("server", B_ANY_TYPE, i, reinterpret_cast < const void **>(&data),
&size);
if (!strcmp (data->serverName, field->String ()))
{
fActiveNetwork->RemoveData ("server", i);
break;
}
}
fServerList->RemoveRow (row);
delete row;
}
}
示例3: GetItemText
/**
* @brief Gets a string at specified index from the control.
* @param[in] rowIndex row index
* @param[in] columnIndex column index
* @param[out] text a string value is returned.
*/
void BeColumnListViewAdapter::GetItemText(SInt32 rowIndex, SInt32 columnIndex, MBCString& text)
{
BColumnListView* listView = getColumnListView();
BRow* row = listView->RowAt(rowIndex);
BStringField* field = dynamic_cast<BStringField*>(row->GetField(columnIndex));
if (NULL != field)
{
text = field->String();
}
}
示例4: OnButtonAddClick
void AddTorrentWindow::OnButtonAddClick()
{
tr_file_index_t* files = new tr_file_index_t[ fTorrent->Info()->fileCount ];
uint32 fileCount = 0;
//
// Just for test.
//
int32 RowCount = fFileList->CountRows();
for( int32 i = 0; i < RowCount; i++ )
{
BRow* row = fFileList->RowAt( i );
CheckBoxField* checkField = static_cast<CheckBoxField*>(row->GetField(COLUMN_FILE_DOWNLOAD));
if( !checkField->Selected() )
files[fileCount++] = i;
}
tr_torrentSetFileDLs(const_cast<tr_torrent*>(fTorrent->Handle()), files, fileCount, false);
//
//
//
BMessage* message = new BMessage(MSG_OPEN_TORRENT_RESULT);
message->AddBool("add", true);
message->AddBool("start", fStartCheckBox->Value() == B_CONTROL_ON);
message->AddPointer("torrent", fTorrent);
be_app->PostMessage(message);
delete[] files;
//
//
//
fCancelAdd = false;
Quit();
}
示例5: msgr
void
NetPrefsServerView::MessageReceived (BMessage * msg)
{
switch (msg->what)
{
case M_SERVER_ITEM_SELECTED:
{
BRow *row (fServerList->CurrentSelection ());
if (row)
{
fEditButton->SetEnabled (true);
fRemoveButton->SetEnabled (true);
}
else
{
fEditButton->SetEnabled (false);
fRemoveButton->SetEnabled (false);
}
}
break;
case M_SERVER_ADD_ITEM:
{
BMessenger msgr (fEntryWin);
if (msgr.IsValid ())
fEntryWin->Activate ();
else
{
fEntryWin = new ServerEntryWindow (this, new BMessage (M_SERVER_RECV_DATA), NULL, 0);
fEntryWin->Show ();
}
}
break;
case M_SERVER_EDIT_ITEM:
{
BMessenger msgr (fEntryWin);
if (msgr.IsValid ())
fEntryWin->Activate ();
else
{
BRow *row (fServerList->CurrentSelection ());
if (!row)
break;
int32 count (0);
ssize_t size (0);
type_code type;
fActiveNetwork->GetInfo ("server", &type, &count);
const ServerData *compData;
for (int32 i = 0; i < count; i++)
{
fActiveNetwork->FindData ("server", B_RAW_TYPE, i, reinterpret_cast < const void **>(&compData), &size);
if (!strcmp (compData->serverName, ((BStringField *) row->GetField (1))->String ()))
break;
}
BMessage *invoke (new BMessage (M_SERVER_RECV_DATA));
invoke->AddBool ("edit", true);
fEntryWin = new ServerEntryWindow (this, invoke, compData, size);
fEntryWin->Show ();
}
}
break;
case M_SERVER_REMOVE_ITEM:
{
RemoveServer ();
fNetWin.SendMessage (M_SERVER_DATA_CHANGED);
}
break;
case M_SERVER_RECV_DATA:
{
const ServerData *data;
ssize_t size;
Window ()->DisableUpdates ();
msg->FindData ("server", B_RAW_TYPE, reinterpret_cast < const void **>(&data), &size);
if (msg->HasBool ("edit"))
RemoveServer ();
UpdateNetworkData (data);
AddServer (data);
Window ()->EnableUpdates ();
fNetWin.SendMessage (M_SERVER_DATA_CHANGED);
}
break;
default:
BView::MessageReceived (msg);
break;
}
}
示例6: SetPeriod
void BudgetWindow::SetPeriod(const BudgetPeriod &period)
{
BRow *row = fCategoryList->CurrentSelection();
if(!row)
return;
BudgetEntry entry;
BStringField *strfield = (BStringField*)row->GetField(0);
if(!gDatabase.GetBudgetEntry(strfield->String(),entry))
return;
// Convert the amount to reflect the change in period
switch(entry.period)
{
case BUDGET_WEEKLY:
{
entry.amount *= 52;
break;
}
case BUDGET_QUARTERLY:
{
entry.amount *= 4;
break;
}
case BUDGET_ANNUALLY:
{
break;
}
default:
{
entry.amount *= 12;
break;
}
}
entry.period = period;
switch(entry.period)
{
case BUDGET_WEEKLY:
{
entry.amount /= 52;
break;
}
case BUDGET_QUARTERLY:
{
entry.amount /= 4;
break;
}
case BUDGET_ANNUALLY:
{
break;
}
default:
{
entry.amount /= 12;
break;
}
}
// yeah, yeah, I know about rounding errors. It's not that big of a deal,
// so deal with it. *famous last words*
entry.amount.Round();
gDatabase.AddBudgetEntry(entry);
RefreshBudgetGrid();
RefreshBudgetSummary();
BString str;
gDefaultLocale.CurrencyToString(entry.amount,str);
str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
str.RemoveFirst(gDefaultLocale.CurrencySymbol());
row->SetField(new BStringField(str.String()),1);
fAmountBox->SetText(str.String());
row->SetField(new BStringField(BudgetPeriodToString(entry.period).String()),2);
fCategoryList->UpdateRow(row);
}
示例7: HandleCategorySelection
void BudgetWindow::HandleCategorySelection(void)
{
BRow *row = fCategoryList->CurrentSelection();
if(!row)
{
fAmountBox->SetText("");
fMonthly->SetValue(B_CONTROL_ON);
fStatAverageRow->SetField(new BStringField(""),1);
fStatHighestRow->SetField(new BStringField(""),1);
fStatLowestRow->SetField(new BStringField(""),1);
}
BudgetEntry entry;
BStringField *strfield = (BStringField*)row->GetField(0);
if(!gDatabase.GetBudgetEntry(strfield->String(),entry))
return;
switch(entry.period)
{
case BUDGET_WEEKLY:
{
fWeekly->SetValue(B_CONTROL_ON);
break;
}
case BUDGET_QUARTERLY:
{
fQuarterly->SetValue(B_CONTROL_ON);
break;
}
case BUDGET_ANNUALLY:
{
fAnnually->SetValue(B_CONTROL_ON);
break;
}
default:
{
fMonthly->SetValue(B_CONTROL_ON);
break;
}
}
BString str;
gDefaultLocale.CurrencyToString(entry.amount.AbsoluteValue(),str);
str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
str.RemoveFirst(gDefaultLocale.CurrencySymbol());
fAmountBox->SetText(str.String());
Fixed high,low,avg;
CalcStats(entry.name.String(),high,low,avg);
gDefaultLocale.CurrencyToString(high.AbsoluteValue(),str);
str.RemoveFirst(gDefaultLocale.CurrencySymbol());
fStatHighestRow->SetField(new BStringField(str.String()),1);
gDefaultLocale.CurrencyToString(low.AbsoluteValue(),str);
str.RemoveFirst(gDefaultLocale.CurrencySymbol());
fStatLowestRow->SetField(new BStringField(str.String()),1);
gDefaultLocale.CurrencyToString(avg.AbsoluteValue(),str);
str.RemoveFirst(gDefaultLocale.CurrencySymbol());
fStatAverageRow->SetField(new BStringField(str.String()),1);
fCatStat->Invalidate();
}
示例8: MessageReceived
void BudgetWindow::MessageReceived(BMessage *msg)
{
switch(msg->what)
{
case M_SELECT_CATEGORY:
{
HandleCategorySelection();
fAmountBox->MakeFocus(true);
break;
}
case M_AMOUNT_CHANGED:
{
BString str(fAmountBox->Text());
if(str.CountChars()<1)
str = "0";
Fixed f;
if(gDefaultLocale.StringToCurrency(str.String(),f)!=B_OK)
break;
f.Round();
gDefaultLocale.CurrencyToString(f,str);
str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
str.RemoveFirst(gDefaultLocale.CurrencySymbol());
BRow *row = fCategoryList->CurrentSelection();
if(!row)
break;
row->SetField(new BStringField(str.String()),1);
fCategoryList->UpdateRow(row);
BudgetEntry entry;
gDatabase.GetBudgetEntry( ((BStringField*)row->GetField(0))->String(),entry );
entry.amount = f;
if(entry.isexpense)
entry.amount.Invert();
gDatabase.AddBudgetEntry(entry);
RefreshBudgetGrid();
RefreshBudgetSummary();
fBudgetSummary->SetFocusRow( entry.isexpense ? 1 : 0);
fBudgetSummary->SetFocusRow(2);
break;
}
case M_BUDGET_RECALCULATE:
{
GenerateBudget(false);
RefreshBudgetGrid();
RefreshBudgetSummary();
RefreshCategories();
break;
}
case M_BUDGET_ZERO:
{
GenerateBudget(true);
RefreshBudgetGrid();
RefreshBudgetSummary();
RefreshCategories();
break;
}
case M_SET_PERIOD_MONTH:
{
SetPeriod(BUDGET_MONTHLY);
break;
}
case M_SET_PERIOD_WEEK:
{
SetPeriod(BUDGET_WEEKLY);
break;
}
case M_SET_PERIOD_QUARTER:
{
SetPeriod(BUDGET_QUARTERLY);
break;
}
case M_SET_PERIOD_YEAR:
{
SetPeriod(BUDGET_ANNUALLY);
break;
}
case M_NEXT_FIELD:
{
if(fAmountBox->ChildAt(0)->IsFocus())
fMonthly->MakeFocus(true);
break;
}
case M_PREVIOUS_FIELD:
{
if(fAmountBox->ChildAt(0)->IsFocus())
fCategoryList->MakeFocus(true);
break;
}
default:
BWindow::MessageReceived(msg);
}
}
示例9: which
//.........这里部分代码省略.........
msg->FindString ("text", &buffer);
if (filter != buffer)
{
filter = buffer;
if (!IsHidden())
vision_app->pClientWin()->pStatusView()->SetItemValue (2, filter.String(), true);
regfree (&re);
memset (&re, 0, sizeof (re));
regcomp (
&re,
filter.String(),
REG_EXTENDED | REG_ICASE | REG_NOSUB);
BRow *currentRow;
BStringField *channel,
*topic;
while (hiddenItems.CountItems() != 0)
{
currentRow = hiddenItems.RemoveItemAt (0L);
listView->AddRow (currentRow);
}
if (filter != NULL)
{
int32 k (0);
while (k < listView->CountRows())
{
currentRow = listView->RowAt (k);
channel = (BStringField *)currentRow->GetField (0);
topic = (BStringField *)currentRow->GetField (2);
if ((regexec (&re, channel->String(), 0, 0, 0) != REG_NOMATCH)
|| (regexec (&re, topic->String(), 0, 0, 0) != REG_NOMATCH))
{
k++;
continue;
}
else
{
listView->RemoveRow (currentRow);
hiddenItems.AddItem (currentRow);
}
}
}
fMsgr.SendMessage (M_LIST_DONE);
processing = true;
}
}
else
{
PromptWindow *prompt (new PromptWindow (
BPoint ((Window()->Frame().right/2) - 100, (Window()->Frame().bottom/2) - 50),
" Filter:",
"List Filter",
filter.String(),
this,
new BMessage (M_LIST_FILTER),
new RegExValidate ("Filter"),
true));
prompt->Show();
}
示例10: r
void
ResView::MessageReceived(BMessage *msg)
{
switch (msg->what) {
case M_NEW_FILE: {
BRect r(100, 100, 400, 400);
if (Window())
r = Window()->Frame().OffsetByCopy(10, 10);
ResWindow *win = new ResWindow(r);
win->Show();
break;
}
case M_OPEN_FILE: {
be_app->PostMessage(M_SHOW_OPEN_PANEL);
break;
}
case B_CANCEL: {
if (fSaveStatus == FILE_QUIT_AFTER_SAVE)
SetSaveStatus(FILE_DIRTY);
break;
}
case B_SAVE_REQUESTED: {
entry_ref saveDir;
BString name;
if (msg->FindRef("directory",&saveDir) == B_OK &&
msg->FindString("name",&name) == B_OK) {
SetTo(saveDir,name);
SaveFile();
}
break;
}
case M_SAVE_FILE: {
if (!fRef)
fSavePanel->Show();
else
SaveFile();
break;
}
case M_SHOW_SAVE_PANEL: {
fSavePanel->Show();
break;
}
case M_QUIT: {
be_app->PostMessage(B_QUIT_REQUESTED);
break;
}
case B_REFS_RECEIVED: {
int32 i = 0;
entry_ref ref;
while (msg->FindRef("refs", i++, &ref) == B_OK)
AddResource(ref);
break;
}
case M_SELECT_FILE: {
fOpenPanel->Show();
break;
}
case M_DELETE_RESOURCE: {
DeleteSelectedResources();
break;
}
case M_EDIT_RESOURCE: {
BRow *row = fListView->CurrentSelection();
TypeCodeField *field = (TypeCodeField*)row->GetField(1);
gResRoster.SpawnEditor(field->GetResourceData(), this);
break;
}
case M_UPDATE_RESOURCE: {
ResourceData *item;
if (msg->FindPointer("item", (void **)&item) != B_OK)
break;
for (int32 i = 0; i < fListView->CountRows(); i++) {
BRow *row = fListView->RowAt(i);
TypeCodeField *field = (TypeCodeField*)row->GetField(1);
if (!field || field->GetResourceData() != item)
continue;
UpdateRow(row);
break;
}
break;
}
default:
BView::MessageReceived(msg);
}
}