本文整理汇总了C++中BBox::SetLayout方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::SetLayout方法的具体用法?C++ BBox::SetLayout怎么用?C++ BBox::SetLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::SetLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
PoorManAdvancedView::PoorManAdvancedView(const char* name)
:
BView(name, B_WILL_DRAW, NULL)
{
PoorManWindow* win;
win = ((PoorManApplication*)be_app)->GetPoorManWindow();
BBox* connectionOptions = new BBox(B_TRANSLATE("Connections"));
connectionOptions->SetLabel(STR_BBX_CONNECTION);
fMaxConnections = new StatusSlider("Max Slider", STR_SLD_LABEL,
STR_SLD_STATUS_LABEL,
new BMessage(MSG_PREF_ADV_SLD_MAX_CONNECTION), 1, 200);
// labels below the slider 1 and 200
fMaxConnections->SetLimitLabels("1", "200");
SetMaxSimutaneousConnections(win->MaxConnections());
BGroupLayout* connectionOptionsLayout = new BGroupLayout(B_VERTICAL, 0);
connectionOptions->SetLayout(connectionOptionsLayout);
BLayoutBuilder::Group<>(this, B_VERTICAL)
.AddGroup(connectionOptionsLayout)
.SetInsets(B_USE_ITEM_INSETS)
.AddStrut(B_USE_ITEM_SPACING)
.Add(fMaxConnections)
.End()
.AddGlue()
.SetInsets(B_USE_ITEM_INSETS);
}
示例2: 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());
}
示例3: BMessage
VolumeWindow::VolumeWindow(BRect frame, bool dontBeep, int32 volumeWhich)
: BWindow(frame, "VolumeWindow", B_BORDERED_WINDOW_LOOK,
B_FLOATING_ALL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK
| B_AUTO_UPDATE_SIZE_LIMITS, 0),
fUpdatedCount(0)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
layout->SetInsets(5, 5, 5, 5);
BBox* box = new BBox("sliderbox");
box->SetLayout(layout);
box->SetBorder(B_PLAIN_BORDER);
AddChild(box);
BSlider* slider = new VolumeControl(volumeWhich, !dontBeep,
new BMessage(kMsgVolumeChanged));
slider->SetModificationMessage(new BMessage(kMsgVolumeUpdate));
box->AddChild(slider);
slider->SetTarget(this);
ResizeTo(300, 50);
// Make sure it's not outside the screen.
const int32 kMargin = 3;
BRect windowRect = Frame();
BRect screenFrame(BScreen(B_MAIN_SCREEN_ID).Frame());
if (screenFrame.right < windowRect.right + kMargin)
MoveBy(- kMargin - windowRect.right + screenFrame.right, 0);
if (screenFrame.bottom < windowRect.bottom + kMargin)
MoveBy(0, - kMargin - windowRect.bottom + screenFrame.bottom);
if (screenFrame.left > windowRect.left - kMargin)
MoveBy(kMargin + screenFrame.left - windowRect.left, 0);
if (screenFrame.top > windowRect.top - kMargin)
MoveBy(0, kMargin + screenFrame.top - windowRect.top);
}
示例4: 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++;
}
示例5: 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])
//.........这里部分代码省略.........
示例6: alignment
SettingsWindow::SettingsWindow(BRect frame)
:
BWindow(frame, B_TRANSLATE("MediaPlayer settings"), B_FLOATING_WINDOW_LOOK,
B_FLOATING_ALL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
{
const float kSpacing = be_control_look->DefaultItemSpacing();
BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, kSpacing / 2);
settingsBox->SetLayout(settingsLayout);
BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2);
buttonBox->SetLayout(buttonLayout);
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
B_TRANSLATE("Play mode"));
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
B_TRANSLATE("View options"));
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
B_TRANSLATE("Volume of background clips"));
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
playModeLabel->SetExplicitAlignment(alignment);
playModeLabel->SetFont(be_bold_font);
viewOptionsLabel->SetExplicitAlignment(alignment);
viewOptionsLabel->SetFont(be_bold_font);
bgMoviesModeLabel->SetExplicitAlignment(alignment);
bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart",
B_TRANSLATE("Automatically start playing"),
new BMessage(M_SETTINGS_CHANGED));
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
B_TRANSLATE("Close window after playing video"),
new BMessage(M_SETTINGS_CHANGED));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
B_TRANSLATE("Close window after playing audio"),
new BMessage(M_SETTINGS_CHANGED));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
B_TRANSLATE("Loop video"),
new BMessage(M_SETTINGS_CHANGED));
fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
B_TRANSLATE("Loop audio"),
new BMessage(M_SETTINGS_CHANGED));
fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
B_TRANSLATE("Use hardware video overlays if available"),
new BMessage(M_SETTINGS_CHANGED));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
B_TRANSLATE("Scale movies smoothly (non-overlay mode)"),
new BMessage(M_SETTINGS_CHANGED));
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
B_TRANSLATE("Scale controls in full screen mode"),
new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP = new BOptionPopUp("subtitleSize",
B_TRANSLATE("Subtitle size:"), new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Small"), mpSettings::SUBTITLE_SIZE_SMALL);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Medium"), mpSettings::SUBTITLE_SIZE_MEDIUM);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Large"), mpSettings::SUBTITLE_SIZE_LARGE);
fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement",
B_TRANSLATE("Subtitle placement:"), new BMessage(M_SETTINGS_CHANGED));
fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of video"),
mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO);
fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of screen"),
mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN);
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED));
fRevertB = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(M_SETTINGS_REVERT));
BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(M_SETTINGS_CANCEL));
BButton* okButton = new BButton("ok", B_TRANSLATE("OK"),
new BMessage(M_SETTINGS_SAVE));
okButton->MakeDefault(true);
// Build the layout
BGroupLayout* volumeGroup;
BGroupLayout* startGroup;
BGroupLayout* playGroup;
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.AddGroup(settingsLayout)
//.........这里部分代码省略.........
示例7: 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);
}
示例8: alignment
SettingsWindow::SettingsWindow(BRect frame)
: BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
B_FLOATING_APP_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
#ifdef __ANTARES__
| B_AUTO_UPDATE_SIZE_LIMITS)
#else
)
#endif
{
#ifdef __ANTARES__
BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, 5);
settingsBox->SetLayout(settingsLayout);
BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, 5);
buttonBox->SetLayout(buttonLayout);
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
"Play mode");
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
"View options");
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
"Play background clips at");
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
playModeLabel->SetExplicitAlignment(alignment);
playModeLabel->SetFont(be_bold_font);
viewOptionsLabel->SetExplicitAlignment(alignment);
viewOptionsLabel->SetFont(be_bold_font);
bgMoviesModeLabel->SetExplicitAlignment(alignment);
bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart",
"Automatically start playing", new BMessage(M_AUTOSTART));
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
"Close window when done playing movies",
new BMessage(M_CLOSE_WINDOW_MOVIE));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
"Close window when done playing sounds",
new BMessage(M_CLOSE_WINDOW_SOUNDS));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
"Loop movies by default", new BMessage(M_LOOP_MOVIE));
fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
"Loop sounds by default", new BMessage(M_LOOP_SOUND));
fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
"Use hardware video overlays if available",
new BMessage(M_USE_OVERLAYS));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
"Scale movies smoothly (non-overlay mode)",
new BMessage(M_SCALE_BILINEAR));
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Full volume", new BMessage(M_START_FULL_VOLUME));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
"Low volume", new BMessage(M_START_HALF_VOLUME));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Muted", new BMessage(M_START_MUTE_VOLUME));
fRevertB = new BButton("revert", "Revert",
new BMessage(M_SETTINGS_REVERT));
BButton* cancelButton = new BButton("cancel", "Cancel",
new BMessage(M_SETTINGS_CANCEL));
BButton* okButton = new BButton("ok", "OK",
new BMessage(M_SETTINGS_SAVE));
okButton->MakeDefault(true);
// Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(BGroupLayoutBuilder(settingsLayout)
.Add(playModeLabel)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(fAutostartCB)
.Add(BGridLayoutBuilder(5, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 0)
.Add(fCloseWindowMoviesCB, 1, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 1)
.Add(fCloseWindowSoundsCB, 1, 1)
)
.Add(fLoopMoviesCB)
.Add(fLoopSoundsCB)
)
)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
.Add(viewOptionsLabel)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
//.........这里部分代码省略.........
示例9: screen
ScreenWindow::ScreenWindow(ScreenSettings* settings)
:
BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Screen"),
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
| B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES),
fIsVesa(false),
fBootWorkspaceApplied(false),
fOtherRefresh(NULL),
fScreenMode(this),
fUndoScreenMode(this),
fModified(false)
{
BScreen screen(this);
accelerant_device_info info;
if (screen.GetDeviceInfo(&info) == B_OK
&& !strcasecmp(info.chipset, "VESA"))
fIsVesa = true;
_UpdateOriginal();
_BuildSupportedColorSpaces();
fActive = fSelected = fOriginal;
fSettings = settings;
// we need the "Current Workspace" first to get its height
BPopUpMenu *popUpMenu = new BPopUpMenu(B_TRANSLATE("Current workspace"),
true, true);
fAllWorkspacesItem = new BMenuItem(B_TRANSLATE("All workspaces"),
new BMessage(WORKSPACE_CHECK_MSG));
popUpMenu->AddItem(fAllWorkspacesItem);
BMenuItem *item = new BMenuItem(B_TRANSLATE("Current workspace"),
new BMessage(WORKSPACE_CHECK_MSG));
popUpMenu->AddItem(item);
fAllWorkspacesItem->SetMarked(true);
BMenuField* workspaceMenuField = new BMenuField("WorkspaceMenu", NULL,
popUpMenu);
workspaceMenuField->ResizeToPreferred();
// box on the left with workspace count and monitor view
BBox* screenBox = new BBox("screen box");
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 5.0);
layout->SetInsets(10, 10, 10, 10);
screenBox->SetLayout(layout);
fMonitorInfo = new BStringView("monitor info", "");
screenBox->AddChild(fMonitorInfo);
fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0),
"monitor", screen.Frame().IntegerWidth() + 1,
screen.Frame().IntegerHeight() + 1);
screenBox->AddChild(fMonitorView);
fColumnsControl = new BTextControl(B_TRANSLATE("Columns:"), "0",
new BMessage(kMsgWorkspaceColumnsChanged));
fRowsControl = new BTextControl(B_TRANSLATE("Rows:"), "0",
new BMessage(kMsgWorkspaceRowsChanged));
screenBox->AddChild(BLayoutBuilder::Grid<>(5.0, 5.0)
.Add(new BStringView("", B_TRANSLATE("Workspaces")), 0, 0, 3)
.AddTextControl(fColumnsControl, 0, 1, B_ALIGN_RIGHT)
.AddGroup(B_HORIZONTAL, 0, 2, 1)
.Add(_CreateColumnRowButton(true, false))
.Add(_CreateColumnRowButton(true, true))
.End()
.AddTextControl(fRowsControl, 0, 2, B_ALIGN_RIGHT)
.AddGroup(B_HORIZONTAL, 0, 2, 2)
.Add(_CreateColumnRowButton(false, false))
.Add(_CreateColumnRowButton(false, true))
.End()
.View());
fBackgroundsButton = new BButton("BackgroundsButton",
B_TRANSLATE("Set background" B_UTF8_ELLIPSIS),
new BMessage(BUTTON_LAUNCH_BACKGROUNDS_MSG));
fBackgroundsButton->SetFontSize(be_plain_font->Size() * 0.9);
screenBox->AddChild(fBackgroundsButton);
// box on the right with screen resolution, etc.
BBox* controlsBox = new BBox("controls box");
controlsBox->SetLabel(workspaceMenuField);
BGroupView* outerControlsView = new BGroupView(B_VERTICAL, 10.0);
outerControlsView->GroupLayout()->SetInsets(10, 10, 10, 10);
controlsBox->AddChild(outerControlsView);
fResolutionMenu = new BPopUpMenu("resolution", true, true);
uint16 maxWidth = 0;
uint16 maxHeight = 0;
uint16 previousWidth = 0;
uint16 previousHeight = 0;
for (int32 i = 0; i < fScreenMode.CountModes(); i++) {
screen_mode mode = fScreenMode.ModeAt(i);
if (mode.width == previousWidth && mode.height == previousHeight)
//.........这里部分代码省略.........
示例10: 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));
//.........这里部分代码省略.........
示例11: BMessage
AutomountSettingsPanel::AutomountSettingsPanel(BMessage* settings,
const BMessenger& target)
:
BBox("", B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_NO_BORDER),
fTarget(target)
{
const float spacing = be_control_look->DefaultItemSpacing();
// "Automatic Disk Mounting" group
BBox* autoMountBox = new BBox("autoMountBox", B_WILL_DRAW | B_FRAME_EVENTS
| B_PULSE_NEEDED | B_NAVIGABLE_JUMP);
autoMountBox->SetLabel(B_TRANSLATE("Automatic disk mounting"));
BGroupLayout* autoMountLayout = new BGroupLayout(B_VERTICAL, 0);
autoMountBox->SetLayout(autoMountLayout);
autoMountLayout->SetInsets(spacing,
autoMountBox->InnerFrame().top + spacing / 2, spacing, spacing);
fScanningDisabledCheck = new BRadioButton("scanningOff",
B_TRANSLATE("Don't automount"),
new BMessage(kAutomountSettingsChanged));
fAutoMountAllBFSCheck = new BRadioButton("autoBFS",
B_TRANSLATE("All BeOS disks"), new BMessage(kAutomountSettingsChanged));
fAutoMountAllCheck = new BRadioButton("autoAll",
B_TRANSLATE("All disks"), new BMessage(kAutomountSettingsChanged));
// "Disk Mounting During Boot" group
BBox* bootMountBox = new BBox("", B_WILL_DRAW | B_FRAME_EVENTS
| B_PULSE_NEEDED | B_NAVIGABLE_JUMP);
bootMountBox->SetLabel(B_TRANSLATE("Disk mounting during boot"));
BGroupLayout* bootMountLayout = new BGroupLayout(B_VERTICAL, 0);
bootMountBox->SetLayout(bootMountLayout);
bootMountLayout->SetInsets(spacing,
bootMountBox->InnerFrame().top + spacing / 2, spacing, spacing);
fInitialDontMountCheck = new BRadioButton("initialNone",
B_TRANSLATE("Only the boot disk"),
new BMessage(kBootMountSettingsChanged));
fInitialMountRestoreCheck = new BRadioButton("initialRestore",
B_TRANSLATE("Previously mounted disks"),
new BMessage(kBootMountSettingsChanged));
fInitialMountAllBFSCheck = new BRadioButton("initialBFS",
B_TRANSLATE("All BeOS disks"),
new BMessage(kBootMountSettingsChanged));
fInitialMountAllCheck = new BRadioButton("initialAll",
B_TRANSLATE("All disks"), new BMessage(kBootMountSettingsChanged));
fEjectWhenUnmountingCheckBox = new BCheckBox("ejectWhenUnmounting",
B_TRANSLATE("Eject when unmounting"),
new BMessage(kEjectWhenUnmountingChanged));
// Buttons
fDone = new BButton(B_TRANSLATE("Done"), new BMessage(B_QUIT_REQUESTED));
fMountAllNow = new BButton("mountAll", B_TRANSLATE("Mount all disks now"),
new BMessage(kMountAllNow));
fDone->MakeDefault(true);
// Layout the controls
BGroupView* contentView = new BGroupView(B_VERTICAL, 0);
AddChild(contentView);
BLayoutBuilder::Group<>(contentView)
.AddGroup(B_VERTICAL, spacing)
.SetInsets(spacing, spacing, spacing, spacing)
.AddGroup(autoMountLayout)
.Add(fScanningDisabledCheck)
.Add(fAutoMountAllBFSCheck)
.Add(fAutoMountAllCheck)
.End()
.AddGroup(bootMountLayout)
.Add(fInitialDontMountCheck)
.Add(fInitialMountRestoreCheck)
.Add(fInitialMountAllBFSCheck)
.Add(fInitialMountAllCheck)
.End()
.AddGroup(B_HORIZONTAL)
.AddStrut(spacing - 1)
.Add(fEjectWhenUnmountingCheckBox)
.End()
.End()
.Add(new BSeparatorView(B_HORIZONTAL/*, B_FANCY_BORDER*/))
.AddGroup(B_HORIZONTAL, spacing)
.SetInsets(0, spacing, spacing, spacing)
.AddGlue()
.Add(fMountAllNow)
.Add(fDone);
// Apply the settings
bool result;
if (settings->FindBool("autoMountAll", &result) == B_OK && result)
fAutoMountAllCheck->SetValue(B_CONTROL_ON);
//.........这里部分代码省略.........
示例12: BBox
/*! \function CalendarModulePreferences::CreateWeekendSelectionBox
* \brief Create box for selection of the weekend days
* \note Additionally, select the color for weekends and weekdays
* \param[in] frame Enclosing rectangle.
* \param[in] label Reference to label of the enclosing BBox.
* \param[in] calModule The calendar module for which the preferences are set.
*/
void CalendarModulePreferences::CreateWeekendSelectionBox( BRect frame,
BString &label,
CalendarModule* calModule )
{
/*! \par Notes on implementation:
* It's not all that straightforward - to create this selection box.
* The problem is that number of days in week is dependent on the
* Calendar Module, therefore the frame rectangle must be divided
* properly. We should take into account the possibility that there's
* not enough place for all days in the submitted frame.
*
* \par
* The solution will be as follows:
* Let number of days in week be N. I create two columns and
* several rows (the number depends on N). Days in week will be
* proceeded in the order <em>as Calendar Module supplies them</em>.
* The days occupy both columns, and are located in rows
* [0, (ceiling of (N/2)) ). Days returned from CalendarModule are
* placed as follows: days from 0 to (ceiling of (N/2)-1) in the left
* column, days from (ceiling of (N/2)-1) to (N-1) in right column.
*
* \par
* Two controls for setting the colors of weekdays and weekends
* are located at the bottom row of the grid; weekdays on right,
* weekends on left.
*
* \par
* There will be an empty cell in the right column, if number
* of days in week is odd.
*/
BMessage* toSend = NULL;
BCheckBox* dayCheckBox = NULL;
BString tempString;
/* indexX is 0 for left column or 1 for right column.
* indexY is 0 for topmost row, 1 for second from top row, etc.
* Max value for indexY = (ceiling of (N/2)).
*/
int indexX, indexY;
// Prepare the item to be returned
BBox* enclosingBox = new BBox( frame, "Weekend selector" );
if ( !enclosingBox )
{
/* Panic! */
exit(1);
}
// Prepare the layout to be used
BGridLayout* layout = new BGridLayout();
if ( !layout)
{
/* Panic! */
exit(1);
}
enclosingBox->SetLayout( layout );
// Get the data on days of week
unsigned int daysInWeek = (unsigned int)( calModule->GetDaysInWeek() );
map<uint32, DoubleNames> weekdayNames = calModule->GetWeekdayNames();
indexX = indexY = 0;
for (unsigned char day = 0; day < daysInWeek; ++day )
{
/* Creating the message to be sent */
toSend = new BMessage( kCalendarModuleWeekendDaySelected );
if ( !toSend )
{
/* Panic! */
exit(1);
}
toSend->AddInt32( "Weekday no", day );
/* Obtain the name of the day. I use the long name. */
tempString = (DoubleNames)weekdayNames[ day ].longName;
/* Creating the checkbox */
dayCheckBox = new BCheckBox( BRect(0, 0, 1, 1),
"Weekday",
tempString.String(),
toSend );
if (!dayCheckBox)
{
// Panic!
exit(1);
}
dayCheckBox->ResizeToPreferred();
/* Adding the item to the BBox */
layout->AddView( dayCheckBox, indexX, indexY );
/* Advancing to the next cell in grid */
//.........这里部分代码省略.........
示例13: setSize
/*! \brief Add the interface for configuring colors.
* \param[in] frame The frame of the view.
* \param[in] id The ID of the interface to configure the colors for.
*/
BBox* CalendarModulePreferencesView::BuildColorSelectors( BRect frame,
const BString& id )
{
BBox* toReturn = NULL;
BLayoutItem* layoutItem = NULL;
BString sb;
BRect tempRect = frame;
// tempRect.InsetBySelf( 10, 10 );
BMessage* toSend = NULL;
// Access the preferences
CalendarModulePreferences* prefs = pref_GetPreferencesForCalendarModule( id );
if ( !prefs ) {
return NULL;
}
// Prepare the overall BBox
toReturn = new BBox( frame, "Color selector" );
if ( ! toReturn )
return NULL;
toReturn->SetLabel( "Set up colors" );
// Set up the layout for this BBox
BGroupLayout* groupLayout = new BGroupLayout( B_VERTICAL );
if ( !groupLayout ) {
delete toReturn;
return NULL;
}
groupLayout->SetInsets( 10, 15, 10, 5 );
groupLayout->SetSpacing( 2 );
toReturn->SetLayout( groupLayout );
// Label over the CategoryListView for the viewer
BStringView* viewerString = new BStringView( BRect( 0, 0, 1, 1 ),
"Colors Changer Explanation",
"Double-click the color to edit it." );
if ( !viewerString )
{
delete toReturn;
return NULL;
}
viewerString->ResizeToPreferred();
layoutItem = groupLayout->AddView( 0, viewerString, 0 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );
toSend = new BMessage( kCategoryInvoked );
if ( !toSend )
{
/* Panic! */
exit( 1 );
}
toSend->AddString( "Calendar module", id );
CategoryListView* menuColors = new CategoryListView( BRect( 0,
0,
tempRect.Width() + B_V_SCROLL_BAR_WIDTH,
tempRect.Height() + B_H_SCROLL_BAR_HEIGHT ),
"Colors list view" );
if ( !menuColors ) {
// menuString->RemoveSelf(); delete menuString;
// viewerString->RemoveSelf(); delete viewerString;
delete toReturn; return NULL;
}
menuColors->SetInvocationMessage( toSend );
// Fill the CategoryListView for the menu colors
sb.SetTo( "Color for displaying weekdays in the controls" );
CategoryListItem* toAdd = new CategoryListItem( prefs->GetWeekdaysColor( false ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying weekends in the controls" );
toAdd = new CategoryListItem( prefs->GetWeekendsColor( false ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying weekdays in Viewer" );
toAdd = new CategoryListItem( prefs->GetWeekdaysColor( true ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying weekends in Viewer" );
toAdd = new CategoryListItem( prefs->GetWeekendsColor( true ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying service items in the controls" );
toAdd = new CategoryListItem( prefs->GetServiceItemsColor( false ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
//.........这里部分代码省略.........
示例14: DebuggerPrintout
/*!
* \brief Create box for selection of the weekend days
* \note Additionally, select the color for weekends and weekdays
* \param[in] frame Enclosing rectangle.
* \param[in] id Reference to name of the selected Calendar module.
* \returns Pointer to all-set-up BBox. Or NULL in case of error.
*/
BBox* CalendarModulePreferencesView::CreateWeekendSelectionBox( BRect frame,
const BString &id )
{
/*! \par Notes on implementation:
* It's not all that straightforward - to create this selection box.
* The problem is that number of days in week is dependent on the
* Calendar Module, therefore the frame rectangle must be divided
* properly. We should take into account the possibility that there's
* not enough place for all days in the submitted frame.
*
* \par
* The solution will be as follows:
* Let number of days in week be N. I create two columns and
* several rows (the number depends on N). Days in week will be
* proceeded in the order <em>as Calendar Module supplies them</em>.
* The days occupy both columns, and are located in rows
* [0, (ceiling of (N/2)) ). Days returned from CalendarModule are
* placed as follows: days from 0 to (ceiling of (N/2)-1) in the left
* column, days from (ceiling of (N/2)-1) to (N-1) in right column.
*
* \par
* There will be an empty cell in the right column, if number
* of days in week is odd, (which is usually the case).
*/
frame.InsetBySelf( 5, 0 );
BMessage* toSend = NULL;
BCheckBox* dayCheckBox = NULL;
BString tempString;
BLayoutItem* layoutItem = NULL;
CalendarModulePreferences* prefs = NULL;
CalendarModule* calModule = NULL;
int height = 0; //!< this is used to resize the BBox to proper size
calModule = utl_FindCalendarModule( id );
if ( calModule == NULL ) {
/* Error */
utl_Deb = new DebuggerPrintout( "Did not succeed to find the calendar module." );
return NULL;
}
// Get the data on days of week
uint32 daysInWeek = ( uint32 )( calModule->GetDaysInWeek() );
map<uint32, DoubleNames> weekdayNames = calModule->GetWeekdayNames();
/* Obtain the current Calendar Module preferences */
prefs = pref_GetPreferencesForCalendarModule( id );
if ( !prefs ) {
utl_Deb = new DebuggerPrintout( "Did not succeed to find the preferences for the calendar module." );
return NULL;
}
// At this point, "pref" points to current preferences of this calendar module.
BList* weekends = prefs->GetWeekends(); // Get info on currently selected weekends
// Prepare the item to be returned
BBox* enclosingBox = new BBox( frame, "Weekend selector" );
if ( !enclosingBox )
{
/* Panic! */
exit(1);
}
enclosingBox->SetLabel( "Select the non-working days (weekends)" );
// Prepare the layout to be used
BGridLayout* layout = new BGridLayout();
if ( !layout)
{
/* Panic! */
exit(1);
}
enclosingBox->SetLayout( layout );
layout->SetInsets( 10, 15, 10, 5 );
layout->SetVerticalSpacing( 1 );
/* indexX is 0 for left column or 1 for right column.
* indexY is 0 for topmost row, 1 for second from top row, etc.
* Max value for indexY = (ceiling of (N/2)).
*/
int indexX = 0, indexY = 0;
for (uint32 day = prefs->GetFirstDayOfWeek(), i = 0; i < ( uint32 )daysInWeek; ++i )
{
/* Creating the message to be sent */
toSend = new BMessage( kCalendarModuleWeekendDaySelected );
if ( !toSend )
{
/* Panic! */
exit(1);
}
toSend->AddInt32( "Weekday const", day );
toSend->AddString( "Calendar module", id );
//.........这里部分代码省略.........
示例15: 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)
//.........这里部分代码省略.........