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


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

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


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

示例1: DrawItem

void TransactionItem::DrawItem(BView *owner, BRect frame, bool complete)
{
	BString string;
	Locale locale = fAccount->GetLocale();
	
	BRect r(frame);
	r.right--;
	
	rgb_color linecolor;
	
	if(IsSelected())
	{
		linecolor.red=120;
		linecolor.green=120;
		linecolor.blue=120;
		owner->SetHighColor(GetColor(BC_SELECTION_FOCUS));
		owner->SetLowColor(GetColor(BC_SELECTION_FOCUS));
		owner->FillRect(frame);
		owner->SetHighColor(linecolor);
		owner->StrokeRect(frame);
		owner->SetHighColor(255,255,255);
	}
	else
	{
		linecolor.red=200;
		linecolor.green=200;
		linecolor.blue=200;
		
		if(fStatus==TRANS_RECONCILED)
		{
			owner->SetHighColor(232,232,232);
			owner->SetLowColor(232,232,232);
			owner->FillRect(frame);
			owner->SetHighColor(linecolor);
			owner->StrokeLine(r.LeftBottom(),r.RightBottom());
			owner->SetHighColor(255,255,255);
		}
		else
		{
			owner->SetHighColor(255, 255, 255);
			owner->SetLowColor(255, 255, 255);
			owner->FillRect(frame);
//			owner->SetHighColor(222, 222, 222);
			owner->SetHighColor(linecolor);
			owner->StrokeLine(r.LeftBottom(),r.RightBottom());
		}
	}
	owner->SetHighColor(0, 0, 0);

	BRect cliprect;
	BRegion clip(cliprect);
	float xpos = TLeftPadding();
	float ypos = r.top + TRowHeight();

	// Date
	cliprect.left = xpos;
	cliprect.right = xpos + TDateWidth();
	cliprect.top = ypos - TRowHeight();
	cliprect.bottom = ypos;
	
	clip = cliprect;
	owner->ConstrainClippingRegion(&clip);
	locale.DateToString(fDate,string);
	owner->DrawString(string.String(), BPoint(xpos, ypos - 3));
	owner->ConstrainClippingRegion(NULL);
	
	xpos += TDateWidth();
	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);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:CapitalBe,代码行数:101,代码来源:TransactionItem.cpp


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