本文整理汇总了C++中BRow类的典型用法代码示例。如果您正苦于以下问题:C++ BRow类的具体用法?C++ BRow怎么用?C++ BRow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: BRow
void AddTorrentWindow::UpdateFileList()
{
//
//
int fileCount = fTorrent->Info()->fileCount;
tr_file* fileList = fTorrent->Info()->files;
for( int i = 0; i < fileCount; i++ )
{
char FormatBuffer[128] = { 0 };
BRow* row = new BRow(FILE_COLUMN_HEIGHT);
const char* name = fTorrent->IsFolder() ? (strchr(fileList[i].name, '/') + 1) : fileList[i].name;
//
//
//
BString FileExtension = B_EMPTY_STRING;
BString FilePath = fileList[i].name;
FilePath.CopyInto(FileExtension, FilePath.FindLast('.') + 1, FilePath.CountChars());
const char* info = tr_formatter_mem_B(FormatBuffer, fileList[i].length, sizeof(FormatBuffer));;
const BBitmap* icon = GetIconFromExtension(FileExtension);
row->SetField(new FileField(icon, name, info), COLUMN_FILE_NAME);
row->SetField(new CheckBoxField(true), COLUMN_FILE_DOWNLOAD);
////row->SetField(new BIntegerField(PeerStatus[i].progress * 100.0), COLUMN_PEER_PROGRESS);
fFileList->AddRow(row, i);
}
}
示例3: switch
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;
}
}
示例4: switch
void
SearchView::MessageReceived(BMessage* message)
{
switch (message->what) {
case M_START:
{
fSearchTC->MakeFocus(false);
fSearchListView->Clear();
int32 flag = 0;
if (fMatchCaseCB->Value() != false)
flag |= SEARCH_MATCH_CASE;
if (fWholeWordCB->Value() != false)
flag |= SEARCH_WHOLE_WORD;
fEngine->FindString(fSearchTC->Text(), Window(), this, flag);
break;
}
case M_TEXT_CHANGED:
{
fSearchListView->Clear();
int32 flag = 0;
if (fMatchCaseCB->Value() != false)
flag |= SEARCH_MATCH_CASE;
if (fWholeWordCB->Value() != false)
flag |= SEARCH_WHOLE_WORD;
fEngine->FindString(fSearchTC->Text(), Window(), this, flag);
break;
}
case MSG_SEARCH_RESULT:
{
int32 page = 0;
message->FindInt32("page", &page);
BString context;
message->FindString("context", &context);
BRect rect;
message->FindRect("rect", &rect);
fSearchListView->fRectVec.push_back(rect);
BRow* row = new BRow();
row->SetField(new BIntegerField(page + 1), 0);
row->SetField(new BStringField(context), 1);
fSearchListView->AddRow(row);
break;
}
default:
BGroupView::MessageReceived(message);
break;
}
}
示例5: getColumnListView
/**
* @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();
}
}
示例6: DoResume
void MainWindow::DoResume(void)
{
BRow* selected = NULL;
while ((selected = teamView->CurrentSelection(selected))) {
// is a team or thread?
if (selected->HasLatch())
for (int i = 0; i < teamView->CountRows(selected); i++)
resume_thread(((ThreadItem *)teamView->RowAt(i, selected))->thread);
else
resume_thread(((ThreadItem *)selected)->thread);
}
}
示例7: DoPriority
void MainWindow::DoPriority(int32 priority)
{
BRow* selected = NULL;
while ((selected = teamView->CurrentSelection(selected))) {
// is a team or thread?
if (selected->HasLatch())
for (int i = 0; i < teamView->CountRows(selected); i++)
set_thread_priority(((ThreadItem *)teamView->RowAt(i, selected))->thread, priority);
else
set_thread_priority(((ThreadItem *)selected)->thread, priority);
}
}
示例8: BRow
void
NotificationsView::_PopulateApplications()
{
appusage_t::iterator it;
fApplications->Clear();
for (it = fAppFilters.begin(); it != fAppFilters.end(); ++it) {
BRow* row = new BRow();
row->SetField(new BStringField(it->first.String()), kAppIndex);
fApplications->AddRow(row);
}
}
示例9: DoKill
void MainWindow::DoKill(void)
{
BRow* selected = NULL;
while ((selected = teamView->CurrentSelection(selected))) {
if (selected->HasLatch())
kill_team(((TeamItem *)selected)->team);
else
kill_thread(((ThreadItem *)selected)->thread);
if (teamView->IndexOf(selected) == teamView->CountRows() - 1)
teamView->MoveToRow(teamView->IndexOf(selected) - 1);
else
teamView->MoveToRow(teamView->IndexOf(selected) + 1);
}
}
示例10: BRow
void BudgetWindow::RefreshCategories(void)
{
fCategoryList->Clear();
fIncomeRow = new BRow();
fCategoryList->AddRow(fIncomeRow);
fSpendingRow = new BRow();
fCategoryList->AddRow(fSpendingRow);
fIncomeRow->SetField(new BStringField(TRANSLATE("Income")),0);
fSpendingRow->SetField(new BStringField(TRANSLATE("Spending")),0);
CppSQLite3Query query = gDatabase.DBQuery("select category,amount,period,isexpense from "
"budgetlist order by category",
"BudgetWindow::RefreshCategories");
float maxwidth=fCategoryList->StringWidth("Category");
while(!query.eof())
{
BString cat = DeescapeIllegalCharacters(query.getStringField(0));
Fixed amount;
amount.SetPremultiplied(query.getInt64Field(1));
BudgetPeriod period = (BudgetPeriod)query.getIntField(2);
BRow *row = new BRow();
if(query.getIntField(3)==0)
fCategoryList->AddRow(row,fIncomeRow);
else
fCategoryList->AddRow(row,fSpendingRow);
row->SetField(new BStringField(cat.String()),0);
BString amountstr;
gDefaultLocale.CurrencyToString(amount.AbsoluteValue(),amountstr);
amountstr.Truncate(amountstr.FindFirst(gDefaultLocale.CurrencyDecimal()));
amountstr.RemoveFirst(gDefaultLocale.CurrencySymbol());
row->SetField(new BStringField(amountstr.String()),1);
float tempwidth = fCategoryList->StringWidth(cat.String());
maxwidth = MAX(tempwidth,maxwidth);
row->SetField(new BStringField(BudgetPeriodToString(period).String()),2);
query.nextRow();
}
fCategoryList->ColumnAt(0)->SetWidth(maxwidth+30);
fCategoryList->ExpandOrCollapse(fIncomeRow,true);
fCategoryList->ExpandOrCollapse(fSpendingRow,true);
}
示例11: B_TRANSLATE
void
NotificationsView::_Populate(AppUsage* usage)
{
// Sanity check
if (!usage)
return;
int32 size = usage->Notifications();
if (usage->Allowed() == false)
fBlockAll->SetValue(B_CONTROL_ON);
fNotifications->Clear();
for (int32 i = 0; i < size; i++) {
NotificationReceived* notification = usage->NotificationAt(i);
time_t updated = notification->LastReceived();
const char* allow = notification->Allowed() ? B_TRANSLATE("Yes")
: B_TRANSLATE("No");
const char* type = "";
switch (notification->Type()) {
case B_INFORMATION_NOTIFICATION:
type = B_TRANSLATE("Information");
break;
case B_IMPORTANT_NOTIFICATION:
type = B_TRANSLATE("Important");
break;
case B_ERROR_NOTIFICATION:
type = B_TRANSLATE("Error");
break;
case B_PROGRESS_NOTIFICATION:
type = B_TRANSLATE("Progress");
break;
default:
type = B_TRANSLATE("Unknown");
}
BRow* row = new BRow();
row->SetField(new BStringField(notification->Title()), kTitleIndex);
row->SetField(new BDateField(&updated), kDateIndex);
row->SetField(new BStringField(type), kTypeIndex);
row->SetField(new BStringField(allow), kAllowIndex);
fNotifications->AddRow(row);
}
}
示例12: BColumnListView
InfoPeerView::InfoPeerView(const TorrentObject* torrent)
:
BColumnListView("InfoPeerView", 0, B_PLAIN_BORDER, true),
fTorrent(torrent)
{
SetColumnFlags(B_ALLOW_COLUMN_RESIZE);
GraphColumn* fProgressColumn = NULL;
AddColumn(new BStringColumn("IP Address", 180, 50, 500, B_TRUNCATE_MIDDLE), COLUMN_PEER_ADDRESS);
AddColumn(new BStringColumn("Client", 140, 50, 500, B_TRUNCATE_MIDDLE), COLUMN_PEER_CLIENT);
AddColumn(fProgressColumn = new GraphColumn("Progress", 80, 80, 140), COLUMN_PEER_PROGRESS);
AddColumn(new BIntegerColumn("Port", 60, 60, 60), COLUMN_PEER_PORT);
//
//
//
fProgressColumn->SetTextColor(make_color(0, 0, 0));
fProgressColumn->SetBackgroundColor(make_color(77, 164, 255));
//
//
//
int peerCount = 0;
tr_peer_stat* PeerStatus = tr_torrentPeers( fTorrent->Handle(), &peerCount );
for( int i = 0; i < peerCount; i++ )
{
const tr_peer_stat* peer = &PeerStatus[i];
BRow* row = new BRow();
row->SetField(new BStringField(peer->addr), COLUMN_PEER_ADDRESS);
row->SetField(new BStringField(peer->client), COLUMN_PEER_CLIENT);
row->SetField(new BIntegerField(peer->progress * 100.0), COLUMN_PEER_PROGRESS);
row->SetField(new BIntegerField(peer->port), COLUMN_PEER_PORT);
AddRow(row);
}
tr_torrentPeersFree( PeerStatus, peerCount );
}
示例13: 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();
}
示例14: CountItems
void
PriorityMenu::Update()
{
BRow* selected = fTeamListView->CurrentSelection(NULL);
int32 priority;
bool enabled = selected != NULL;
if (enabled && fTeamListView->CurrentSelection(selected) == NULL && !selected->HasLatch())
priority = ((ThreadItem *)selected)->priority;
else
priority = -1;
if (priority != fPriority || fEnabled != enabled)
{
fPriority = priority;
fEnabled = enabled;
if (CountItems() > 0)
RemoveItems(0, CountItems(), true);
if (CountItems() < 1)
BuildMenu();
}
}
示例15: switch
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;
}
}