本文整理汇总了C++中BStringView类的典型用法代码示例。如果您正苦于以下问题:C++ BStringView类的具体用法?C++ BStringView怎么用?C++ BStringView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BStringView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BView
RipView::RipView(const BRect &frame, CDAudioDevice *cd)
: BView(frame,"ripview",B_FOLLOW_ALL,B_WILL_DRAW),
fRipThread(-1)
{
abort_thread = create_sem(1,"rip_abort_sem");
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fStop = new BButton(BRect(0,0,1,1),"stop",_T("Stop"),new BMessage(M_STOP),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fStop->ResizeToPreferred();
fStop->MoveTo(Bounds().right - 5 - fStop->Bounds().Width(),
Bounds().bottom - 5 - fStop->Bounds().Height());
AddChild(fStop);
BRect r(5,5,Bounds().right - 5,30);
fProgressBar = new BStatusBar(r,"progressbar");
fProgressBar->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
AddChild(fProgressBar);
r.Set(5,fProgressBar->Frame().bottom+15,Bounds().right - 5, fProgressBar->Frame().bottom+35);
BStringView *listLabel = new BStringView(r,"listlabel",_T("Songs to be Converted:"));
AddChild(listLabel);
r.Set(5,listLabel->Frame().bottom+5,Bounds().right - 5 - B_V_SCROLL_BAR_WIDTH, fStop->Frame().top - 10);
fRipList = new BListView(r,"riplist",B_SINGLE_SELECTION_LIST,B_FOLLOW_ALL);
BScrollView *ripsv = new BScrollView("ripsv",fRipList, B_FOLLOW_ALL,0,false,true);
AddChild(ripsv);
}
示例2: BView
WonderBrushView::WonderBrushView(const BRect &frame, const char *name,
uint32 resize, uint32 flags, TranslatorSettings *settings)
: BView(frame, name, resize, flags),
fSettings(settings)
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title",
B_TRANSLATE("WonderBrush image translator"));
titleView->SetFont(be_bold_font);
char version[100];
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WBI_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_MINOR_VERSION(WBI_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
WBI_TRANSLATOR_VERSION)), __DATE__);
BStringView *versionView = new BStringView("version", version);
BStringView *copyrightView = new BStringView("copyright", kWBICopyright);
BStringView *copyright2View = new BStringView("copyright2", B_TRANSLATE("written by:"));
BStringView *copyright3View = new BStringView("copyright3", kAuthor);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(titleView)
.Add(versionView)
.Add(copyrightView)
.AddGlue()
.Add(copyright2View)
.Add(copyright3View);
}
示例3: BView
LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
:
BView(name, 0),
fDecorInfoButton(NULL),
fDecorMenuField(NULL),
fDecorMenu(NULL)
{
// Decorator menu
_BuildDecorMenu();
fDecorMenuField = new BMenuField("decorator",
B_TRANSLATE("Decorator:"), fDecorMenu);
fDecorInfoButton = new BButton(B_TRANSLATE("About"),
new BMessage(kMsgDecorInfo));
// scroll bar arrow style
BBox* arrowStyleBox = new BBox("arrow style");
arrowStyleBox->SetLabel(B_TRANSLATE("Arrow style"));
fSavedDoubleArrowsValue = _DoubleScrollBarArrows();
fArrowStyleSingle = new FakeScrollBar(true, false,
new BMessage(kMsgArrowStyleSingle));
fArrowStyleDouble = new FakeScrollBar(true, true,
new BMessage(kMsgArrowStyleDouble));
BView* arrowStyleView;
arrowStyleView = BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, 1)
.Add(new BStringView("single", B_TRANSLATE("Single:")))
.Add(fArrowStyleSingle)
.AddStrut(B_USE_DEFAULT_SPACING)
.Add(new BStringView("double", B_TRANSLATE("Double:")))
.Add(fArrowStyleDouble)
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.End()
.View();
arrowStyleBox->AddChild(arrowStyleView);
arrowStyleBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
arrowStyleBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BStringView* scrollBarLabel
= new BStringView("scroll bar", B_TRANSLATE("Scroll bar:"));
scrollBarLabel->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
// control layout
BLayoutBuilder::Grid<>(this, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(fDecorMenuField->CreateLabelLayoutItem(), 0, 0)
.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
.Add(fDecorInfoButton, 2, 0)
.Add(scrollBarLabel, 0, 1)
.Add(arrowStyleBox, 1, 1)
.AddGlue(0, 2)
.SetInsets(B_USE_WINDOW_SPACING);
// TODO : Decorator Preview Image?
}
示例4: BView
PPDConfigView::PPDConfigView(BRect bounds, const char *name, uint32 resizeMask, uint32 flags)
: BView(bounds, name, resizeMask, flags)
, fPPD(NULL)
{
// add category outline list view
bounds.OffsetTo(0, 0);
BRect listBounds(bounds.left + kLeftMargin, bounds.top + kTopMargin,
bounds.right - kHorizontalSpace, bounds.bottom - kBottomMargin);
listBounds.right -= B_V_SCROLL_BAR_WIDTH;
listBounds.bottom -= B_H_SCROLL_BAR_HEIGHT;
BStringView* label = new BStringView(listBounds, "printer-settings", "Printer Settings:");
AddChild(label);
label->ResizeToPreferred();
listBounds.top += label->Bounds().bottom + 5;
// add details view
fDetails = new BView(listBounds, "details", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
fDetails->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BScrollView* scrollView = new BScrollView("details-scroll-view",
fDetails, B_FOLLOW_ALL_SIDES, 0, true, true);
AddChild(scrollView);
}
示例5: BStringView
bool
ResultWindow::_AddPackages(BGroupLayout* packagesGroup,
const PackageList& packages, const PackageSet& ignorePackages, bool install)
{
bool packagesAdded = false;
for (int32 i = 0; BSolverPackage* package = packages.ItemAt(i);
i++) {
if (ignorePackages.find(package) != ignorePackages.end())
continue;
BString text;
if (install) {
text.SetToFormat("install package %s from repository %s\n",
package->Info().FileName().String(),
package->Repository()->Name().String());
} else {
text.SetToFormat("uninstall package %s\n",
package->VersionedName().String());
}
BStringView* packageView = new BStringView(NULL, text);
packagesGroup->AddView(packageView);
packageView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
packagesAdded = true;
}
return packagesAdded;
}
示例6: BStringView
quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*> CheckView::MakeField(uint16 width,
string name, uint16* xpos, uint16* ypos)
{
BStringView* sv = new BStringView(BRect((*xpos), (*ypos),
(*xpos) + width, (*ypos) + 10),
(name + "Text").c_str(), name.c_str());
BFont font;
sv->GetFont(&font);
font.SetSize(10);
sv->SetFont(&font);
AddChild(sv);
BTextControl* tc = new BTextControl(BRect((*xpos) - 5, (*ypos) + 10,
(*xpos) + width, (*ypos) + 10), (name + "Field").c_str(),
"", "", 0);
(*xpos) += width;
tc->SetDivider(0);
AddChild(tc);
BPopUpMenu* pu = new BPopUpMenu("", true, false);
BMenuField* mf = new BMenuField(BRect((*xpos) + 2, (*ypos) + 9,
(*xpos) + 2, (*ypos) + 9), (name + "Menu").c_str(), "", pu);
mf->SetDivider(0);
AddChild(mf);
(*xpos) += 30;
return quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*>(tc, pu, mf, sv);
}
示例7: BView
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
: BView(frame, B_TRANSLATE("RTF-Translator Settings"), resize, flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BStringView *titleView = new BStringView("title",
B_TRANSLATE("Rich Text Format (RTF) translator"));
titleView->SetFont(be_bold_font);
char version[256];
snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
RTF_TRANSLATOR_VERSION)), __DATE__);
BStringView *versionView = new BStringView("version", version);
BStringView *copyrightView = new BStringView(
"Copyright", B_UTF8_COPYRIGHT "2004-2006 Haiku Inc.");
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(titleView)
.Add(versionView)
.Add(copyrightView)
.AddGlue();
}
示例8: BView
ServiceView::ServiceView(const char* name, const char* executable,
const char* title, const char* description, BNetworkSettings& settings)
:
BView("service", 0),
fName(name),
fExecutable(executable),
fSettings(settings)
{
BStringView* titleView = new BStringView("service", title);
titleView->SetFont(be_bold_font);
titleView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BTextView* descriptionView = new BTextView("description");
descriptionView->SetText(description);
descriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
descriptionView->MakeEditable(false);
fEnableButton = new BButton("toggler", B_TRANSLATE("Enable"),
new BMessage(kMsgToggleService));
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(titleView)
.Add(descriptionView)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(fEnableButton);
SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
_UpdateEnableButton();
fWasEnabled = IsEnabled();
}
示例9: BStringView
void Clock::StartConfig(BView *view)
{
tview = new BStringView(BRect(10, 10, 200, 35), B_EMPTY_STRING, "Simple Clock");
tview->SetFont(be_bold_font);
tview->SetFontSize(15);
view->AddChild(tview);
view->AddChild(new BStringView(BRect(10, 40, 200, 65), B_EMPTY_STRING, " Ver 0.1, ©3dEyes**"));
}
示例10: BCheckBox
void
MidiPlayerWindow::CreateViews()
{
// Set up needed views
scopeView = new ScopeView;
showScope = new BCheckBox("showScope", B_TRANSLATE("Scope"),
new BMessage(MSG_SHOW_SCOPE));
showScope->SetValue(B_CONTROL_ON);
CreateInputMenu();
CreateReverbMenu();
volumeSlider = new BSlider("volumeSlider", NULL, NULL, 0, 100,
B_HORIZONTAL);
rgb_color col = { 152, 152, 255 };
volumeSlider->UseFillColor(true, &col);
volumeSlider->SetModificationMessage(new BMessage(MSG_VOLUME));
playButton = new BButton("playButton", B_TRANSLATE("Play"),
new BMessage(MSG_PLAY_STOP));
playButton->SetEnabled(false);
BBox* divider = new BBox(B_EMPTY_STRING, B_WILL_DRAW | B_FRAME_EVENTS,
B_FANCY_BORDER);
divider->SetExplicitMaxSize(
BSize(B_SIZE_UNLIMITED, 1));
BStringView* volumeLabel = new BStringView(NULL, B_TRANSLATE("Volume:"));
volumeLabel->SetAlignment(B_ALIGN_LEFT);
volumeLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
// Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(scopeView)
.Add(BGridLayoutBuilder(10, 10)
.Add(BSpaceLayoutItem::CreateGlue(), 0, 0)
.Add(showScope, 1, 0)
.Add(reverbMenu->CreateLabelLayoutItem(), 0, 1)
.Add(reverbMenu->CreateMenuBarLayoutItem(), 1, 1)
.Add(inputMenu->CreateLabelLayoutItem(), 0, 2)
.Add(inputMenu->CreateMenuBarLayoutItem(), 1, 2)
.Add(volumeLabel, 0, 3)
.Add(volumeSlider, 1, 3)
)
.AddGlue()
.Add(divider)
.AddGlue()
.Add(playButton)
.AddGlue()
.SetInsets(5, 5, 5, 5)
);
}
示例11: Bounds
void
TSignatureView::AttachedToWindow()
{
BRect rect = Bounds();
float name_text_length = StringWidth(kNameText);
float sig_text_length = StringWidth(kSigText);
float divide_length;
if (name_text_length > sig_text_length)
divide_length = name_text_length;
else
divide_length = sig_text_length;
rect.InsetBy(8,0);
rect.top+= 8;
fName = new TNameControl(rect, kNameText, new BMessage(NAME_FIELD));
AddChild(fName);
fName->SetDivider(divide_length + 10);
fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
rect.OffsetBy(0,fName->Bounds().Height()+5);
rect.bottom = rect.top + kSigHeight;
rect.left = fName->TextView()->Frame().left;
BRect text = rect;
text.OffsetTo(10,0);
fTextView = new TSigTextView(rect, text);
BScrollView *scroller = new BScrollView("SigScroller", fTextView, B_FOLLOW_ALL, 0, false, true);
AddChild(scroller);
scroller->ResizeBy(-1 * scroller->ScrollBar(B_VERTICAL)->Frame().Width() - 9, 0);
scroller->MoveBy(7,0);
/* back up a bit to make room for the label */
rect = scroller->Frame();
BStringView *stringView = new BStringView(rect, "SigLabel", kSigText);
AddChild(stringView);
float tWidth, tHeight;
stringView->GetPreferredSize(&tWidth, &tHeight);
/* the 5 is for the spacer in the TextView */
rect.OffsetBy(-1 *(tWidth) - 5, 0);
rect.right = rect.left + tWidth;
rect.bottom = rect.top + tHeight;
stringView->MoveTo(rect.LeftTop());
stringView->ResizeTo(rect.Width(), rect.Height());
/* Resize the View to the correct height */
scroller->SetResizingMode(B_FOLLOW_NONE);
ResizeTo(Frame().Width(), scroller->Frame().bottom + 8);
scroller->SetResizingMode(B_FOLLOW_ALL);
}
示例12: BStringView
BView*
AboutView::_CreateLabel(const char* name, const char* label)
{
BStringView* labelView = new BStringView(name, label);
labelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
labelView->SetFont(be_bold_font);
return labelView;
}
示例13: cast_as
const char*
BBox::Label() const
{
if (fLabelView == NULL) return NULL;
BStringView *strView = cast_as(fLabelView, BStringView);
if (strView == NULL) return NULL;
return strView->Text();
}
示例14: frame
void MainWindow::setupUi()
{
BRect frame(100, 100, 500, 400);
_win = new BWindow(frame, "Retrospring for BeOS", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
frame.Set(10, 10, 11, 11);
BStringView *label = new BStringView(frame, "rs_label", "Welcome to Retrospring!");
label->ResizeToPreferred();
_win->AddChild(label);
_win->Show();
}
示例15: BStringView
BStringView*
InfoWin::_CreateInfo(const char* name)
{
BStringView* view = new BStringView(name, "");
view->SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
view->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
view->SetTruncation(B_TRUNCATE_SMART);
return view;
}