本文整理汇总了C++中BBox::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::AddChild方法的具体用法?C++ BBox::AddChild怎么用?C++ BBox::AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
MainWindow::MainWindow()
: BWindow(BRect(0, 0, 1, 1), TR("Fonts"), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
fDefaultsButton = new BButton("defaults", TR("Defaults"),
new BMessage(kMsgSetDefaults), B_WILL_DRAW);
fDefaultsButton->SetEnabled(false);
fRevertButton = new BButton("revert", TR("Revert"),
new BMessage(kMsgRevert), B_WILL_DRAW);
fRevertButton->SetEnabled(false);
// BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL);
BBox* box = new BBox(B_FANCY_BORDER, NULL);
fFontsView = new FontView();
// tabView->AddTab(fFontsView);
box->AddChild(fFontsView);
fFontsView->UpdateFonts();
SetLayout(new BGroupLayout(B_VERTICAL));
const float kInset = 10;
AddChild(BGroupLayoutBuilder(B_VERTICAL)
.Add(box)
// .Add(tabView)
.Add(BSpaceLayoutItem::CreateVerticalStrut(kInset))
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(fDefaultsButton)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(kInset))
.Add(fRevertButton)
.Add(BSpaceLayoutItem::CreateGlue())
)
.SetInsets(kInset, kInset, kInset, kInset)
);
if (fSettings.WindowCorner() == BPoint(-1, -1)) {
// center window on screen
CenterOnScreen();
} else {
MoveTo(fSettings.WindowCorner());
// make sure window is on screen
BScreen screen(this);
if (!screen.Frame().InsetByCopy(10, 10).Intersects(Frame()))
CenterOnScreen();
}
fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000);
// every 3 seconds
fDefaultsButton->SetEnabled(fFontsView->IsDefaultable());
}
示例2: KeyboardView
KeyboardWindow::KeyboardWindow()
:
BWindow(BRect(0, 0, 200, 200), B_TRANSLATE_SYSTEM_NAME("Keyboard"),
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
MoveTo(fSettings.WindowCorner());
// Add the main settings view
fSettingsView = new KeyboardView();
BBox* fSettingsBox = new BBox("keyboard_box");
fSettingsBox->AddChild(fSettingsView);
// Add the "Default" button..
fDefaultsButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(BUTTON_DEFAULTS));
// Add the "Revert" button...
fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(BUTTON_REVERT));
fRevertButton->SetEnabled(false);
// Build the layout
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(fSettingsBox)
.AddGroup(B_HORIZONTAL, 7)
.Add(fDefaultsButton)
.Add(fRevertButton)
.AddGlue()
.End()
.SetInsets(10, 10, 10, 10)
);
BSlider* slider = (BSlider* )FindView("key_repeat_rate");
if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatRate());
slider = (BSlider* )FindView("delay_until_key_repeat");
if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatDelay());
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
// center window if it would be off-screen
BScreen screen;
if (screen.Frame().right < Frame().right
|| screen.Frame().bottom < Frame().bottom) {
CenterOnScreen();
}
#ifdef DEBUG
fSettings.Dump();
#endif
Show();
}
示例3: AttribView
AttribFill::AttribFill ()
: AttribView (BRect (0, 0, 146, 146), lstring (24, "Fill"))
{
SetViewColor (LightGrey);
BBox *tolSets = new BBox (BRect (4, 4, 142, 142), "tol");
tolSets->SetLabel (lstring (338, "Tolerance"));
AddChild (tolSets);
tol = new BRadioButton (BRect (8, 13, 124, 30), "tol", lstring (339, "Visual Distance"), new BMessage ('AFtV'));
rgb = new BRadioButton (BRect (8, 30, 124, 46), "rgb", lstring (340, "Absolute RGB"), new BMessage ('AFtS'));
tol->SetValue (B_CONTROL_ON);
tolSets->AddChild (tol);
tolSets->AddChild (rgb);
TabView *bgTab = new TabView (BRect (4, 50, 132, 134), "AttribFill Tab");
tolSets->AddChild (bgTab);
BView *tolTab = new BView (BRect (2, TAB_HEIGHT + 4, 126, TAB_HEIGHT + 63), "tol View", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
BView *rgbTab = new BView (BRect (2, TAB_HEIGHT + 4, 126, TAB_HEIGHT + 63), "rgb View", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
tolTab->SetViewColor (LightGrey);
rgbTab->SetViewColor (LightGrey);
bgTab->AddView (tolTab, lstring (341, "Visual"));
bgTab->AddView (rgbTab, lstring (342, "RGB"));
BStringView *explD = new BStringView (BRect (2, 8, 122, 20), "explD", lstring (343, "Visual Factors:"));
BStringView *facD = new BStringView (BRect (2, 20, 122, 32), "facD", lstring (344, "R: 0.213 G: 0.715 B: 0.072"));
explD->SetFontSize (10);
facD->SetFontSize (10);
sT = new Slider (BRect (4, 42, 122, 58), 10, "D", 0, 255, 1, new BMessage ('AFcT'));
sR = new Slider (BRect (4, 2, 122, 18), 10, "R", 0, 255, 1, new BMessage ('AFcR'));
sG = new Slider (BRect (4, 22, 122, 38), 10, "G", 0, 255, 1, new BMessage ('AFcG'));
sB = new Slider (BRect (4, 42, 122, 58), 10, "B", 0, 255, 1, new BMessage ('AFcB'));
tolTab->AddChild (sT);
tolTab->AddChild (explD);
tolTab->AddChild (facD);
rgbTab->AddChild (sR);
rgbTab->AddChild (sG);
rgbTab->AddChild (sB);
fTolMode = FILLTOL_TOL;
fTolerance = 0;
fToleranceRGB.red = 0;
fToleranceRGB.green = 0;
fToleranceRGB.blue = 0;
fCurrentProperty = 0;
}
示例4: screen
PaletteWindow::PaletteWindow(BPoint point, BHandler *target_i)
:BWindow(BRect(point.x, point.y, point.x+100, point.y+100), "Palette", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS),
target(target_i)
{
BBox *box = new BBox(Bounds(), NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
AddChild(box);
color_ctrl = new CControl(BPoint(5, 5), new BMessage(M_PALETTE));
box->AddChild(color_ctrl);
color_ctrl->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
color_ctrl->SetTarget(target);
int32 c = (ui_color(B_PANEL_BACKGROUND_COLOR).red << 24)
+ (ui_color(B_PANEL_BACKGROUND_COLOR).green << 16)
+ (ui_color(B_PANEL_BACKGROUND_COLOR).blue << 8);
color_ctrl->SetValue(c);
ResizeTo(color_ctrl->Bounds().Width() + 10, color_ctrl->Bounds().Height() + 10);
BScreen screen(this);
if (!screen.Frame().Contains(Frame())) {
BRect scrrect = screen.Frame();
BRect winrect = Frame();
float offx = 0;
float offy = 0;
if (winrect.left < scrrect.left) {
offx = scrrect.left - winrect.left;
}
else {
if (winrect.right > scrrect.right) {
offx = scrrect.right - winrect.right;
}
}
if (winrect.top < scrrect.top) {
offy = scrrect.top - winrect.top;
}
else {
if (winrect.bottom > scrrect.bottom) {
offy = scrrect.bottom - winrect.bottom;
}
}
// MoveTo(winrect.left + offx, offy);
MoveTo(winrect.left + offx, winrect.top + offy);
if (Debug) {
_sPrintf("intersection!\n");
_sPrintf("offx: %f!\n", offx);
_sPrintf("offy: %f!\n", offy);
_sPrintf("old winrect - x1: %f, y1: %f, x2: %f, y2: %f\n", winrect.left, winrect.top, winrect.right, winrect.bottom);
_sPrintf("new winrect - x1: %f, y1: %f, x2: %f, y2: %f\n", winrect.left + offx, winrect.top + offy, winrect.right + offx, winrect.bottom + offy);
}
}
}
示例5: AttachedToWindow
void TVideoCompressionView::AttachedToWindow()
{
printf("TVideoCompressionView::AttachedToWindow()\n");
// Get pointer to previewView and attach to BBox
BBox *previewBox = (BBox *)FindView("PreviewBox");
TVideoPreviewView *previewView = m_Parent->GetParent()->GetParent()->PreviewView();
if (previewView)
{
previewBox->AddChild(previewView);
previewView->MoveTo(m_PreviewRect.left, m_PreviewRect.top);
previewView->ResizeTo(m_PreviewRect.Width(), m_PreviewRect.Height());
previewView->Show();
}
BView::Show();
}
示例6: BMessage
SpaceBarSettingsView::SpaceBarSettingsView()
:
SettingsView("SpaceBarSettingsView")
{
fSpaceBarShowCheckBox = new BCheckBox("",
B_TRANSLATE("Show space bars on volumes"),
new BMessage(kUpdateVolumeSpaceBar));
BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING);
menu->SetFont(be_plain_font);
BMenuItem* item;
menu->AddItem(item = new BMenuItem(
B_TRANSLATE("Used space color"),
new BMessage(kSpaceBarSwitchColor)));
item->SetMarked(true);
fCurrentColor = 0;
menu->AddItem(new BMenuItem(
B_TRANSLATE("Free space color"),
new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(new BMenuItem(
B_TRANSLATE("Warning space color"),
new BMessage(kSpaceBarSwitchColor)));
BBox* box = new BBox("box");
box->SetLabel(fColorPicker = new BMenuField("menu", NULL, menu));
fColorControl = new BColorControl(BPoint(8,
fColorPicker->Bounds().Height() + 8 + kItemExtraSpacing),
B_CELLS_16x16, 1, "SpaceColorControl",
new BMessage(kSpaceBarColorChanged));
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
box->AddChild(fColorControl);
const float spacing = be_control_look->DefaultItemSpacing();
BGroupLayout* layout = GroupLayout();
layout->SetOrientation(B_VERTICAL);
layout->SetSpacing(0);
BGroupLayoutBuilder(layout)
.Add(fSpaceBarShowCheckBox)
.Add(box)
.AddGlue()
.SetInsets(spacing, spacing, spacing, spacing);
}
示例7: BMessage
SpaceBarSettingsView::SpaceBarSettingsView()
:
SettingsView("SpaceBarSettingsView")
{
fSpaceBarShowCheckBox = new BCheckBox("",
B_TRANSLATE("Show space bars on volumes"),
new BMessage(kUpdateVolumeSpaceBar));
BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING);
menu->SetFont(be_plain_font);
BMenuItem* item;
menu->AddItem(item = new BMenuItem(
B_TRANSLATE("Used space color"),
new BMessage(kSpaceBarSwitchColor)));
item->SetMarked(true);
fCurrentColor = 0;
menu->AddItem(new BMenuItem(
B_TRANSLATE("Free space color"),
new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(new BMenuItem(
B_TRANSLATE("Warning space color"),
new BMessage(kSpaceBarSwitchColor)));
fColorPicker = new BMenuField("menu", NULL, menu);
fColorControl = new BColorControl(BPoint(0, 0),
B_CELLS_16x16, 1, "SpaceColorControl",
new BMessage(kSpaceBarColorChanged));
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
BBox* box = new BBox("box");
box->SetLabel(fColorPicker);
box->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL)
.Add(fColorControl)
.SetInsets(B_USE_DEFAULT_SPACING)
.View());
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fSpaceBarShowCheckBox)
.Add(box)
.AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING);
}
示例8: AttachedToWindow
void HexKeyView::AttachedToWindow()
{
BBox *aBox;
BRect aBoxRect;
aBoxRect.Set(10, 10, 370, 270);
aBox = new BBox(aBoxRect, "Box1", B_FOLLOW_NONE);
aBox->SetLabel(LABEL_BOX_TITLE);
AddChild(aBox);
BRect drawRect;
drawRect.Set(10, 10, 340, 240);
DrawView *drawView;
drawView = new DrawView(drawRect, "DrawView");
drawView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
drawView->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
aBox->AddChild(drawView);
}
示例9: BMessage
ClockView::ClockView(const char* name)
:
BView(name, 0),
fCachedShowClock(B_CONTROL_ON),
fCachedShowSeconds(B_CONTROL_OFF),
fCachedShowDayOfWeek(B_CONTROL_OFF),
fCachedShowTimeZone(B_CONTROL_OFF)
{
fShowClock = new BCheckBox(B_TRANSLATE("Show clock in Deskbar"),
new BMessage(kShowHideTime));
fShowSeconds = new BCheckBox(B_TRANSLATE("Display time with seconds"),
new BMessage(kShowSeconds));
fShowDayOfWeek = new BCheckBox(B_TRANSLATE("Show day of week"),
new BMessage(kShowDayOfWeek));
fShowTimeZone = new BCheckBox(B_TRANSLATE("Show time zone"),
new BMessage(kShowTimeZone));
BView* view = BLayoutBuilder::Group<>(B_VERTICAL, 0)
.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET))
.Add(fShowSeconds)
.Add(fShowDayOfWeek)
.Add(fShowTimeZone)
.AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING)
.View();
BBox* showClockBox = new BBox("show clock box");
showClockBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
showClockBox->SetLabel(fShowClock);
showClockBox->AddChild(view);
BLayoutBuilder::Group<>(this)
.AddGroup(B_VERTICAL, 0)
.Add(showClockBox)
.End()
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING);
}
示例10: 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);
}
示例11: constructGeneralBox
BView* PrefsWindow::constructGeneralBox(BRect frame)
{
BBox* generalBox = new BBox(frame);
generalBox->SetLabel("General");
float offset = 30.0f,
bwidth = 80.0f,
bheight = 30.0f,
bspacing = 10.0f,
cbheight = 14.0f,
adjust = 5.0f
;
float controlX = (offset * 2.0f / 3.0f);
BRect bubbleFrame = BRect(controlX, offset - adjust, offset + 150.0f, offset + cbheight - adjust);
ColourButton *bubbleColourButton = new ColourButton(bubbleFrame, GetPrefsMessage(K_BUBBLE_COLOUR), ColourConstants::K_BLACK, "Tooltips");
generalBox->AddChild(bubbleColourButton);
BRect recentDocsPathFrame(controlX, 50.0f, controlX + 150.0f, 70.0f);
BCheckBox *showRecentDocsPath = new BCheckBox(recentDocsPathFrame, K_IS_RECENT_DOCS_SHOWN, "Show Path in Recent Docs", GetPrefsMessage(K_IS_RECENT_DOCS_SHOWN));
generalBox->AddChild(showRecentDocsPath);
BRect isActivationFrame(controlX, 80.0f, controlX + 190.0f, 100.0f);
BCheckBox *isActivationOk = new BCheckBox(isActivationFrame, K_IS_ACTIVATION_OK, "Activate Window on Opening Docs", GetPrefsMessage(K_IS_ACTIVATION_OK));
generalBox->AddChild(isActivationOk);
BRect recentDocsFrame(controlX, 110.0f, controlX + 150.0f, 120.0f);
BTextControl *numRecentDocs = new BTextControl(recentDocsFrame, K_NUM_RECENT_DOCS, "Number of Recent Docs", "", GetPrefsMessage(K_NUM_RECENT_DOCS));
numRecentDocs->SetDivider(120.0f);
numRecentDocs->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
generalBox->AddChild(numRecentDocs);
BRect insertDateFrame(controlX, 140.0f, controlX + 200.0f, 150.0f);
BTextControl *insertDateFlags = new BTextControl(insertDateFrame, K_DATE_FLAGS, "Insert Date Flags", "", GetPrefsMessage(K_DATE_FLAGS));
generalBox->AddChild(insertDateFlags);
BRect generalRect = generalBox->Bounds();
BRect generalbtnRect(generalRect.right - bspacing - bwidth, generalRect.bottom - bspacing - bheight, generalRect.right - bspacing, generalRect.bottom - bspacing);
BButton *resetGeneralDefaults = new BButton(generalbtnRect,"fResetGeneralDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_GENERAL_DEFAULTS));
generalBox->AddChild(resetGeneralDefaults);
return generalBox;
}
示例12: BMessage
SpaceBarSettingsView::SpaceBarSettingsView(BRect rect)
: SettingsView(rect, "SpaceBarSettingsView")
{
rect.OffsetTo(B_ORIGIN);
fSpaceBarShowCheckBox = new BCheckBox(rect, "", "Show space bars on volumes",
new BMessage(kUpdateVolumeSpaceBar));
fSpaceBarShowCheckBox->ResizeToPreferred();
AddChild(fSpaceBarShowCheckBox);
rect = fSpaceBarShowCheckBox->Frame();
rect.OffsetBy(0, fSpaceBarShowCheckBox->Bounds().Height() + kItemExtraSpacing);
BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING);
menu->SetFont(be_plain_font);
BMenuItem *item;
menu->AddItem(item = new BMenuItem("Used space color", new BMessage(kSpaceBarSwitchColor)));
item->SetMarked(true);
fCurrentColor = 0;
menu->AddItem(new BMenuItem("Free space color", new BMessage(kSpaceBarSwitchColor)));
menu->AddItem(new BMenuItem("Warning space color", new BMessage(kSpaceBarSwitchColor)));
BBox *box = new BBox(rect);
box->SetLabel(fColorPicker = new BMenuField(rect, NULL, NULL, menu));
AddChild(box);
fColorControl = new BColorControl(BPoint(8, fColorPicker->Bounds().Height()
+ 8 + kItemExtraSpacing),
B_CELLS_16x16, 1, "SpaceColorControl", new BMessage(kSpaceBarColorChanged));
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
fColorControl->ResizeToPreferred();
box->AddChild(fColorControl);
box->ResizeTo(fColorControl->Bounds().Width() + 16,
fColorControl->Frame().bottom + 8);
}
示例13: BMessage
OutputView::OutputView(Controller *controller)
:
BView("Capture Options", B_WILL_DRAW),
fController(controller)
{
SetLayout(new BGroupLayout(B_VERTICAL));
BBox *selectBox = new BBox("selection");
selectBox->SetLabel("Selection");
selectBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
AddChild(selectBox);
BBox *outputBox = new BBox("output");
outputBox->SetLabel("Output");
outputBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
AddChild(outputBox);
Settings settings;
const char *kTCLabel = "File name:";
const char *fileName = NULL;
settings.GetOutputFileName(&fileName);
fFileName = new BTextControl("file name",
kTCLabel, fileName, new BMessage(kFileNameChanged));
const char *kOutputMenuLabel = "Output Format:";
fOutputFileType = new BOptionPopUp("OutFormat",
kOutputMenuLabel, new BMessage(kFileTypeChanged));
const char *kCodecMenuLabel = "Codec:";
BPopUpMenu *popUpMenu = new BPopUpMenu("Codecs");
fCodecMenu = new BMenuField("OutCodec", kCodecMenuLabel, popUpMenu);
fWholeScreen = new BRadioButton("screen frame", "Whole screen",
new BMessage(kCheckBoxAreaSelectionChanged));
fCustomArea = new BRadioButton("custom area",
"Custom Area", new BMessage(kCheckBoxAreaSelectionChanged));
fSelectArea = new BButton("select area", "Select", new BMessage(kSelectArea));
fSelectArea->SetEnabled(false);
fMinimizeOnStart = new BCheckBox("Minimize on start",
"Minimize on recording", new BMessage(kMinimizeOnRecording));
fRectView = new PreviewView();
BView *layoutView = BLayoutBuilder::Group<>()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.Add(fFileName)
.Add(fOutputFileType)
.Add(fCodecMenu)
.Add(fMinimizeOnStart)
.End()
.View();
outputBox->AddChild(layoutView);
layoutView = BLayoutBuilder::Group<>()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL)
.AddGroup(B_HORIZONTAL)
.AddGroup(B_VERTICAL, 0)
.Add(fWholeScreen)
.Add(fCustomArea)
.End()
.AddGroup(B_VERTICAL)
.AddGlue()
.Add(fSelectArea)
.End()
.End()
.Add(fRectView)
.End()
.View();
selectBox->AddChild(layoutView);
fMinimizeOnStart->SetValue(settings.MinimizeOnRecording() ? B_CONTROL_ON : B_CONTROL_OFF);
// fill in the list of available file formats
media_file_format mff;
int32 cookie = 0;
bool firstFound = true;
while (get_next_file_format(&cookie, &mff) == B_OK) {
if (mff.capabilities & media_file_format::B_KNOWS_ENCODED_VIDEO) {
fOutputFileType->AddOption(mff.pretty_name, mff.family);
if (firstFound) {
fOutputFileType->MenuField()->Menu()->ItemAt(0)->SetMarked(true);
firstFound = false;
}
}
}
fWholeScreen->SetValue(B_CONTROL_ON);
UpdateSettings();
fController->SetCaptureArea(BScreen(Window()).Frame());
//.........这里部分代码省略.........
示例14: boundsRect
NetPrefsServerView::NetPrefsServerView (BRect bounds, const char *name, BMessenger target)
: BView (
bounds,
name,
B_FOLLOW_ALL_SIDES,
B_WILL_DRAW),
fEntryWin (NULL),
fNetWin (target)
{
SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));
BRect boundsRect (Bounds ());
BBox *mainBox (new BBox (bounds.InsetByCopy (-1, -1), NULL, B_FOLLOW_ALL_SIDES));
AddChild (mainBox);
fSelectTitleString = new BStringView (BRect (0, 0, 0, 0), NULL, "Select servers for");
fSelectTitleString->ResizeToPreferred ();
mainBox->AddChild (fSelectTitleString);
fSelectTitleString->MoveTo (11, 11);
fServerList = new BColumnListView (BRect (0, 0, boundsRect.Width () - 10,
boundsRect.Height () / 2), "fServerList", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW,
B_PLAIN_BORDER);
fServerList->SetSelectionMessage (new BMessage (M_SERVER_ITEM_SELECTED));
mainBox->AddChild (fServerList);
fServerList->MoveTo (5, fSelectTitleString->Frame ().bottom + 3);
BStringColumn *status (new BStringColumn (S_PREFSERVER_STATUS_COLUMN, be_plain_font->StringWidth ("Status") * 2,
0, bounds.Width (), 0, B_ALIGN_CENTER));
fServerList->AddColumn (status, 0);
BStringColumn *data (new BStringColumn (S_PREFSERVER_SERVER_COLUMN, be_plain_font->StringWidth ("Server") * 2,
0, bounds.Width (), 0));
fServerList->AddColumn (data, 1);
BStringColumn *port (new BStringColumn (S_PREFSERVER_PORT_COLUMN, be_plain_font->StringWidth ("Port") * 2,
0, bounds.Width (), 0));
fServerList->AddColumn (port, 2);
fAddButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_ADD_BUTTON B_UTF8_ELLIPSIS,
new BMessage (M_SERVER_ADD_ITEM));
fRemoveButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_REMOVE_BUTTON,
new BMessage (M_SERVER_REMOVE_ITEM));
fEditButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_EDIT_BUTTON B_UTF8_ELLIPSIS,
new BMessage (M_SERVER_EDIT_ITEM));
fAddButton->ResizeToPreferred ();
fRemoveButton->ResizeToPreferred ();
fEditButton->ResizeToPreferred ();
fRemoveButton->MoveTo (fServerList->Frame ().right - fRemoveButton->Frame ().Width (),
fServerList->Frame ().bottom + 5);
mainBox->AddChild (fRemoveButton);
fAddButton->MoveTo (fRemoveButton->Frame ().left - (fAddButton->Frame ().Width () + 5),
fRemoveButton->Frame ().top);
mainBox->AddChild (fAddButton);
fEditButton->MoveTo (fAddButton->Frame ().left - (fEditButton->Frame ().Width () + 15),
fAddButton->Frame ().top);
mainBox->AddChild (fEditButton);
BStringView *legend1 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC1);
legend1->ResizeToPreferred ();
mainBox->AddChild (legend1);
legend1->MoveTo (fServerList->Frame ().left + 5, fAddButton->Frame ().bottom + 5);
BStringView *legend2 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC2);
legend2->ResizeToPreferred ();
mainBox->AddChild (legend2);
legend2->MoveTo (legend1->Frame ().left, legend1->Frame ().bottom);
BStringView *legend3 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC3);
legend3->ResizeToPreferred ();
mainBox->AddChild (legend3);
legend3->MoveTo (legend2->Frame ().left, legend2->Frame ().bottom);
fLegend4 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC4);
fLegend4->ResizeToPreferred ();
mainBox->AddChild (fLegend4);
fLegend4->MoveTo (legend3->Frame ().left, legend3->Frame ().bottom);
fOkButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_OK_BUTTON,
new BMessage (B_QUIT_REQUESTED));
fOkButton->ResizeToPreferred ();
mainBox->AddChild (fOkButton);
fOkButton->MoveTo (fServerList->Frame ().right - fOkButton->Frame ().Width (),
fLegend4->Frame ().bottom + 5);
}
示例15: BMessage
VideoWindow::VideoWindow(const char* title, window_type type,
uint32 flags, port_id* consumerPort)
:
BWindow(BRect(50, 50, 50, 50), title, type, flags),
fPortPtr(consumerPort),
fVideoView(NULL)
{
fFtpInfo.port = 0;
fFtpInfo.rate = 0x7fffffff;
fFtpInfo.imageFormat = 0;
fFtpInfo.translator = 0;
fFtpInfo.passiveFtp = true;
fFtpInfo.uploadClient = 0;
strcpy(fFtpInfo.fileNameText, "filename");
strcpy(fFtpInfo.serverText, "server");
strcpy(fFtpInfo.loginText, "login");
strcpy(fFtpInfo.passwordText, "password");
strcpy(fFtpInfo.directoryText, "directory");
_SetUpSettings("codycam", "");
BMenuBar* menuBar = new BMenuBar("menu bar");
BMenuItem* menuItem;
fMenu = new BMenu(B_TRANSLATE("File"));
menuItem = new BMenuItem(B_TRANSLATE("Video settings"),
new BMessage(msg_video), 'P');
menuItem->SetTarget(be_app);
fMenu->AddItem(menuItem);
fMenu->AddSeparatorItem();
menuItem = new BMenuItem(B_TRANSLATE("Start video"),
new BMessage(msg_start), 'A');
menuItem->SetTarget(be_app);
fMenu->AddItem(menuItem);
menuItem = new BMenuItem(B_TRANSLATE("Stop video"),
new BMessage(msg_stop), 'O');
menuItem->SetTarget(be_app);
fMenu->AddItem(menuItem);
fMenu->AddSeparatorItem();
menuItem = new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q');
menuItem->SetTarget(be_app);
fMenu->AddItem(menuItem);
menuBar->AddItem(fMenu);
/* add some controls */
_BuildCaptureControls();
BBox* box = new BBox("box");
box->AddChild(fVideoView);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(menuBar)
.AddGroup(B_VERTICAL)
.SetInsets(B_USE_WINDOW_SPACING)
.Add(box)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.Add(fCaptureSetupBox)
.Add(fFtpSetupBox)
.End()
.Add(fStatusLine)
.End()
.AddGlue();
Show();
}