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


C++ BRow::SetField方法代码示例

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


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

示例1: UpdateFileList

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);

	} 	
}
开发者ID:Prodito,项目名称:Torrentor,代码行数:33,代码来源:AddTorrentWindow.cpp

示例2: lock

void
NetPrefsServerView::AddServer (const ServerData * data)
{
  BAutolock lock (Looper ());
  if (!lock.IsLocked ())
    return;

  BRow *row (new BRow);
  switch (data->state)
    {
      case SERVER_PRIMARY:
        row->SetField (new BStringField ("*"), 0);
        break;

      case SERVER_SECONDARY:
        row->SetField (new BStringField ("+"), 0);
        break;

      case SERVER_DISABLED:
        row->SetField (new BStringField ("-"), 0);
        break;
    }
  BString server ("");
  server = data->serverName;
  BStringField *serverField (new BStringField (server.String ()));
  row->SetField (serverField, 1);
  server = "";
  server << data->port;
  BStringField *portField (new BStringField (server.String ()));
  row->SetField (portField, 2);
  fServerList->AddRow (row);
}
开发者ID:xray7224,项目名称:Vision,代码行数:32,代码来源:NetPrefsServerView.cpp

示例3: 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;
    }
}
开发者ID:humdingerb,项目名称:DocumentViewer,代码行数:58,代码来源:SearchView.cpp

示例4: RefreshCategories

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);
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:48,代码来源:BudgetWindow.cpp

示例5: BRow

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);
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:47,代码来源:NotificationsView.cpp

示例6: BStringColumn

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 );
}
开发者ID:Prodito,项目名称:Torrentor,代码行数:44,代码来源:InfoPeerView.cpp

示例7: BView

/***** Constructor ****/
DisplayView::DisplayView(BRect frame,const char *name, float tabHeight)
	: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW)//,
{
	SetViewColor(216, 216, 216);
	int space = 5;
	int boxHight = 200;
	int boxWidth = (Bounds().Width() / 2) / 2;
	int chkBoxWidth = 15;
	int chkBoxHight = 15;
	
// ---------------------
	BRect boxRect = BRect(Bounds().left + space, Bounds().top + space, Bounds().left + boxWidth, Bounds().top + boxHight);
	fBoxGeneral = new BBox(boxRect, "fBoxGeneral", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxGeneral->SetLabel("General");
	
	BRect rect = BRect(boxRect.left + space, boxRect.top + space, boxRect.Width() - space, boxRect.top + chkBoxWidth);
	
/*	fChkboxFulscreen = new BCheckBox(rect, "fChkboxFulscreen", "Full Screen", new BMessage(S9x_FULLSCREEN),B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);
	fChkboxFulscreen->SetValue(settings.ui.S9x_FULLSCREEN);
	fBoxGeneral->AddChild(fChkboxFulscreen);*/
	
//	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxBiLiner = new BCheckBox(rect, "fChkboxBiLiner", "Bi-Linear Mode 7", new BMessage(S9x_BILINER7), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxBiLiner->SetValue(settings.graphics.s9x_Mode7Interpolate);
	fBoxGeneral->AddChild(fChkboxBiLiner);

	rect.OffsetBy(0, space + chkBoxHight);	
	fChkboxShowFrameRate = new BCheckBox(rect, "fChkboxShowFrameRate", "Show Frame Rate", new BMessage(S9x_SHOWFRAMERATE), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxShowFrameRate->SetValue(settings.graphics.s9x_DisplayFrameRate);
	fBoxGeneral->AddChild(fChkboxShowFrameRate);

/*	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxStretchImage = new BCheckBox(rect, "fChkboxStretchImage", "Stretch Image", new BMessage(S9x_STRETSHIMAGE), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
//	fChkboxStretchImage->SetValue(settings.ui.s9x_extended);
	fBoxGeneral->AddChild(fChkboxStretchImage);*/

	AddChild(fBoxGeneral);

// ---------------------
	boxRect.OffsetBy(space + boxRect.Width(), 0);
	fBoxSnesImage = new BBox(boxRect, "fBoxSnesImage", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxSnesImage->SetLabel("Snes Image");

	boxRect.OffsetBy(-(boxRect.Width()+ space), 0);
	rect = BRect(boxRect.left + space, boxRect.top + space, boxRect.Width() - space, boxRect.top + chkBoxHight);
	fChkboxExtendHeight = new BCheckBox(rect, "fChkboxExtendHeight", "Extend Height", new BMessage(S9x_EXTENDED), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxExtendHeight->SetValue(settings.ui.s9x_extended);
	fBoxSnesImage->AddChild(fChkboxExtendHeight);


	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxRender16Bit = new BCheckBox(rect, "fChkboxRender16Bit", "Render 16-bit", new BMessage(S9x_RENDER16BIT), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxRender16Bit->SetValue(settings.graphics.s9x_SixteenBit);
	fBoxSnesImage->AddChild(fChkboxRender16Bit);


	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxTransparency = new BCheckBox(rect, "fChkboxTransparency", "Transparency", new BMessage(S9x_TRANSPARENCY), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxTransparency->SetValue(settings.graphics.s9x_Transparency);
	fBoxSnesImage->AddChild(fChkboxTransparency);

	rect.OffsetBy(0, space + chkBoxHight);
	fChkboxHiRes = new BCheckBox(rect, "fChkboxHiRes", "Support Hi Res", new BMessage(S9x_HIRES), B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE);	
	fChkboxHiRes->SetValue(settings.graphics.s9x_SupportHiRes);
	fBoxSnesImage->AddChild(fChkboxHiRes);

	AddChild(fBoxSnesImage);

// ---------------------
//	Lock();	
	boxRect.OffsetBy(space + boxRect.Width(), 0);
	boxRect = BRect(boxRect.left, boxRect.top, boxRect.right + boxWidth - space * 3, Bounds().bottom - (tabHeight + (space*2)));
	boxRect.OffsetBy(space + boxWidth, 0);
	fBoxFullScreen = new BBox(boxRect, "fBoxFullScreen", B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER);
	fBoxFullScreen->SetLabel("Fullscreen Display Settings");
	
	rect.OffsetTo(space, space*4);
	rect = BRect(rect.left, rect.top - space, (rect.left + boxRect.Width())- space*2 , boxRect.bottom - space*2);	
	fColumnList = new DisplayModeColumnListView (rect, "ColumnList", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW |B_NAVIGABLE);
	fColumnList->AddColumn(new DisplayModeColumn("Video Mode", 200, 10, 150, 0),0);
	fColumnList->AddColumn(new BStringColumn("Status", 100, 10, 100, 0),1);

	fBoxFullScreen->AddChild(fColumnList);
	AddChild(fBoxFullScreen);

	display_mode *modes;
	uint32 mode_count;
	BRow *cRow;
	if (BScreen().GetModeList(&modes, &mode_count) == B_NO_ERROR) {
		qsort(modes, mode_count, sizeof(display_mode), compare_mode);
		
		display_mode prevDisplayMode;
		
		for(unsigned int i = 0; i < mode_count; i++) {			
			if(compare_mode(&prevDisplayMode, &modes[i])){
				cRow = new BRow();
				cRow->SetField(new DisplayModeField(modes[i]), 0);
				cRow->SetField(new BStringField("Supported"), 1);
				fColumnList->AddRow(cRow, (int32)i);
//.........这里部分代码省略.........
开发者ID:ModeenF,项目名称:snes9x_haiku,代码行数:101,代码来源:DisplayView.cpp

示例8: 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);
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:77,代码来源:BudgetWindow.cpp

示例9: RefreshBudgetSummary

void BudgetWindow::RefreshBudgetSummary(void)
{
	Fixed itotal,stotal,mtotal,f;
	Fixed irowtotal,srowtotal, ttotal;
	for(int32 i=0; i<12; i++)
	{
		itotal = stotal = mtotal = 0;

		for(int32 j=0; j<fIncomeGrid.CountItems(); j++)
		{
			fIncomeGrid.ValueAt(i,j,f);
			itotal += f;
			irowtotal += f;
		}

		for(int32 j=0; j<fSpendingGrid.CountItems(); j++)
		{
			fSpendingGrid.ValueAt(i,j,f);
			stotal += f.AbsoluteValue();
			srowtotal += f;
		}

		mtotal = itotal - stotal;
		ttotal += mtotal;

		itotal.Round();
		stotal.Round();
		mtotal.Round();

		BString itemp,stemp,mtemp;
		gDefaultLocale.CurrencyToString(itotal,itemp);
		gDefaultLocale.CurrencyToString(stotal,stemp);
		gDefaultLocale.CurrencyToString(mtotal,mtemp);

		itemp.Truncate(itemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
		stemp.Truncate(stemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
		mtemp.Truncate(mtemp.FindFirst(gDefaultLocale.CurrencyDecimal()));

		itemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
		stemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
		mtemp.RemoveFirst(gDefaultLocale.CurrencySymbol());

		BRow *irow = fBudgetSummary->RowAt(0);
		BRow *srow = fBudgetSummary->RowAt(1);
		BRow *mrow = fBudgetSummary->RowAt(2);

		irow->SetField(new BStringField(itemp.String()),i+1);
		srow->SetField(new BStringField(stemp.String()),i+1);
		mrow->SetField(new BStringField(mtemp.String()),i+1);

		float colwidth = fBudgetSummary->StringWidth(itemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);

		colwidth = fBudgetSummary->StringWidth(stemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);

		colwidth = fBudgetSummary->StringWidth(mtemp.String()) + 20;
		if(fBudgetSummary->ColumnAt(i+1)->Width() < colwidth)
			fBudgetSummary->ColumnAt(i+1)->SetWidth(colwidth);
	}

	BString ttemp;

	gDefaultLocale.CurrencyToString(irowtotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(0)->SetField(new BStringField(ttemp.String()),13);

	gDefaultLocale.CurrencyToString(srowtotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(1)->SetField(new BStringField(ttemp.String()),13);

	gDefaultLocale.CurrencyToString(ttotal,ttemp);
	ttemp.Truncate(ttemp.FindFirst(gDefaultLocale.CurrencyDecimal()));
	ttemp.RemoveFirst(gDefaultLocale.CurrencySymbol());
	fBudgetSummary->RowAt(2)->SetField(new BStringField(ttemp.String()),13);

	fBudgetSummary->Invalidate();
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:82,代码来源:BudgetWindow.cpp

示例10: 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);
	}
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:97,代码来源:BudgetWindow.cpp

示例11: which


//.........这里部分代码省略.........
          vision_app->pClientWin()->pStatusView()->SetItemValue (1, statusStr.String(), true);

        mFind->SetEnabled (true);
        mFindAgain->SetEnabled (true);
        mFilter->SetEnabled (true);

        processing = false;
        
        // empty out any remaining channels that fell below the batch cut off
        AddBatch();

        BString cString;
        cString << listView->CountRows();
        if (!IsHidden())
          vision_app->pClientWin()->pStatusView()->SetItemValue (0, cString.String(), true);
      }
      break;

    case M_LIST_EVENT:
      {
        const char *channel, *users, *topic;

        msg->FindString ("channel", &channel);
        msg->FindString ("users", &users);
        msg->FindString ("topic", &topic);
        
        BRow *row (new BRow ());
        
        
        BStringField *channelField (new BStringField (channel));
        BIntegerField *userField (new BIntegerField (atoi(users)));
        BStringField *topicField (new BStringField (topic));
        
        row->SetField (channelField, channelColumn->LogicalFieldNum());
        row->SetField (userField, usersColumn->LogicalFieldNum());
        row->SetField (topicField, topicColumn->LogicalFieldNum());

        fBuildList.AddItem (row);
        
        if (fBuildList.CountItems() == LIST_BATCH_SIZE)
          AddBatch();
      }
      break;

#ifdef __INTEL__

		case M_LIST_FILTER:
			if (msg->HasString ("text"))
			{
				const char *buffer;

				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);
					
开发者ID:xray7224,项目名称:Vision,代码行数:66,代码来源:ListAgent.cpp

示例12: ComputeNetWorth


//.........这里部分代码省略.........
				}
				case SUBTOTAL_YEAR:
				{
					t = IncrementDateByYear(t);
					break;
				}
				default:
				{
					t = fEndDate;
					break;
				}
			}
		}
	}
	timelist.AddItem(new time_t(fEndDate));
	
	ReportGrid	accountgrid(1, timelist.CountItems());
	
	BString longestname(TRANSLATE("Total Worth"));
	int longestnamelength = longestname.CountChars();
			

	for(int32 subtotal_index=0; subtotal_index<timelist.CountItems(); subtotal_index++)
	{
		time_t subtotal_start = *((time_t*)timelist.ItemAt(subtotal_index));
		
		char rowtitle[128];
		struct tm *timestruct = localtime(&subtotal_start);
		
		BString formatstring;
		if(gCurrentLocale.DateFormat()==DATE_MDY)
		{
			formatstring << "%m" << gCurrentLocale.DateSeparator()
				<< "%d" << gCurrentLocale.DateSeparator() << "%Y";
		}
		else
		{
			formatstring << "%d" << gCurrentLocale.DateSeparator()
				<< "%m" << gCurrentLocale.DateSeparator() << "%Y";
		}
		strftime(rowtitle,128,formatstring.String(),timestruct);
		accountgrid.SetRowTitle(subtotal_index,rowtitle);
		
		int length = strlen(rowtitle);
		if(length > longestnamelength)
		{
			longestname = rowtitle;
			longestnamelength = length;
		}
		
		
		Fixed accounttotal;
		
		for(int32 i=0; i<fAccountList->CountItems(); i++)
		{
			AccountItem *item = (AccountItem*)fAccountList->ItemAt(i);
			if(!item)
				continue;
			
			accounttotal += item->account->BalanceAt(subtotal_start);
		} // end for each account
		
		accountgrid.SetValue(0,subtotal_index,accounttotal);
	}
	
	if(fGraphView->IsHidden())
	{
		// Now that we have all the data, we need to set up the rows and columns for the report grid
		
		BColumn *col = new BStringColumn(TRANSLATE("Date"),fGridView->StringWidth(longestname.String())+20,10,300,B_TRUNCATE_END);
		fGridView->AddColumn(col,0);
		col = new BStringColumn(TRANSLATE("Total"),75,10,300,B_TRUNCATE_END);
		fGridView->AddColumn(col,1);
		
		fGridView->AddRow(new BRow());
		BRow *titlerow = new BRow();
		fGridView->AddRow(titlerow);
		titlerow->SetField(new BStringField(TRANSLATE("Total Worth")),0);
		fGridView->AddRow(new BRow());
		
		// Now that the grid is set up, start adding data to the grid
		for(int32 rowindex=0; rowindex<accountgrid.CountItems(); rowindex++)
		{
			BRow *row = new BRow();
			fGridView->AddRow(row);
			
			BStringField *catname = new BStringField(accountgrid.RowTitle(rowindex));
			row->SetField(catname,0);
					
			BString temp;
			Fixed f;
			
			accountgrid.ValueAt(0,rowindex,f);
			gCurrentLocale.CurrencyToString(f,temp);
			
			BStringField *amountfield = new BStringField(temp.String());
			row->SetField(amountfield,1);
		}
	}
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:101,代码来源:NetWorthReport.cpp


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