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


C++ BPopUpMenu::Bounds方法代码示例

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


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

示例1: textOffset

// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SGIView::SGIView(const BRect &frame, const char *name,
	uint32 resize, uint32 flags, TranslatorSettings *settings)
	:	BView(frame, name, resize, flags),
		fSettings(settings)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetLowColor(ViewColor());

	BPopUpMenu* menu = new BPopUpMenu("pick compression");

	uint32 currentCompression = fSettings->SetGetInt32(SGI_SETTING_COMPRESSION);
	// create the menu items with the various compression methods
	add_menu_item(menu, SGI_COMP_NONE, "None", currentCompression);
//	menu->AddSeparatorItem();
	add_menu_item(menu, SGI_COMP_RLE, "RLE", currentCompression);

// DON'T turn this on, it's so slow that I didn't wait long enough
// the one time I tested this. So I don't know if the code even works.
// Supposedly, this would look for an already written scanline, and
// modify the scanline tables so that the current row is not written
// at all...

//	add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression);

	BRect menuFrame = Bounds();
	menuFrame.bottom = menuFrame.top + menu->Bounds().Height();
	fCompressionMF = new BMenuField(menuFrame, "compression",
									"Use compression:", menu, true/*,
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP*/);
	if (fCompressionMF->MenuBar())
		fCompressionMF->MenuBar()->ResizeToPreferred();
	fCompressionMF->ResizeToPreferred();

	// figure out where the text ends
	font_height fh;
	be_bold_font->GetHeight(&fh);
	float xbold, ybold;
	xbold = fh.descent + 1;
	ybold = fh.ascent + fh.descent * 2 + fh.leading;

	font_height plainh;
	be_plain_font->GetHeight(&plainh);
	float yplain;
	yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;

	// position the menu field below all the text we draw in Draw()
	BPoint textOffset(0.0, yplain * 2 + ybold);
	fCompressionMF->MoveTo(textOffset);

	AddChild(fCompressionMF);

	ResizeToPreferred();
}
开发者ID:mmanley,项目名称:Antares,代码行数:66,代码来源:SGIView.cpp


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