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


C++ BRect::SetRightBottom方法代码示例

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


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

示例1: getSelBounds

void MainView::getSelBounds(BRect& bounds)
{
	BPoint upper_left, lower_right;
	
	upper_left.x = upper_left.y = 999999;
	lower_right.x = lower_right.y = 0;
	
	for(int i = 0; i < selected_fields.CountItems(); i++) {
		BView *field = (BView *)selected_fields.ItemAt(i);
		BRect frame = field->Frame();
		BPoint tl = frame.LeftTop();
		BPoint br = frame.RightBottom();
		
		if(tl.x < upper_left.x) {
			upper_left.x = tl.x;
		}
		if(br.x > lower_right.x) {
			lower_right.x = br.x;
		}
		if(tl.y < upper_left.y) {
			upper_left.y = tl.y;
		}
		if(br.y > lower_right.y) {
			lower_right.y = br.y;
		}
	}
	
	bounds.SetLeftTop(upper_left);
	bounds.SetRightBottom(lower_right);
}
开发者ID:brennanos,项目名称:XFile-Haiku,代码行数:30,代码来源:MainView.cpp

示例2: UpdateNeedle

void AnalogView::UpdateNeedle(short cpuTime)
{
	BRect	updateRect;
	BRect	rt;

	if(cpuTime != oldCPUTime)
	{
		rt.SetRightBottom(param.meterCenter);
		rt.SetLeftTop(angle[oldCPUTime].arry);
		if(rt.left > rt.right)
		{
			double tmp = rt.left;
			rt.left = rt.right;
			rt.right = tmp;
		}

		DrawBitmap(panel, rt, rt);

		const rgb_color kNeedleColor = {0,0,0,0};
		//const rgb_color kNeedleColor = {0,255,0,0};
		this->SetHighColor(kNeedleColor);

		StrokeLine(param.meterCenter, angle[cpuTime].arry);
	}
	Sync();
	oldCPUTime = cpuTime;
}
开发者ID:diger,项目名称:AnalogPulse,代码行数:27,代码来源:AnalogView.cpp

示例3: sizeof

status_t
StyledEditView::GetStyledText(BPositionIO* stream)
{
	fSuppressChanges = true;
	status_t result = BTranslationUtils::GetStyledText(stream, this,
		fEncoding.String());
	fSuppressChanges = false;

	if (result != B_OK)
		return result;

	BNode* node = dynamic_cast<BNode*>(stream);
	if (node != NULL) {
		// get encoding
		if (node->ReadAttrString("be:encoding", &fEncoding) != B_OK) {
			// try to read as "int32"
			int32 encoding;
			ssize_t bytesRead = node->ReadAttr("be:encoding", B_INT32_TYPE, 0,
				&encoding, sizeof(encoding));
			if (bytesRead == (ssize_t)sizeof(encoding)) {
				if (encoding == 65535) {
					fEncoding = "UTF-8";
				} else {
					const BCharacterSet* characterSet
						= BCharacterSetRoster::GetCharacterSetByConversionID(encoding);
					if (characterSet != NULL)
						fEncoding = characterSet->GetName();
				}
			}
		}

		// TODO: move those into BTranslationUtils::GetStyledText() as well?

		// restore alignment
		int32 align;
		ssize_t bytesRead = node->ReadAttr("alignment", 0, 0, &align, sizeof(align));
		if (bytesRead == (ssize_t)sizeof(align))
			SetAlignment((alignment)align);

		// restore wrapping
		bool wrap;
		bytesRead = node->ReadAttr("wrap", 0, 0, &wrap, sizeof(wrap));
		if (bytesRead == (ssize_t)sizeof(wrap)) {
			SetWordWrap(wrap);
			if (wrap == false) {
				BRect textRect;
				textRect = Bounds();
				textRect.OffsetTo(B_ORIGIN);
				textRect.InsetBy(TEXT_INSET, TEXT_INSET);
					// the width comes from stylededit R5. TODO: find a better way
				textRect.SetRightBottom(BPoint(1500.0, textRect.RightBottom().y));
				SetTextRect(textRect);
			}
		}
	}

	return result;
}
开发者ID:mmanley,项目名称:Antares,代码行数:58,代码来源:StyledEditView.cpp

示例4: BMessage

_MediaBar_::_MediaBar_(
	BRect		frame,
	MediaView	*owner)
		: BView(frame, B_EMPTY_STRING, B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW)
{
	fOwner = owner;

	BRect buttonRect;
	buttonRect.SetLeftTop(BPoint(kMediaBarInset, kMediaBarInset + 1.0));
	buttonRect.SetRightBottom(buttonRect.LeftTop() + kPlayButtonSize);
	
	fPlayPauseButton = new PlayPauseButton(buttonRect,
										   B_EMPTY_STRING,
										   kPlayButtonBitmapBits, 
										   kPressedPlayButtonBitmapBits, 
										   kDisabledPlayButtonBitmapBits,
										   kPlayingPlayButtonBitmapBits, 
										   kPressedPlayingPlayButtonBitmapBits,
										   kPausedPlayButtonBitmapBits, 
										   kPressedPausedPlayButtonBitmapBits,
										   new BMessage(msg_PlayPause), 
										   ' ', 
										   0, 
										   B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	AddChild(fPlayPauseButton);
	fPlayPauseButton->SetPaused();

	BRect sliderRect = Bounds();
	sliderRect.left = buttonRect.right;
	sliderRect.InsetBy(kMediaBarInset * 4, kMediaBarInset);	

	fMediaSlider = new _MediaSlider_(sliderRect, fOwner);
	AddChild(fMediaSlider);

	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
开发者ID:HaikuArchives,项目名称:Resourcer,代码行数:36,代码来源:MediaView.cpp

示例5: numb

BamKeysPrefsWindow::BamKeysPrefsWindow()
	: BWindow(BRect(40, 30, 40 + WIDTH, 30 + HEIGHT), "BamKeys",
			B_TITLED_WINDOW, B_NOT_ZOOMABLE)// | B_NOT_RESIZABLE)
{
	fModified = false;
	fRootView = new BBox(BRect(0, 0, WIDTH, HEIGHT), 
						"root_view", B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER);
	
	fRootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(fRootView);
	
	// Screen area selection box
	fScreenBox = new BBox(BRect(10, 10, ((WIDTH / 3) * 2) - 5, (HEIGHT - 50)), 
						"screen_box", B_FOLLOW_ALL, B_WILL_DRAW, B_FANCY_BORDER);
	BRect gridRect = fScreenBox->Frame();
	gridRect.OffsetTo(0, 0);
	gridRect.InsetBy(5, 5);
	fGrid = new BamKeysGridControl(gridRect, "screen_grid", "", new BMessage('grid'));
	fScreenBox->AddChild(fGrid);
	
	// Settings Box
	fSettingBox = new BBox(BRect(((WIDTH / 3) * 2) + 5, 10, WIDTH - 10, (HEIGHT - 50)),
						"settings_box", B_FOLLOW_RIGHT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, B_FANCY_BORDER);
	
	BRect itmRect = fSettingBox->Frame();
	itmRect.Set(5, 10, itmRect.Width() - 5, (itmRect.Height() - 10) / 8);
	
	// Filter Enabled
	fChkEnabled = new BCheckBox(itmRect, "chkGrid", "Enable BamKeys", new BMessage('fltr'), B_FOLLOW_TOP | B_FOLLOW_RIGHT);
	fChkEnabled->SetValue(fGrid->IsFiltering() ? B_CONTROL_ON : B_CONTROL_OFF);
	fSettingBox->AddChild(fChkEnabled);
	
	itmRect.OffsetBy(0, itmRect.Height());

	// Rows and Columns
	int32 rows;
	int32 columns;
	fGrid->GetSize(&rows, &columns);
	
	BPopUpMenu *mnuRows = new BPopUpMenu("");
	for (int i = 1; i <= MAX_DIVIDE; i++) {
		BString numb("");
		numb << i;
		BMenuItem *mnuItem = new BMenuItem(numb.String(), new BMessage('rowC'));
		mnuRows->AddItem(mnuItem);
		if (i == rows) {
			mnuItem->SetMarked(true);
		}
	}
	
	fMnuFldRows = new BMenuField(itmRect, "mnuRows", "Rows:", mnuRows, B_FOLLOW_TOP | B_FOLLOW_RIGHT);
	fSettingBox->AddChild(fMnuFldRows);
	
	
	itmRect.OffsetBy(0, itmRect.Height());
	
	BPopUpMenu *mnuColumns = new BPopUpMenu("");
	for (int i = 1; i <= MAX_DIVIDE; i++) {
		BString numb("");
		numb << i;
		BMenuItem *mnuItem = new BMenuItem(numb.String(), new BMessage('colC'));
		mnuColumns->AddItem(mnuItem);
		if (i == columns) {
			mnuItem->SetMarked(true);
		}
	}
	
	fMnuFldColumns = new BMenuField(itmRect, "mnuCols", "Columns:", mnuColumns, B_FOLLOW_TOP | B_FOLLOW_RIGHT);
	fSettingBox->AddChild(fMnuFldColumns);
	
	itmRect.OffsetBy(0, itmRect.Height());
	// Hotkey
	BRect stringRect(itmRect);
	stringRect.OffsetBy(0, -(itmRect.Height() / 3));
	fStrHotKey = new BStringView(stringRect, "lblModifiers", "Modifiers:", B_FOLLOW_TOP | B_FOLLOW_LEFT);
	fSettingBox->AddChild(fStrHotKey);
	itmRect.OffsetBy(0, itmRect.Height());

	// Caps Lock
	fCapsLock = new BamKeysKeyView(itmRect, "capsLock", B_CAPS_LOCK, B_FOLLOW_TOP | B_FOLLOW_LEFT);
	fSettingBox->AddChild(fCapsLock);
	itmRect.OffsetBy(0, itmRect.Height());
	
	// Num Lock
	fNumLock = new BamKeysKeyView(itmRect, "numLock", B_NUM_LOCK, B_FOLLOW_TOP | B_FOLLOW_LEFT);
	fSettingBox->AddChild(fNumLock);
	itmRect.OffsetBy(0, itmRect.Height());

	// Scroll Lock
	fScrlLock = new BamKeysKeyView(itmRect, "scrollLock", B_SCROLL_LOCK, B_FOLLOW_TOP | B_FOLLOW_LEFT);
	fSettingBox->AddChild(fScrlLock);
	itmRect.OffsetBy(0, itmRect.Height());
	
	BPoint half = itmRect.RightBottom();
	
	half.x = half.x / 2;
	itmRect.SetRightBottom(half);
	
	// Command Keys
	fLeftCommand = new BamKeysKeyView(itmRect, "leftCommand", B_LEFT_COMMAND_KEY, B_FOLLOW_TOP | B_FOLLOW_LEFT);
//.........这里部分代码省略.........
开发者ID:bvarner,项目名称:bamkeys,代码行数:101,代码来源:BKPrefsWindow.cpp


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