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


C++ BCheckBox::Frame方法代码示例

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


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

示例1: dir

BRect
LibraryWindow::ScanFolder(BPoint location, const char *path, float *maxwidth)
{
	BDirectory dir(path);
	if (dir.InitCheck() != B_OK)
		return BRect(0,0,-1,-1);
	
	float width = 0.0;
	dir.Rewind();
	entry_ref ref;
	BRect r(location.x,location.y,location.x + 1,location.y + 1);
	
	while (dir.GetNextRef(&ref) == B_OK)
	{
		BString str(ref.name);
		
		int32 soPos = str.FindLast(".so");
		int32 aPos = str.FindLast(".a");
		
		if (soPos < 0 && aPos < 0)
			continue;
		
		if (soPos >= 0 && soPos < str.CountChars() - 3)
			continue;
		
		if (aPos >= 0 && aPos < str.CountChars() - 2)
			continue;
		
		Lock();	
		BMessage *msg = new BMessage(M_TOGGLE_LIB);
		msg->AddRef("ref",&ref);
		msg->AddString("path",path);
		BCheckBox *box = new BCheckBox(r,ref.name,ref.name,msg);
		box->ResizeToPreferred();
		r = box->Frame();
		fCheckList->AddChild(box);
		fSystemLibs.AddItem(box);
		
		// Make sure that there isn't any shortcut normalization
		BPath dirpath(path);
		dirpath.Append(ref.name);
		
		if (fProject && fProject->HasLibrary(dirpath.Path()))
			box->SetValue(B_CONTROL_ON);
		else
			box->SetValue(B_CONTROL_OFF);
		Unlock();
		
		
		width = MAX(r.right,width);
		r.OffsetBy(0,r.Height());
	}
	
	if (r.Height() == 1)
		r.Set(0, 0, -1, -1);
	
	*maxwidth = width;
	return r;
}
开发者ID:passick,项目名称:Paladin,代码行数:59,代码来源:LibWindow.cpp

示例2: AttachedToWindow

void AGMSBayesianSpamFilterConfig::AttachedToWindow ()
{
	char		 numberString [30];
	BRect		 tempRect;
	char		*tempStringPntr;

	SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));

	// Make the checkbox for choosing whether the spam is marked by a
	// modification to the subject of the mail message.

	tempRect = Bounds ();
	fAddSpamToSubjectCheckBoxPntr = new BCheckBox (
		tempRect,
		"AddToSubject",
		"Add spam rating to start of subject",
		new BMessage (kAddSpamToSubjectPressed));
	AddChild (fAddSpamToSubjectCheckBoxPntr);
	fAddSpamToSubjectCheckBoxPntr->ResizeToPreferred ();
	fAddSpamToSubjectCheckBoxPntr->SetValue (fAddSpamToSubject);
	fAddSpamToSubjectCheckBoxPntr->SetTarget (this);

	tempRect = Bounds ();
	tempRect.top = fAddSpamToSubjectCheckBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

	// Add the checkbox on the right for the no words means spam option.

	fNoWordsMeansSpamCheckBoxPntr = new BCheckBox (
		tempRect,
		"NoWordsMeansSpam",
		"or empty e-mail",
		new BMessage (kNoWordsMeansSpam));
	AddChild (fNoWordsMeansSpamCheckBoxPntr);
	fNoWordsMeansSpamCheckBoxPntr->ResizeToPreferred ();
	fNoWordsMeansSpamCheckBoxPntr->MoveBy (
		floorf (tempRect.right - fNoWordsMeansSpamCheckBoxPntr->Frame().right),
		0.0);
	fNoWordsMeansSpamCheckBoxPntr->SetValue (fNoWordsMeansSpam);
	fNoWordsMeansSpamCheckBoxPntr->SetTarget (this);

	// Add the box displaying the spam cutoff ratio to the left, in the space
	// remaining between the left edge and the no words checkbox.

	tempRect.right = fNoWordsMeansSpamCheckBoxPntr->Frame().left -
		be_plain_font->StringWidth ("a");
	tempStringPntr = "Spam above:";
	sprintf (numberString, "%06.4f", (double) fSpamCutoffRatio);
	fSpamCutoffRatioTextBoxPntr	= new BTextControl (
		tempRect,
		"spamcutoffratio",
		tempStringPntr,
		numberString,
		NULL /* BMessage */);
	AddChild (fSpamCutoffRatioTextBoxPntr);
	fSpamCutoffRatioTextBoxPntr->SetDivider (
		be_plain_font->StringWidth (tempStringPntr) +
		1 * be_plain_font->StringWidth ("a"));

	tempRect = Bounds ();
	tempRect.top = fSpamCutoffRatioTextBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

	// Add the box displaying the genuine cutoff ratio, on a line by itself.

	tempStringPntr = "Genuine below and uncertain above:";
	sprintf (numberString, "%08.6f", (double) fGenuineCutoffRatio);
	fGenuineCutoffRatioTextBoxPntr = new BTextControl (
		tempRect,
		"genuinecutoffratio",
		tempStringPntr,
		numberString,
		NULL /* BMessage */);
	AddChild (fGenuineCutoffRatioTextBoxPntr);
	fGenuineCutoffRatioTextBoxPntr->SetDivider (
		be_plain_font->StringWidth (tempStringPntr) +
		1 * be_plain_font->StringWidth ("a"));

	tempRect = Bounds ();
	tempRect.top = fGenuineCutoffRatioTextBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

    // Checkbox for automatically training on incoming mail.

	fAutoTrainingCheckBoxPntr = new BCheckBox (
		tempRect,
		"autoTraining",
		"Learn from all incoming e-mail",
		new BMessage (kAutoTrainingPressed));
	AddChild (fAutoTrainingCheckBoxPntr);
	fAutoTrainingCheckBoxPntr->ResizeToPreferred ();
	fAutoTrainingCheckBoxPntr->SetValue (fAutoTraining);
	fAutoTrainingCheckBoxPntr->SetTarget (this);

	tempRect = Bounds ();
	tempRect.top = fAutoTrainingCheckBoxPntr->Frame().bottom + 1;
	tempRect.bottom = tempRect.top + 20;

	// Button for editing the server settings.

//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:SpamFilterConfig.cpp


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