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


C++ BBox::TopBorderOffset方法代码示例

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


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

示例1: BBox

SettingsView::SettingsView(Core* core)
	:
	BView("SettingsView", B_WILL_DRAW, 0),
	fCore(core)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// Engines entry
	BBox* audioBox = new BBox("audiobox");
	audioBox->SetLabel("Engines");

	BGroupLayout* audioLayout = new BGroupLayout(B_VERTICAL);
	audioLayout->SetInsets(10, audioBox->TopBorderOffset() * 2 + 10, 10, 10);
	audioBox->SetLayout(audioLayout);

	fEngines[0] = new BRadioButton("sine", "Sine",
		_ButtonMsg(CRONO_SINE_ENGINE));
	audioLayout->AddView(fEngines[0]);

	fEngines[1] = new BRadioButton("triangle", "Triangle",
		_ButtonMsg(CRONO_TRIANGLE_ENGINE));
	audioLayout->AddView(fEngines[1]);

	fEngines[2] = new BRadioButton("sawtooth", "Sawtooth",
		_ButtonMsg(CRONO_SAWTOOTH_ENGINE));
	audioLayout->AddView(fEngines[2]);

	fEngines[3] = new BRadioButton("file", "File Engine",
		_ButtonMsg(CRONO_FILE_ENGINE));
	audioLayout->AddView(fEngines[3]);

	fSoundEntry = new BTextControl("Soundfile", "Soundfile",
		gCronoSettings.SoundFileLocation, new BMessage(MSG_SET), B_WILL_DRAW);
	fSoundEntry->SetDivider(70);
	fSoundEntry->SetAlignment(B_ALIGN_CENTER, B_ALIGN_CENTER);
	audioLayout->AddView(fSoundEntry);
	fSoundEntry->SetEnabled(false);

	fDefaultsButton = new BButton("Defaults", new BMessage(MSG_DEFAULTS));

	BLayoutBuilder::Group<>(this, B_VERTICAL, 5)
		.AddGroup(B_VERTICAL)
			.Add(audioBox, 0)
		.End()
		.AddGroup(B_HORIZONTAL)
			.Add(fDefaultsButton, 0)
		.End();

	_SetEngine(fCore->Engine());
}
开发者ID:Barrett17,项目名称:Crono,代码行数:50,代码来源:SettingsView.cpp

示例2: BBox

void
add_status_bars(BGridLayout* layout, int32& row)
{
	BBox* box = new BBox(B_FANCY_BORDER, NULL);
	box->SetLabel("Info");

	BGroupLayout* boxLayout = new BGroupLayout(B_VERTICAL, kInset);
	boxLayout->SetInsets(kInset, kInset + box->TopBorderOffset(), kInset,
		kInset);
	box->SetLayout(boxLayout);

	BStatusBar* statusBar = new BStatusBar("status bar", "Status",
		"Completed");
	statusBar->SetMaxValue(100);
	statusBar->SetTo(0);
	statusBar->SetBarHeight(12);
	boxLayout->AddView(statusBar);

	statusBar = new BStatusBar("status bar", "Progress",
		"Completed");
	statusBar->SetMaxValue(100);
	statusBar->SetTo(40);
	statusBar->SetBarHeight(12);
	boxLayout->AddView(statusBar);

	statusBar = new BStatusBar("status bar", "Lifespan of capitalism",
		"Completed");
	statusBar->SetMaxValue(100);
	statusBar->SetTo(100);
	statusBar->SetBarHeight(12);
	boxLayout->AddView(statusBar);

	layout->AddView(box, 0, row, 4);

	row++;
}
开发者ID:mmanley,项目名称:Antares,代码行数:36,代码来源:Look.cpp

示例3: BMessage

CronoView::CronoView()
	:
	BView("CronoView", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
	fAccentsList(false)
{
    fReplicated = false;

	// Core
	fCore = new Core();

	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	rgb_color barColor = { 0, 200, 0 };
	rgb_color fillColor = { 240, 240, 240 };


	_BuildMenu();

	// Volume slider
	BBox* volBox = new BBox("volbox");
	volBox->SetLabel("Volume");

	BGroupLayout* volLayout = new BGroupLayout(B_VERTICAL);
	volLayout->SetInsets(10, volBox->TopBorderOffset() * 2 + 10, 10, 10);
	volBox->SetLayout(volLayout);
	
	fVolumeSlider = new VolumeSlider("",
		0, 1000, DEFAULT_VOLUME, new BMessage(MSG_VOLUME));

	fVolumeSlider->SetLimitLabels("Min", "Max");
	fVolumeSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fVolumeSlider->SetHashMarkCount(20);
	fVolumeSlider->SetValue((int32)fCore->Volume()*10);
	fVolumeSlider->UseFillColor(true, &fillColor);
	fVolumeSlider->SetPosition(gCronoSettings.CronoVolume);
	fVolumeSlider->SetLabel(BString() << gCronoSettings.CronoVolume);
	volLayout->AddView(fVolumeSlider);

	// Speed Slider & TextControl
	BBox* speedBox = new BBox("speedbox");
	speedBox->SetLabel("BPM");
	BGroupLayout* speedLayout = new BGroupLayout(B_HORIZONTAL);
	speedLayout->SetInsets(10, speedBox->TopBorderOffset() * 2 + 10, 10, 10);
	speedBox->SetLayout(speedLayout);

	fSpeedSlider = new VolumeSlider("",
		MIN_SPEED, MAX_SPEED, DEFAULT_SPEED, new BMessage(MSG_SPEED_SLIDER));

	fSpeedSlider->SetLimitLabels(BString() << MIN_SPEED,
		BString() << MAX_SPEED);

	fSpeedSlider->SetKeyIncrementValue(5);
	fSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fSpeedSlider->SetHashMarkCount(15);
	fSpeedSlider->SetValue(fCore->Speed());
	fSpeedSlider->UseFillColor(true, &fillColor);
	_UpdateTempoName(gCronoSettings.Speed);

	fSpeedEntry = new BTextControl("", "", BString() << gCronoSettings.Speed,
		new BMessage(MSG_SPEED_ENTRY), B_WILL_DRAW);

	fSpeedEntry->SetDivider(70);
	fSpeedEntry->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_RIGHT);
	fSpeedEntry->SetExplicitSize(BSize(35, 20));

	speedLayout->AddView(fSpeedSlider);
	speedLayout->AddView(fSpeedEntry);

	// Meter buttons
	BBox* tempoBox = new BBox("tempoBox");
	tempoBox->SetLabel("Tempo");

	for(int i = 0; i < 5; i++)
		fTempoRadios[i] = new BRadioButton("", "",
			new BMessage(MSG_METER_RADIO));

	fTempoRadios[0]->SetLabel("1/4");
	fTempoRadios[1]->SetLabel("2/4");
	fTempoRadios[2]->SetLabel("3/4");
	fTempoRadios[3]->SetLabel("4/4");
	fTempoRadios[4]->SetLabel("Other");

	fTempoRadios[fCore->Meter()]->SetValue(1);

	fTempoEntry = new BTextControl("", "", "4",
		new BMessage(MSG_METER_ENTRY), B_WILL_DRAW);

	fTempoEntry->SetDivider(70);

	if (fTempoRadios[4]->Value() == 1)
		fTempoEntry->SetEnabled(true);
	else
		fTempoEntry->SetEnabled(false);		

	fAccentsView = new BGroupView(B_HORIZONTAL, 0);

	BLayoutBuilder::Group<>(tempoBox, B_VERTICAL, 0)
		.SetInsets(10, tempoBox->TopBorderOffset() * 2 + 10, 10, 10)
		.AddGroup(B_HORIZONTAL, 0)
			.Add(fTempoRadios[0])
//.........这里部分代码省略.........
开发者ID:Barrett17,项目名称:Crono,代码行数:101,代码来源:CronoView.cpp

示例4: batteryRect

ExtendedInfoWindow::ExtendedInfoWindow(PowerStatusDriverInterface* interface)
	:
	BWindow(BRect(100, 150, 500, 500), "Extended battery info", B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT |
		B_ASYNCHRONOUS_CONTROLS),
	fDriverInterface(interface),
	fSelectedView(NULL)
{
	fDriverInterface->AcquireReference();

	BView *view = new BView(Bounds(), "view", B_FOLLOW_ALL, 0);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BGroupLayout* mainLayout = new BGroupLayout(B_VERTICAL);
	mainLayout->SetSpacing(10);
	mainLayout->SetInsets(10, 10, 10, 10);
	view->SetLayout(mainLayout);

	BRect rect = Bounds();
	rect.InsetBy(5, 5);
	BBox *infoBox = new BBox(rect, "Power status box");
	infoBox->SetLabel("Battery info");
	BGroupLayout* infoLayout = new BGroupLayout(B_HORIZONTAL);
	infoLayout->SetInsets(10, infoBox->TopBorderOffset() * 2 + 10, 10, 10);
	infoLayout->SetSpacing(10);
	infoBox->SetLayout(infoLayout);
	mainLayout->AddView(infoBox);

	BGroupView* batteryView = new BGroupView(B_VERTICAL);
	batteryView->GroupLayout()->SetSpacing(10);
	infoLayout->AddView(batteryView);

	// create before the battery views
	fBatteryInfoView = new BatteryInfoView();

	BGroupLayout* batteryLayout = batteryView->GroupLayout();
	BRect batteryRect(0, 0, 50, 30);
	for (int i = 0; i < interface->GetBatteryCount(); i++) {
		ExtPowerStatusView* view = new ExtPowerStatusView(interface,
			batteryRect, B_FOLLOW_NONE, i, this);
		view->SetExplicitMaxSize(BSize(70, 80));
		view->SetExplicitMinSize(BSize(70, 80));

		batteryLayout->AddView(view);
		fBatteryViewList.AddItem(view);
		fDriverInterface->StartWatching(view);
		if (!view->IsCritical())
			fSelectedView = view;
	}

	batteryLayout->AddItem(BSpaceLayoutItem::CreateGlue());

	infoLayout->AddView(fBatteryInfoView);

	if (!fSelectedView && fBatteryViewList.CountItems() > 0)
		fSelectedView = fBatteryViewList.ItemAt(0);
	fSelectedView->Select();

	BSize size = mainLayout->PreferredSize();
	ResizeTo(size.width, size.height);
}
开发者ID:mmanley,项目名称:Antares,代码行数:62,代码来源:ExtendedInfoWindow.cpp

示例5: BMessage


//.........这里部分代码省略.........

	rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
	fMultipleLaunchButton = new BRadioButton(rect, "multiple",
		"Multiple launch", new BMessage(kMsgAppFlagsChanged));
	fMultipleLaunchButton->ResizeToPreferred();
	box->AddChild(fMultipleLaunchButton);

	rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
	fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
		"Exclusive launch", new BMessage(kMsgAppFlagsChanged));
	fExclusiveLaunchButton->ResizeToPreferred();
	box->AddChild(fExclusiveLaunchButton);

	rect.top = fSingleLaunchButton->Frame().top;
	rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
	fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only",
		new BMessage(kMsgAppFlagsChanged));
	fArgsOnlyCheckBox->ResizeToPreferred();
	box->AddChild(fArgsOnlyCheckBox);

	rect.top += fArgsOnlyCheckBox->Bounds().Height();
	fBackgroundAppCheckBox = new BCheckBox(rect, "background",
		"Background app", new BMessage(kMsgAppFlagsChanged));
	fBackgroundAppCheckBox->ResizeToPreferred();
	box->AddChild(fBackgroundAppCheckBox);

	box->ResizeTo(box->Bounds().Width(),
		fExclusiveLaunchButton->Frame().bottom + 8.0f);

	// "Icon" group

	rect = box->Frame();
#ifdef __ANTARES__
	rect.top += box->TopBorderOffset();
#endif
	rect.left = rect.right + 8.0f;
	rect.right += width + 8.0f;
	float iconBoxWidth = rect.Width();
	box = new BBox(rect, NULL, B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	box->SetLabel("Icon");
#ifdef __ANTARES__
	box->MoveBy(0.0f, -box->TopBorderOffset());
	box->ResizeBy(0.0f, box->TopBorderOffset());
#endif
	topView->AddChild(box);

	rect = BRect(8.0f, 0.0f, 7.0f + B_LARGE_ICON, B_LARGE_ICON - 1.0f);
#ifdef __ANTARES__
	rect.OffsetBy(0.0f, (box->Bounds().Height() + box->TopBorderOffset()
		- rect.Height()) / 2.0f);
#else
	rect.OffsetBy(0.0f, (box->Bounds().Height() - rect.Height()) / 2.0f);
#endif
	if (rect.top < fontHeight.ascent + fontHeight.descent + 4.0f)
		rect.top = fontHeight.ascent + fontHeight.descent + 4.0f;
	fIconView = new IconView(rect, "icon");
	fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
	box->AddChild(fIconView);

	// "Supported Types" group

	rect.top = box->Frame().bottom + 8.0f;
	rect.bottom = rect.top + box->Bounds().Height();
	rect.left = 8.0f;
	rect.right = Bounds().Width() - 8.0f;
	BBox* typeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
开发者ID:mmanley,项目名称:Antares,代码行数:67,代码来源:ApplicationTypeWindow.cpp

示例6: screen


//.........这里部分代码省略.........

		message = new BMessage(POP_SWAP_DISPLAYS_MSG);
		message->AddBool("swap", true);
		fSwapDisplaysMenu->AddItem(new BMenuItem(B_TRANSLATE("yes"), message));

		fSwapDisplaysField = new BMenuField("SwapMenu",
			B_TRANSLATE("Swap displays:"), fSwapDisplaysMenu);

		if (!multiMonSupport)
			fSwapDisplaysField->Hide();

		fUseLaptopPanelMenu = new BPopUpMenu("UseLaptopPanel",
			true, true);

		// !order is important - we rely that boolean value == idx
		message = new BMessage(POP_USE_LAPTOP_PANEL_MSG);
		message->AddBool("use", false);
		fUseLaptopPanelMenu->AddItem(new BMenuItem(B_TRANSLATE("if needed"),
			message));

		message = new BMessage(POP_USE_LAPTOP_PANEL_MSG);
		message->AddBool("use", true);
		fUseLaptopPanelMenu->AddItem(new BMenuItem(B_TRANSLATE("always"),
			message));

		fUseLaptopPanelField = new BMenuField("UseLaptopPanel",
			B_TRANSLATE("Use laptop panel:"), fUseLaptopPanelMenu);

		if (!useLaptopPanelSupport)
			fUseLaptopPanelField->Hide();

		fTVStandardMenu = new BPopUpMenu("TVStandard", true, true);

		// arbitrary limit
		uint32 i;
		for (i = 0; i < 100; ++i) {
			uint32 mode;
			if (GetNthSupportedTVStandard(&screen, i, &mode) != B_OK)
				break;

			BString name = tv_standard_to_string(mode);

			message = new BMessage(POP_TV_STANDARD_MSG);
			message->AddInt32("tv_standard", mode);

			fTVStandardMenu->AddItem(new BMenuItem(name.String(), message));
		}

		fTVStandardField = new BMenuField("tv standard",
			B_TRANSLATE("Video format:"), fTVStandardMenu);
		fTVStandardField->SetAlignment(B_ALIGN_RIGHT);

		if (!tvStandardSupport || i == 0)
			fTVStandardField->Hide();
	}

	BLayoutBuilder::Group<>(outerControlsView)
		.AddGrid(5.0, 5.0)
			.AddMenuField(fResolutionField, 0, 0, B_ALIGN_RIGHT)
			.AddMenuField(fColorsField, 0, 1, B_ALIGN_RIGHT)
			.AddMenuField(fRefreshField, 0, 2, B_ALIGN_RIGHT)
			.AddMenuField(fCombineField, 0, 3, B_ALIGN_RIGHT)
			.AddMenuField(fSwapDisplaysField, 0, 4, B_ALIGN_RIGHT)
			.AddMenuField(fUseLaptopPanelField, 0, 5, B_ALIGN_RIGHT)
			.AddMenuField(fTVStandardField, 0, 6, B_ALIGN_RIGHT)
		.End();

	// TODO: we don't support getting the screen's preferred settings
	/* fDefaultsButton = new BButton(buttonRect, "DefaultsButton", "Defaults",
		new BMessage(BUTTON_DEFAULTS_MSG));*/

	fApplyButton = new BButton("ApplyButton", B_TRANSLATE("Apply"),
		new BMessage(BUTTON_APPLY_MSG));
	fApplyButton->SetEnabled(false);
	BLayoutBuilder::Group<>(outerControlsView)
		.AddGlue()
			.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fApplyButton);

	fRevertButton = new BButton("RevertButton", B_TRANSLATE("Revert"),
		new BMessage(BUTTON_REVERT_MSG));
	fRevertButton->SetEnabled(false);

	BLayoutBuilder::Group<>(this, B_VERTICAL, 10.0)
		.SetInsets(10, 10, 10, 10)
		.AddGroup(B_HORIZONTAL, 10.0)
			.AddGroup(B_VERTICAL)
				.AddStrut(floor(controlsBox->TopBorderOffset() / 16) - 1)
				.Add(screenBox)
			.End()
			.Add(controlsBox)
		.End()
		.AddGroup(B_HORIZONTAL, 10.0)
			.Add(fRevertButton)
			.AddGlue();

	_UpdateControls();
	_UpdateMonitor();
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:101,代码来源:ScreenWindow.cpp

示例7: BMessage

void
TouchpadPrefView::SetupView()
{
	SetLayout(new BGroupLayout(B_VERTICAL));
	BBox* scrollBox = new BBox("Touchpad");
	scrollBox->SetLabel(B_TRANSLATE("Scrolling"));

	fTouchpadView = new TouchpadView(BRect(0, 0, 130, 120));
	fTouchpadView->SetExplicitMaxSize(BSize(130, 120));

	// Create the "Mouse Speed" slider...
	fScrollAccelSlider = new BSlider("scroll_accel",
		B_TRANSLATE("Scroll acceleration"),
		new BMessage(SCROLL_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
	fScrollAccelSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fScrollAccelSlider->SetHashMarkCount(7);
	fScrollAccelSlider->SetLimitLabels(B_TRANSLATE("Slow"),
		B_TRANSLATE("Fast"));

	fScrollStepXSlider = new BSlider("scroll_stepX",
		B_TRANSLATE("Horizontal scroll speed"),
		new BMessage(SCROLL_CONTROL_CHANGED),
		0, 20, B_HORIZONTAL);
	fScrollStepXSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fScrollStepXSlider->SetHashMarkCount(7);
	fScrollStepXSlider->SetLimitLabels(B_TRANSLATE("Slow"),
		B_TRANSLATE("Fast"));

	fScrollStepYSlider = new BSlider("scroll_stepY",
		B_TRANSLATE("Vertical scroll speed"),
		new BMessage(SCROLL_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
	fScrollStepYSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fScrollStepYSlider->SetHashMarkCount(7);
	fScrollStepYSlider->SetLimitLabels(B_TRANSLATE("Slow"),
		B_TRANSLATE("Fast"));

	fTwoFingerBox = new BCheckBox(B_TRANSLATE("Two finger scrolling"),
		new BMessage(SCROLL_CONTROL_CHANGED));
	fTwoFingerHorizontalBox = new BCheckBox(
		B_TRANSLATE("Horizontal scrolling"),
		new BMessage(SCROLL_CONTROL_CHANGED));

	BGroupView* scrollPrefLeftLayout = new BGroupView(B_VERTICAL);
	BLayoutBuilder::Group<>(scrollPrefLeftLayout)
		.Add(fTouchpadView)
		.Add(fTwoFingerBox)
		.AddGroup(B_HORIZONTAL)
			.AddStrut(20)
			.Add(fTwoFingerHorizontalBox);

	BGroupView* scrollPrefRightLayout = new BGroupView(B_VERTICAL);
	scrollPrefRightLayout->AddChild(fScrollAccelSlider);
	scrollPrefRightLayout->AddChild(fScrollStepXSlider);
	scrollPrefRightLayout->AddChild(fScrollStepYSlider);

	BGroupLayout* scrollPrefLayout = new BGroupLayout(B_HORIZONTAL);
	scrollPrefLayout->SetSpacing(10);
	scrollPrefLayout->SetInsets(10, scrollBox->TopBorderOffset() * 2 + 10, 10,
		10);
	scrollBox->SetLayout(scrollPrefLayout);

	scrollPrefLayout->AddView(scrollPrefLeftLayout);
	scrollPrefLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(15));
	scrollPrefLayout->AddView(scrollPrefRightLayout);

	BBox* tapBox = new BBox("tapbox");
	tapBox->SetLabel(B_TRANSLATE("Tap gesture"));

	BGroupLayout* tapPrefLayout = new BGroupLayout(B_HORIZONTAL);
	tapPrefLayout->SetInsets(10, tapBox->TopBorderOffset() * 2 + 10, 10, 10);
	tapBox->SetLayout(tapPrefLayout);

	fTapSlider = new BSlider("tap_sens", B_TRANSLATE("Tap click sensitivity"),
		new BMessage(TAP_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
	fTapSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fTapSlider->SetHashMarkCount(7);
	fTapSlider->SetLimitLabels(B_TRANSLATE("Off"), B_TRANSLATE("High"));

	tapPrefLayout->AddView(fTapSlider);

	BGroupView* buttonView = new BGroupView(B_HORIZONTAL);
	fDefaultButton = new BButton(B_TRANSLATE("Defaults"),
		new BMessage(DEFAULT_SETTINGS));

	buttonView->AddChild(fDefaultButton);
	buttonView->GetLayout()->AddItem(
		BSpaceLayoutItem::CreateHorizontalStrut(7));
	fRevertButton = new BButton(B_TRANSLATE("Revert"),
		new BMessage(REVERT_SETTINGS));
	fRevertButton->SetEnabled(false);
	buttonView->AddChild(fRevertButton);
	buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

	BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
	layout->SetInsets(10, 10, 10, 10);
	layout->SetSpacing(10);
	BView* rootView = new BView("root view", 0, layout);
	AddChild(rootView);
	rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

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

示例8: BMessage

void
TouchpadPrefView::SetupView()
{
	SetLayout(new BGroupLayout(B_VERTICAL));
	BBox* scrollBox = new BBox("Touchpad");
	scrollBox->SetLabel(B_TRANSLATE("Scrolling"));

	fTouchpadView = new TouchpadView(BRect(0, 0, 130, 120));
	fTouchpadView->SetExplicitMaxSize(BSize(130, 120));

	// Create the "Mouse Speed" slider...
	fScrollAccelSlider = new BSlider("scroll_accel",
		B_TRANSLATE("Acceleration"),
		new BMessage(SCROLL_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
	fScrollAccelSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fScrollAccelSlider->SetHashMarkCount(7);
	fScrollAccelSlider->SetLimitLabels(B_TRANSLATE("Slow"),
		B_TRANSLATE("Fast"));
	fScrollAccelSlider->SetExplicitMinSize(BSize(150, B_SIZE_UNSET));

	fScrollStepXSlider = new BSlider("scroll_stepX",
		B_TRANSLATE("Horizontal"),
		new BMessage(SCROLL_CONTROL_CHANGED),
		0, 20, B_HORIZONTAL);
	fScrollStepXSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fScrollStepXSlider->SetHashMarkCount(7);
	fScrollStepXSlider->SetLimitLabels(B_TRANSLATE("Slow"),
		B_TRANSLATE("Fast"));

	fScrollStepYSlider = new BSlider("scroll_stepY",
		B_TRANSLATE("Vertical"),
		new BMessage(SCROLL_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
	fScrollStepYSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fScrollStepYSlider->SetHashMarkCount(7);
	fScrollStepYSlider->SetLimitLabels(B_TRANSLATE("Slow"),
		B_TRANSLATE("Fast"));

	fTwoFingerBox = new BCheckBox(B_TRANSLATE("Two finger scrolling"),
		new BMessage(SCROLL_CONTROL_CHANGED));
	fTwoFingerHorizontalBox = new BCheckBox(
		B_TRANSLATE("Horizontal scrolling"),
		new BMessage(SCROLL_CONTROL_CHANGED));

	float spacing = be_control_look->DefaultItemSpacing();

	BView* scrollPrefLeftLayout
		= BLayoutBuilder::Group<>(B_VERTICAL, 0)
		.Add(fTouchpadView)
		.AddStrut(spacing)
		.Add(fTwoFingerBox)
		.AddGroup(B_HORIZONTAL, 0)
			.AddStrut(spacing * 2)
			.Add(fTwoFingerHorizontalBox)
			.End()
		.AddGlue()
		.View();

	BGroupView* scrollPrefRightLayout = new BGroupView(B_VERTICAL);
	scrollPrefRightLayout->AddChild(fScrollAccelSlider);
	scrollPrefRightLayout->AddChild(fScrollStepXSlider);
	scrollPrefRightLayout->AddChild(fScrollStepYSlider);

	BGroupLayout* scrollPrefLayout = new BGroupLayout(B_HORIZONTAL);
	scrollPrefLayout->SetSpacing(spacing);
	scrollPrefLayout->SetInsets(spacing,
		scrollBox->TopBorderOffset() * 2 + spacing, spacing, spacing);
	scrollBox->SetLayout(scrollPrefLayout);

	scrollPrefLayout->AddView(scrollPrefLeftLayout);
	scrollPrefLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(spacing
		* 1.5));
	scrollPrefLayout->AddView(scrollPrefRightLayout);

	BBox* tapBox = new BBox("tapbox");
	tapBox->SetLabel(B_TRANSLATE("Tapping"));

	BGroupLayout* tapPrefLayout = new BGroupLayout(B_HORIZONTAL);
	tapPrefLayout->SetInsets(spacing, tapBox->TopBorderOffset() * 2 + spacing,
		spacing, spacing);
	tapBox->SetLayout(tapPrefLayout);

	fTapSlider = new BSlider("tap_sens", B_TRANSLATE("Sensitivity"),
		new BMessage(TAP_CONTROL_CHANGED), 0, spacing * 2, B_HORIZONTAL);
	fTapSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fTapSlider->SetHashMarkCount(7);
	fTapSlider->SetLimitLabels(B_TRANSLATE("Off"), B_TRANSLATE("High"));

	tapPrefLayout->AddView(fTapSlider);

	fDefaultButton = new BButton(B_TRANSLATE("Defaults"),
		new BMessage(DEFAULT_SETTINGS));

	fRevertButton = new BButton(B_TRANSLATE("Revert"),
		new BMessage(REVERT_SETTINGS));
	fRevertButton->SetEnabled(false);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.SetInsets(B_USE_WINDOW_SPACING)
		.Add(scrollBox)
		.Add(tapBox)
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:TouchpadPrefView.cpp


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