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


C++ BGroupView::GetLayout方法代码示例

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


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

示例1: 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


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