本文整理汇总了C++中BGroupView::GroupLayout方法的典型用法代码示例。如果您正苦于以下问题:C++ BGroupView::GroupLayout方法的具体用法?C++ BGroupView::GroupLayout怎么用?C++ BGroupView::GroupLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BGroupView
的用法示例。
在下文中一共展示了BGroupView::GroupLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BTextView
void
DataTranslationsWindow::_ShowInfoView()
{
if (fConfigView != NULL) {
fRightBox->RemoveChild(fConfigView);
delete fConfigView;
fConfigView = NULL;
fInfoText = NULL;
if (fRelease != NULL) {
fRelease->Release();
fRelease = NULL;
}
}
fInfoText = new BTextView("info text");
fInfoText->MakeEditable(false);
fInfoText->MakeSelectable(false);
fInfoText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fInfoText->SetText(B_TRANSLATE(
"Use this control panel to set default values for translators, "
"to be used when no other settings are specified by an application."));
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
fInfoText->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
BGroupView* group = new BGroupView(B_VERTICAL);
group->AddChild(fInfoText);
float spacing = be_control_look->DefaultItemSpacing();
group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
fRightBox->AddChild(group);
fConfigView = group;
}
示例2: BTextView
void
DataTranslationsWindow::_ShowInfoView()
{
if (fConfigView) {
fRightBox->RemoveChild(fConfigView);
delete fConfigView;
fConfigView = NULL;
}
BTextView* view = new BTextView("info text");
view->MakeEditable(false);
view->MakeSelectable(false);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetText(B_TRANSLATE(
"Use this control panel to set default values for translators, "
"to be used when no other settings are specified by an application."));
BGroupView* group = new BGroupView(B_VERTICAL);
group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
group->AddChild(view);
float spacing = be_control_look->DefaultItemSpacing();
group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
fRightBox->AddChild(group);
fConfigView = group;
}
示例3: BGroupView
bool
ResultWindow::AddLocationChanges(const char* location,
const PackageList& packagesToInstall,
const PackageSet& packagesAlreadyAdded,
const PackageList& packagesToUninstall,
const PackageSet& packagesAlreadyRemoved)
{
BGroupView* locationGroup = new BGroupView(B_VERTICAL);
ObjectDeleter<BGroupView> locationGroupDeleter(locationGroup);
locationGroup->GroupLayout()->SetInsets(B_USE_SMALL_INSETS);
rgb_color background = ui_color(B_LIST_BACKGROUND_COLOR);
if ((fContainerView->CountChildren() & 1) != 0)
background = tint_color(background, 1.04);
locationGroup->SetViewColor(background);
BStringView* locationView = new BStringView(NULL,
BString().SetToFormat("in %s:", location));
locationGroup->AddChild(locationView);
locationView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BFont locationFont;
locationView->GetFont(&locationFont);
locationFont.SetFace(B_BOLD_FACE);
locationView->SetFont(&locationFont);
BGroupLayout* packagesGroup = new BGroupLayout(B_VERTICAL);
locationGroup->GroupLayout()->AddItem(packagesGroup);
packagesGroup->SetInsets(20, 0, 0, 0);
bool packagesAdded = _AddPackages(packagesGroup, packagesToInstall,
packagesAlreadyAdded, true);
packagesAdded |= _AddPackages(packagesGroup, packagesToUninstall,
packagesAlreadyRemoved, false);
if (!packagesAdded)
return false;
fContainerView->AddChild(locationGroup);
locationGroupDeleter.Detach();
return true;
}
示例4: BMessage
NetworkView::NetworkView()
:
BView("NetworkView", 0, NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// build the GUI
BGroupLayout* rootLayout = new BGroupLayout(B_VERTICAL);
SetLayout(rootLayout);
//BGridView* controlsGroup = new BGridView();
//BGridLayout* layout = controlsGroup->GridLayout();
// insets
/*
float inset = ceilf(be_plain_font->Size() * 0.7);
rootLayout->SetInsets(inset, inset, inset, inset);
rootLayout->SetSpacing(inset);
layout->SetSpacing(inset, inset);
*/
// available network lists
// button group
BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL);
fRefreshButton = new BButton(B_TRANSLATE("Refresh"),
new BMessage(kMsgRefresh));
fRefreshButton->SetEnabled(false);
buttonGroup->GroupLayout()->AddView(fRefreshButton);
buttonGroup->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
fNewNetworkButton = new BButton(B_TRANSLATE("New Network"), new BMessage(kMsgNewNetwork));
fNewNetworkButton->SetEnabled(false);
buttonGroup->GroupLayout()->AddView(fNewNetworkButton);
//rootLayout->AddView(controlsGroup);
rootLayout->AddView(buttonGroup);
}
示例5: BStringView
Window::Window()
:
BWindow(BRect(100, 100, 520, 430), "ToolTip-Test",
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
BView* simple = new BStringView("1", "Simple Tool Tip");
simple->SetToolTip("This is a really\nsimple tool tip!");
BView* custom = new BStringView("2", "Custom Tool Tip");
custom->SetToolTip(new CustomToolTip("Custom tool tip!"));
BView* changing = new BStringView("3", "Changing Tool Tip");
changing->SetToolTip(new ChangingToolTip());
BView* mouse = new BStringView("4", "Mouse Tool Tip (sticky)");
mouse->SetToolTip(new MouseToolTip());
BView* immediate = new ImmediateView("5", "Immediate Tool Tip (sticky)");
BView* pulseString = new PulseStringView("pulseString",
"Periodically changing tool tip text");
BView* pulseToolTip = new PulseToolTipView("pulseToolTip",
"Periodically changing tool tip");
BGroupView* nested = new BGroupView();
nested->SetViewColor(50, 50, 90);
nested->GroupLayout()->SetInsets(30);
nested->SetToolTip("The outer view has a tool tip,\n"
"the inner one doesn't.");
nested->AddChild(new BGroupView("inner"));
BLayoutBuilder::Group<>(this, B_HORIZONTAL)
.SetInsets(B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL)
.Add(simple)
.Add(custom)
.Add(changing)
.Add(mouse)
.Add(immediate)
.End()
.AddGroup(B_VERTICAL)
.Add(pulseString)
.Add(pulseToolTip)
.Add(nested);
SetPulseRate(1000000LL);
}
示例6: new
// AddGroup
BGroupLayoutBuilder&
BGroupLayoutBuilder::AddGroup(enum orientation orientation,
float spacing, float weight)
{
if (BGroupLayout* layout = TopLayout()) {
BGroupView* group = new(nothrow) BGroupView(orientation, spacing);
if (group) {
if (layout->AddView(group, weight))
_PushLayout(group->GroupLayout());
else
delete group;
}
}
return *this;
}
示例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: BMessage
KeyRequestView()
:
BView("KeyRequestView", B_WILL_DRAW),
fPassword(NULL)
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupLayout* rootLayout = new(std::nothrow) BGroupLayout(B_VERTICAL);
if (rootLayout == NULL)
return;
SetLayout(rootLayout);
BGridView* controls = new(std::nothrow) BGridView();
if (controls == NULL)
return;
BGridLayout* layout = controls->GridLayout();
float inset = ceilf(be_plain_font->Size() * 0.7);
rootLayout->SetInsets(inset, inset, inset, inset);
rootLayout->SetSpacing(inset);
layout->SetSpacing(inset, inset);
BStringView* label = new(std::nothrow) BStringView("keyringLabel",
B_TRANSLATE("Keyring:"));
if (label == NULL)
return;
int32 row = 0;
layout->AddView(label, 0, row);
fKeyringName = new(std::nothrow) BStringView("keyringName", "");
if (fKeyringName == NULL)
return;
layout->AddView(fKeyringName, 1, row++);
fPassword = new(std::nothrow) BTextControl(B_TRANSLATE("Password:"), "", NULL);
if (fPassword == NULL)
return;
BLayoutItem* layoutItem = fPassword->CreateTextViewLayoutItem();
layoutItem->SetExplicitMinSize(BSize(fPassword->StringWidth(
"0123456789012345678901234567890123456789") + inset,
B_SIZE_UNSET));
layout->AddItem(fPassword->CreateLabelLayoutItem(), 0, row);
layout->AddItem(layoutItem, 1, row++);
BGroupView* buttons = new(std::nothrow) BGroupView(B_HORIZONTAL);
if (buttons == NULL)
return;
fCancelButton = new(std::nothrow) BButton(B_TRANSLATE("Cancel"),
new BMessage(kMessageCancel));
buttons->GroupLayout()->AddView(fCancelButton);
buttons->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
fUnlockButton = new(std::nothrow) BButton(B_TRANSLATE("Unlock"),
new BMessage(kMessageUnlock));
buttons->GroupLayout()->AddView(fUnlockButton);
BTextView* message = new(std::nothrow) BTextView("message");
message->SetText(B_TRANSLATE("An application wants to access the "
"keyring below, but it is locked with a passphrase. Please enter "
"the passphrase to unlock the keyring.\n"
"If you unlock the keyring, it stays unlocked until the system is "
"shut down or the keyring is manually locked again.\n"
"If you cancel this dialog the keyring will remain locked."));
message->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
message->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
message->MakeEditable(false);
message->MakeSelectable(false);
message->SetWordWrap(true);
rootLayout->AddView(message);
rootLayout->AddView(controls);
rootLayout->AddView(buttons);
}
示例9: SetLayout
void
MainWindow::_CreateGUI()
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
BGridLayout* layout = new BGridLayout();
layout->SetSpacing(0, 0);
BView* rootView = new BView("root view", 0, layout);
AddChild(rootView);
rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BGroupView* leftTopView = new BGroupView(B_VERTICAL, 0);
layout->AddView(leftTopView, 0, 0);
// views along the left side
leftTopView->AddChild(_CreateMenuBar());
float splitWidth = 13 * be_plain_font->Size();
BSize minSize = leftTopView->MinSize();
splitWidth = std::max(splitWidth, minSize.width);
leftTopView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));
leftTopView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET));
BGroupView* iconPreviews = new BGroupView(B_HORIZONTAL);
iconPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
iconPreviews->GroupLayout()->SetSpacing(5);
// icon previews
fIconPreview16Folder = new IconView(BRect(0, 0, 15, 15),
"icon preview 16 folder");
fIconPreview16Menu = new IconView(BRect(0, 0, 15, 15),
"icon preview 16 menu");
fIconPreview16Menu->SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR));
fIconPreview32Folder = new IconView(BRect(0, 0, 31, 31),
"icon preview 32 folder");
fIconPreview32Desktop = new IconView(BRect(0, 0, 31, 31),
"icon preview 32 desktop");
fIconPreview32Desktop->SetLowColor(ui_color(B_DESKTOP_COLOR));
fIconPreview64 = new IconView(BRect(0, 0, 63, 63), "icon preview 64");
fIconPreview64->SetLowColor(ui_color(B_DESKTOP_COLOR));
BGroupView* smallPreviews = new BGroupView(B_VERTICAL);
smallPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
smallPreviews->GroupLayout()->SetSpacing(5);
smallPreviews->AddChild(fIconPreview16Folder);
smallPreviews->AddChild(fIconPreview16Menu);
BGroupView* mediumPreviews = new BGroupView(B_VERTICAL);
mediumPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
mediumPreviews->GroupLayout()->SetSpacing(5);
mediumPreviews->AddChild(fIconPreview32Folder);
mediumPreviews->AddChild(fIconPreview32Desktop);
// iconPreviews->AddChild(fIconPreview48);
iconPreviews->AddChild(smallPreviews);
iconPreviews->AddChild(mediumPreviews);
iconPreviews->AddChild(fIconPreview64);
iconPreviews->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNLIMITED));
leftTopView->AddChild(iconPreviews);
BGroupView* leftSideView = new BGroupView(B_VERTICAL, 0);
layout->AddView(leftSideView, 0, 1);
leftSideView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));
// path menu and list view
BMenuBar* menuBar = new BMenuBar("path menu bar");
menuBar->AddItem(fPathMenu);
leftSideView->AddChild(menuBar);
fPathListView = new PathListView(BRect(0, 0, splitWidth, 100),
"path list view", new BMessage(MSG_PATH_SELECTED), this);
BView* scrollView = new BScrollView("path list scroll view",
fPathListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
leftSideView->AddChild(scrollView);
// shape list view
menuBar = new BMenuBar("shape menu bar");
menuBar->AddItem(fShapeMenu);
leftSideView->AddChild(menuBar);
fShapeListView = new ShapeListView(BRect(0, 0, splitWidth, 100),
"shape list view", new BMessage(MSG_SHAPE_SELECTED), this);
scrollView = new BScrollView("shape list scroll view",
fShapeListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
leftSideView->AddChild(scrollView);
// transformer list view
menuBar = new BMenuBar("transformer menu bar");
menuBar->AddItem(fTransformerMenu);
leftSideView->AddChild(menuBar);
//.........这里部分代码省略.........
示例10: BMessage
BSCWindow::BSCWindow()
:
BDirectWindow(kWindowRect, "BeScreenCapture", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS|B_AUTO_UPDATE_SIZE_LIMITS),
fController(dynamic_cast<Controller*>(gControllerLooper)),
fCapturing(false)
{
OutputView *outputView
= new OutputView(fController);
AdvancedOptionsView *advancedView
= new AdvancedOptionsView(fController);
fStartStopButton = new BButton("Start", "Start Recording",
new BMessage(kMsgGUIStartCapture));
fStartStopButton->SetTarget(fController);
fStartStopButton->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_MIDDLE));
fCardLayout = new BCardLayout();
BView* cardsView = new BView("status", 0, fCardLayout);
cardsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fCardLayout->AddView(fCamStatus = new CamStatusView("CamStatusView"));
fCamStatus->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
BView* statusView = BLayoutBuilder::Group<>()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.Add(fStringView = new BStringView("stringview", kEncodingString))
.Add(fStatusBar = new BStatusBar("", ""))
.End()
.View();
statusView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fStatusBar->SetExplicitMinSize(BSize(100, 20));
fCardLayout->AddView(statusView);
BLayoutBuilder::Group<>(this, B_VERTICAL)
.AddGroup(B_VERTICAL, 1)
.SetInsets(B_USE_DEFAULT_SPACING, 1,
B_USE_DEFAULT_SPACING, 1)
.Add(fTabView = new BTabView("Tab View", B_WIDTH_FROM_LABEL))
.AddGroup(B_HORIZONTAL)
.Add(cardsView)
.Add(fStartStopButton)
.End()
.End();
fCardLayout->SetVisibleItem((int32)0);
BGroupView* outputGroup = new BGroupView(B_HORIZONTAL);
outputGroup->SetName("Output");
outputGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
fTabView->AddTab(outputGroup);
BLayoutBuilder::Group<>(outputGroup)
.Add(outputView);
BGroupView* advancedGroup = new BGroupView(B_HORIZONTAL);
advancedGroup->SetName("Advanced Options");
advancedGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
fTabView->AddTab(advancedGroup);
BLayoutBuilder::Group<>(advancedGroup)
.Add(advancedView);
if (fController->LockLooper()) {
// controller should watch for these messages
//StartWatching(fController, kMsgGUIStartCapture);
//StartWatching(fController, kMsgGUIStopCapture);
StartWatching(fController, kSelectionWindowClosed);
advancedView->StartWatching(fController, kClipSizeChanged);
//StartWatching(fCamStatus, kMsgControllerCaptureResumed);
// watch Controller for these
fController->StartWatching(this, B_UPDATE_STATUS_BAR);
fController->StartWatching(this, B_RESET_STATUS_BAR);
fController->StartWatching(this, kMsgControllerEncodeStarted);
fController->StartWatching(this, kMsgControllerEncodeProgress);
fController->StartWatching(this, kMsgControllerEncodeFinished);
fController->StartWatching(this, kMsgControllerTargetFrameChanged);
fController->StartWatching(this, kMsgControllerCaptureStarted);
fController->StartWatching(this, kMsgControllerCaptureStopped);
fController->StartWatching(fCamStatus, kMsgControllerCaptureStarted);
fController->StartWatching(fCamStatus, kMsgControllerCaptureStopped);
fController->StartWatching(fCamStatus, kMsgControllerCapturePaused);
fController->StartWatching(fCamStatus, kMsgControllerCaptureResumed);
fController->StartWatching(outputView, kMsgControllerTargetFrameChanged);
fController->StartWatching(outputView, kMsgControllerCodecListUpdated);
fController->UnlockLooper();
}
StartWatching(outputView, kSelectionWindowClosed);
StartWatching(outputView, kClipSizeChanged);
CenterOnScreen();
//.........这里部分代码省略.........
示例11: BMessage
TransportControlGroup::TransportControlGroup(BRect frame,
bool usePlaybackFrame, bool useSkipButtons, bool usePeakView,
bool useWindButtons, bool useSeekSlider)
:
BGroupView(B_VERTICAL, 0),
fSeekSlider(NULL),
fPeakView(NULL),
fPlaybackFrame(NULL),
fVolumeSlider(NULL),
fSkipBack(NULL),
fSkipForward(NULL),
fRewind(NULL),
fForward(NULL),
fPlayPause(NULL),
fStop(NULL),
fMute(NULL),
fSeekLayout(NULL),
fControlLayout(NULL),
fSymbolScale(0.0f)
{
// Seek slider
if (useSeekSlider) {
BGroupView* seekGroup = new BGroupView(B_HORIZONTAL, 0);
fSeekLayout = seekGroup->GroupLayout();
GroupLayout()->AddView(seekGroup);
fSeekSlider = new SeekSlider("seek slider", new BMessage(MSG_SEEK),
0, 10000);
fSeekLayout->AddView(fSeekSlider);
}
// Buttons
uint32 topBottomBorder = BControlLook::B_TOP_BORDER
| BControlLook::B_BOTTOM_BORDER;
if (useSkipButtons) {
// Skip Back
fSkipBack = new SymbolButton(B_EMPTY_STRING, NULL,
new BMessage(MSG_SKIP_BACKWARDS),
BControlLook::B_LEFT_BORDER | topBottomBorder);
// Skip Foward
fSkipForward = new SymbolButton(B_EMPTY_STRING, NULL,
new BMessage(MSG_SKIP_FORWARD),
BControlLook::B_RIGHT_BORDER | topBottomBorder);
}
if (useWindButtons) {
// Rewind
fRewind = new SymbolButton(B_EMPTY_STRING, NULL,
new BMessage(MSG_REWIND), useSkipButtons ? topBottomBorder
: BControlLook::B_LEFT_BORDER | topBottomBorder);
// Forward
fForward = new SymbolButton(B_EMPTY_STRING, NULL,
new BMessage(MSG_FORWARD), useSkipButtons ? topBottomBorder
: BControlLook::B_RIGHT_BORDER | topBottomBorder);
}
// Play Pause
fPlayPause = new PlayPauseButton(B_EMPTY_STRING, NULL, NULL,
new BMessage(MSG_PLAY), useWindButtons || useSkipButtons
? topBottomBorder
: topBottomBorder | BControlLook::B_LEFT_BORDER);
// Stop
fStop = new SymbolButton(B_EMPTY_STRING, NULL, new BMessage(MSG_STOP),
useWindButtons || useSkipButtons ? topBottomBorder
: topBottomBorder | BControlLook::B_RIGHT_BORDER);
// Mute
fMute = new SymbolButton(B_EMPTY_STRING, NULL, new BMessage(MSG_SET_MUTE),
0);
// Volume Slider
fVolumeSlider = new VolumeSlider("volume slider",
0, VIRTUAL_MAX_VOLUME, SNAP_VOLUME, new BMessage(MSG_SET_VOLUME));
fVolumeSlider->SetValue(100);
// Peak view
if (usePeakView)
fPeakView = new PeakView("peak view", false, false);
// Playback Frame
if (usePlaybackFrame)
fPlaybackFrame = new PlaybackFrameView();
// Layout the controls
BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL, 0);
BGroupLayout* buttonLayout = buttonGroup->GroupLayout();
if (fSkipBack != NULL)
buttonLayout->AddView(fSkipBack);
if (fRewind != NULL)
buttonLayout->AddView(fRewind);
buttonLayout->AddView(fPlayPause);
buttonLayout->AddView(fStop);
if (fForward != NULL)
buttonLayout->AddView(fForward);
if (fSkipForward != NULL)
//.........这里部分代码省略.........
示例12: BMessage
TeamMonitorWindow::TeamMonitorWindow()
:
BWindow(BRect(0, 0, 350, 400), B_TRANSLATE("Team monitor"),
B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
| B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS,
B_ALL_WORKSPACES),
fQuitting(false),
fUpdateRunner(NULL)
{
BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
float inset = 10;
layout->SetInsets(inset, inset, inset, inset);
layout->SetSpacing(inset);
SetLayout(layout);
layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fListView = new BListView("teams");
fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));
BScrollView* scrollView = new BScrollView("scroll_teams", fListView,
0, B_SUPPORTS_LAYOUT, false, true, B_FANCY_BORDER);
layout->AddView(scrollView);
BGroupView* groupView = new BGroupView(B_HORIZONTAL);
layout->AddView(groupView);
fKillButton = new BButton("kill", B_TRANSLATE("Kill application"),
new BMessage(TM_KILL_APPLICATION));
groupView->AddChild(fKillButton);
fKillButton->SetEnabled(false);
fQuitButton = new BButton("quit", B_TRANSLATE("Quit application"),
new BMessage(TM_QUIT_APPLICATION));
groupView->AddChild(fQuitButton);
fQuitButton->SetEnabled(false);
groupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
fDescriptionView = new TeamDescriptionView;
layout->AddView(fDescriptionView);
groupView = new BGroupView(B_HORIZONTAL);
layout->AddView(groupView);
BButton* forceReboot = new BButton("force", B_TRANSLATE("Force reboot"),
new BMessage(TM_FORCE_REBOOT));
groupView->GroupLayout()->AddView(forceReboot);
BSpaceLayoutItem* glue = BSpaceLayoutItem::CreateGlue();
glue->SetExplicitMinSize(BSize(inset, -1));
groupView->GroupLayout()->AddItem(glue);
fRestartButton = new BButton("restart", B_TRANSLATE("Restart the desktop"),
new BMessage(TM_RESTART_DESKTOP));
SetDefaultButton(fRestartButton);
groupView->GroupLayout()->AddView(fRestartButton);
glue = BSpaceLayoutItem::CreateGlue();
glue->SetExplicitMinSize(BSize(inset, -1));
groupView->GroupLayout()->AddItem(glue);
fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(TM_CANCEL));
SetDefaultButton(fCancelButton);
groupView->GroupLayout()->AddView(fCancelButton);
BSize preferredSize = layout->View()->PreferredSize();
if (preferredSize.width > Bounds().Width())
ResizeTo(preferredSize.width, Bounds().Height());
if (preferredSize.height > Bounds().Height())
ResizeTo(Bounds().Width(), preferredSize.height);
BRect screenFrame = BScreen(this).Frame();
BPoint point;
point.x = (screenFrame.Width() - Bounds().Width()) / 2;
point.y = (screenFrame.Height() - Bounds().Height()) / 2;
if (screenFrame.Contains(point))
MoveTo(point);
SetSizeLimits(Bounds().Width(), Bounds().Width() * 2,
Bounds().Height(), screenFrame.Height());
fRestartButton->Hide();
AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY,
new BMessage(kMsgLaunchTerminal));
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
gLocalizedNamePreferred
= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();
gTeamMonitorWindow = this;
if (be_app->Lock()) {
be_app->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
B_ANY_SOURCE, B_LOCALE_CHANGED, FilterLocaleChanged));
be_app->Unlock();
//.........这里部分代码省略.........
示例13: PageView
/**
* _ConstructGUI()
*
* Creates the GUI for the View. MUST be called AFTER the View is attached to
* the Window, or will crash and/or create strange behaviour
*
* @param none
* @return void
*/
void
MarginView::_ConstructGUI()
{
fPage = new PageView();
fPage->SetViewColor(ViewColor());
fPageSize = new BStringView("pageSize", "?x?");
BString str;
// Create text fields
// top
str << fMargins.top/fUnitValue;
fTop = new BTextControl("top", "Top:", str.String(), NULL);
fTop->SetModificationMessage(new BMessage(TOP_MARGIN_CHANGED));
fTop->SetTarget(this);
_AllowOnlyNumbers(fTop, kNumCount);
//left
str = "";
str << fMargins.left/fUnitValue;
fLeft = new BTextControl("left", "Left:", str.String(), NULL);
fLeft->SetModificationMessage(new BMessage(LEFT_MARGIN_CHANGED));
fLeft->SetTarget(this);
_AllowOnlyNumbers(fLeft, kNumCount);
//bottom
str = "";
str << fMargins.bottom/fUnitValue;
fBottom = new BTextControl("bottom", "Bottom:", str.String(), NULL);
fBottom->SetModificationMessage(new BMessage(BOTTOM_MARGIN_CHANGED));
fBottom->SetTarget(this);
_AllowOnlyNumbers(fBottom, kNumCount);
//right
str = "";
str << fMargins.right/fUnitValue;
fRight = new BTextControl("right", "Right:", str.String(), NULL);
fRight->SetModificationMessage(new BMessage(RIGHT_MARGIN_CHANGED));
fRight->SetTarget(this);
_AllowOnlyNumbers(fRight, kNumCount);
// Create Units popup
BPopUpMenu *menu = new BPopUpMenu("units");
BMenuField *units = new BMenuField("units", "Units:", menu);
BMenuItem *item;
// Construct menu items
for (int32 i = 0; kUnitNames[i] != NULL; i++) {
BMessage *msg = new BMessage(MARGIN_UNIT_CHANGED);
msg->AddInt32("marginUnit", kUnitMsg[i]);
menu->AddItem(item = new BMenuItem(kUnitNames[i], msg));
item->SetTarget(this);
if (fMarginUnit == kUnitMsg[i])
item->SetMarked(true);
}
BGridView* settings = new BGridView();
BGridLayout* settingsLayout = settings->GridLayout();
settingsLayout->AddItem(fTop->CreateLabelLayoutItem(), 0, 0);
settingsLayout->AddItem(fTop->CreateTextViewLayoutItem(), 1, 0);
settingsLayout->AddItem(fLeft->CreateLabelLayoutItem(), 0, 1);
settingsLayout->AddItem(fLeft->CreateTextViewLayoutItem(), 1, 1);
settingsLayout->AddItem(fBottom->CreateLabelLayoutItem(), 0, 2);
settingsLayout->AddItem(fBottom->CreateTextViewLayoutItem(), 1, 2);
settingsLayout->AddItem(fRight->CreateLabelLayoutItem(), 0, 3);
settingsLayout->AddItem(fRight->CreateTextViewLayoutItem(), 1, 3);
settingsLayout->AddItem(units->CreateLabelLayoutItem(), 0, 4);
settingsLayout->AddItem(units->CreateMenuBarLayoutItem(), 1, 4);
settingsLayout->SetSpacing(0, 0);
BGroupView* groupView = new BGroupView(B_HORIZONTAL, 10);
BGroupLayout* groupLayout = groupView->GroupLayout();
groupLayout->AddView(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(fPage)
.Add(fPageSize)
.SetInsets(0, 0, 0, 0)
.TopView()
);
groupLayout->AddView(settings);
groupLayout->SetInsets(5, 5, 5, 5);
AddChild(groupView);
UpdateView(MARGIN_CHANGED);
}
示例14: BMessage
BSCWindow::BSCWindow()
:
BDirectWindow(kWindowRect, "BeScreenCapture", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS|B_AUTO_UPDATE_SIZE_LIMITS),
fController(dynamic_cast<Controller*>(gControllerLooper)),
fCapturing(false)
{
OutputView *outputView
= new OutputView(fController);
PostProcessingView *ppView
= new PostProcessingView("Post Processing");
AdvancedOptionsView *advancedView
= new AdvancedOptionsView(fController);
fStartStopButton = new BButton("Start", "Start Recording",
new BMessage(kMsgGUIToggleCapture));
const char *kString = "Encoding movie...";
BLayoutBuilder::Group<>(this, B_VERTICAL)
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(fTabView = new BTabView("Tab View", B_WIDTH_FROM_LABEL))
.AddGroup(B_HORIZONTAL)
.Add(fCamStatus = new CamStatusView("CamStatusView"))
.Add(fStringView = new BStringView("stringview", kString))
.Add(fStatusBar = new BStatusBar("", ""))
.AddGlue(1)
.Add(fStartStopButton)
.End()
.End();
BGroupView* outputGroup = new BGroupView(B_HORIZONTAL);
outputGroup->SetName("Output");
outputGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
fTabView->AddTab(outputGroup);
BLayoutBuilder::Group<>(outputGroup)
.Add(outputView);
BGroupView* postGroup = new BGroupView(B_HORIZONTAL);
postGroup->SetName("Post Processing");
postGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
fTabView->AddTab(postGroup);
BLayoutBuilder::Group<>(postGroup)
.Add(ppView);
BGroupView* advancedGroup = new BGroupView(B_HORIZONTAL);
advancedGroup->SetName("Advanced Options");
advancedGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
fTabView->AddTab(advancedGroup);
BLayoutBuilder::Group<>(advancedGroup)
.Add(advancedView);
fStatusBar->Hide();
fStringView->Hide();
if (fController->LockLooper()) {
// controller should watch for capture messages
StartWatching(fController, kMsgGUIToggleCapture);
StartWatching(fCamStatus, kAreaSelected);
//StartWatching(fCamStatus, kMsgControllerCaptureResumed);
// watch Controller for these
fController->StartWatching(this, B_UPDATE_STATUS_BAR);
fController->StartWatching(this, B_RESET_STATUS_BAR);
fController->StartWatching(this, kMsgControllerEncodeStarted);
fController->StartWatching(this, kMsgControllerEncodeProgress);
fController->StartWatching(this, kMsgControllerEncodeFinished);
fController->UnlockLooper();
}
StartWatching(fCamStatus, kMsgGUIToggleCapture);
CenterOnScreen();
}
示例15: 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)
//.........这里部分代码省略.........