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


C++ Locale::CurrencyToString方法代码示例

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


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

示例1: SetData

void ScheduledTransItem::SetData(const TransactionData &trans)
{
	fAccount = trans.GetAccount();
	Locale locale = fAccount->GetLocale();
	
	gDefaultLocale.DateToString(trans.Date(),fDate);
	fType = trans.Type().Type();
	fPayee = trans.Payee();
	locale.CurrencyToString(trans.Amount().AbsoluteValue(),fAmount);
	if(trans.CountCategories()>1)
		fCategory=TRANSLATE("Split");
	else
		fCategory=trans.NameAt(0);
	fMemo = trans.Memo();
	fID = trans.GetID();
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:16,代码来源:ScheduledTransItem.cpp

示例2:

ScheduledTransItem::ScheduledTransItem(const ScheduledTransData &data)
  :BListItem(),
  	fAccount(data.GetAccount()),
	fType(data.Type().Type()),
	fPayee(data.Payee()),
	fAmount(""),
	fCategory(""),
	fMemo(data.Memo()),
  	fDate(""),
	fID(data.GetID())
{
	Locale locale = data.GetAccount()->GetLocale();
	locale.CurrencyToString(data.Amount().AbsoluteValue(),fAmount);
	gDefaultLocale.DateToString(data.Date(),fDate);
	
	if(data.CountCategories()>1)
		fCategory=TRANSLATE("Split");
	else
		fCategory=data.NameAt(0);
}
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:20,代码来源:ScheduledTransItem.cpp

示例3: DrawItem


//.........这里部分代码省略.........
	owner->SetHighColor(linecolor);
	
	//Line Between Date & Type
	owner->StrokeLine(BPoint(xpos, ypos - TRowHeight()), BPoint(xpos, ypos));
	
	owner->StrokeLine(BPoint(0,ypos),BPoint(r.right,ypos));
	owner->SetHighColor(0, 0, 0);
	
	// Type
	owner->SetHighColor(0,0,0);
	owner->DrawString(fType.String(), BPoint(xpos + 5, ypos - 3));

	// Line between Type and Payee
	xpos += TNumWidth();
	owner->SetHighColor(linecolor);
	owner->StrokeLine(BPoint(xpos, ypos - TRowHeight()), BPoint(xpos, ypos));
	
	// Calculate the rectangle for the payee, but this field depends on the
	// width of the view, so we can't yet easily calculate the right coordinate
	// of the rectangle just yet
	BRect payee_rect(xpos, ypos, xpos, ypos - TRowHeight());
	
	
	// Balance
	xpos = r.right - TAmountWidth();
	cliprect.right = r.right;
	cliprect.left = xpos;
	clip = cliprect;
	owner->SetHighColor(0, 0, 0);
	
	Fixed balance = fAccount->BalanceAtTransaction(fDate,fPayee.String());
	if(balance.AsFixed()<0)
		owner->SetHighColor(150, 0, 0);
	locale.CurrencyToString(balance,string);
	owner->DrawString(string.String(), BPoint(xpos + 5, ypos - 3));
	
	// Line between Balance and Amount
	owner->SetHighColor(linecolor);
	owner->StrokeLine(BPoint(xpos, ypos - TRowHeight()), BPoint(xpos, ypos));
	
	// Amount
	xpos -= TAmountWidth();
	cliprect.right = cliprect.left;
	cliprect.left = xpos;
	clip = cliprect;
	owner->SetHighColor(0,0,0);
	fAccount->GetLocale().CurrencyToString(fAmount.AbsoluteValue(),string);	

	owner->ConstrainClippingRegion(&clip);
	owner->DrawString(string.String(), BPoint(xpos + 5, ypos - 3));
	owner->ConstrainClippingRegion(NULL);
	
	// Line between Amount and Payee
	owner->SetHighColor(linecolor);
	owner->StrokeLine(BPoint(xpos, ypos - TRowHeight()), BPoint(xpos, ypos));
	
	// Payee
	payee_rect.right = xpos;
	payee_rect.top = ypos - TRowHeight();
	payee_rect.bottom = ypos;
	xpos = payee_rect.left;
	
	owner->SetHighColor(0, 0, 0);
	clip = payee_rect;
	owner->ConstrainClippingRegion(&clip);
	owner->DrawString(fPayee.String(), BPoint(xpos + 5, ypos - 3));
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:67,代码来源:TransactionItem.cpp


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