本文整理汇总了C++中BView::Bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::Bounds方法的具体用法?C++ BView::Bounds怎么用?C++ BView::Bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::Bounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: leftTop
void
BPrintJob::_RecurseView(BView* view, BPoint origin, BPicture* picture,
BRect rect)
{
ASSERT(picture != NULL);
BRegion region;
region.Set(BRect(rect.left, rect.top, rect.right, rect.bottom));
view->fState->print_rect = rect;
view->AppendToPicture(picture);
view->PushState();
view->SetOrigin(origin);
view->ConstrainClippingRegion(®ion);
if (view->ViewColor() != B_TRANSPARENT_COLOR) {
rgb_color highColor = view->HighColor();
view->SetHighColor(view->ViewColor());
view->FillRect(rect);
view->SetHighColor(highColor);
}
view->fIsPrinting = true;
view->Draw(rect);
view->fIsPrinting = false;
view->PopState();
view->EndPicture();
BView* child = view->ChildAt(0);
while (child != NULL) {
if ((child->Flags() & B_WILL_DRAW) && !child->IsHidden()) {
BPoint leftTop(view->Bounds().LeftTop() + child->Frame().LeftTop());
BRect printRect(rect.OffsetToCopy(rect.LeftTop() - leftTop)
& child->Bounds());
if (printRect.IsValid())
_RecurseView(child, origin + leftTop, picture, printRect);
}
child = child->NextSibling();
}
if ((view->Flags() & B_DRAW_ON_CHILDREN) != 0) {
view->AppendToPicture(picture);
view->PushState();
view->SetOrigin(origin);
view->ConstrainClippingRegion(®ion);
view->fIsPrinting = true;
view->DrawAfterChildren(rect);
view->fIsPrinting = false;
view->PopState();
view->EndPicture();
}
}
示例2: AddUIGroup
void AddUIGroup(const char* text, Statement* statement)
{
if (statement->GetChildren() == NULL) return;
DetailsBuilder builder(fParent, GetView(), GetControlBounds(), statement, fSettings);
builder.Visit(statement->GetChildren());
if (IsTop()) {
fBounds.OffsetTo(fBounds.left, builder.GetBounds().top);
} else {
BView* box = GetView();
box->ResizeTo(box->Bounds().Width(), builder.GetBounds().top + kBoxBottomMargin);
}
}
示例3: BWindow
AddOnListInfo::AddOnListInfo(BRect frame,BView *mother)
: BWindow(frame,"DontWorryWindow",B_BORDERED_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,B_AVOID_FOCUS ),
_motherMessenger(mother)
{
CPreferences prefs(PREF_FILE_NAME,PREF_PATH_NAME);
BRect listRect = Bounds();
BScrollView *scrollinfo;
BView *scrollHBar;
float scrollHsize;
_lastClass = NULL;
_typeRequested = -1;
// initialisees les images
prefs.Load();
_classesBitmap = prefs.GetBitmap("classes");
_metodesBitmap = prefs.GetBitmap("metodes");
_variablesBitmap = prefs.GetBitmap("variables");
_privateBitmap = prefs.GetBitmap("private");
_protectedBitmap = prefs.GetBitmap("protected");
_virtualBitmap = prefs.GetBitmap("virtual");
listRect.right -= 15;
listRect.bottom -=15;
_listOfInfos = new AddOnListView(listRect);
scrollinfo = new BScrollView("scroll-info",_listOfInfos,B_FOLLOW_ALL_SIDES,0,true,true);
// deplace la scroll bar du bas
scrollHBar = scrollinfo->FindView("_HSB_");
scrollHBar->ResizeBy(-70,0);
scrollHBar->MoveBy(70,0);
scrollHsize = (scrollHBar->Bounds()).Height()+1;
listRect = scrollinfo->Bounds();
_progress = new AddOnProgressView(BRect(2,listRect.bottom-scrollHsize,70,listRect.bottom-1));
scrollinfo->AddChild(_progress);
AddChild(scrollinfo);
// place le focus sur la liste
_listOfInfos->MakeFocus(true);
// envoyer le pointer de la fenetre a la vue pour les deplacement
BMessage moveMsg(MOVE_WINDOW_PTR);
moveMsg.AddPointer(WINDOW_RESULT_PTR,this);
_motherMessenger.SendMessage(&moveMsg);
}
示例4: rect
void
ImageFilePanel::Show()
{
if (fImageView == NULL) {
Window()->Lock();
BView* background = Window()->ChildAt(0);
uint32 poseViewResizingMode
= background->FindView("PoseView")->ResizingMode();
uint32 countVwResizingMode
= background->FindView("CountVw")->ResizingMode();
uint32 vScrollBarResizingMode
= background->FindView("VScrollBar")->ResizingMode();
uint32 hScrollBarResizingMode
= background->FindView("HScrollBar")->ResizingMode();
background->FindView("PoseView")
->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
background->FindView("CountVw")
->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
background->FindView("VScrollBar")
->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
background->FindView("HScrollBar")
->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
Window()->ResizeBy(0, 70);
background->FindView("PoseView")->SetResizingMode(poseViewResizingMode);
background->FindView("CountVw")->SetResizingMode(countVwResizingMode);
background->FindView("VScrollBar")
->SetResizingMode(vScrollBarResizingMode);
background->FindView("HScrollBar")
->SetResizingMode(hScrollBarResizingMode);
BRect rect(background->Bounds().left + 15,
background->Bounds().bottom - 94, background->Bounds().left + 122,
background->Bounds().bottom - 15);
fImageView = new BView(rect, "ImageView",
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_SUBPIXEL_PRECISE);
fImageView->SetViewColor(background->ViewColor());
background->AddChild(fImageView);
rect = BRect(background->Bounds().left + 132,
background->Bounds().bottom - 85, background->Bounds().right,
background->Bounds().bottom - 65);
fResolutionView = new BStringView(rect, "ResolutionView", NULL,
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
background->AddChild(fResolutionView);
rect.OffsetBy(0, -16);
fImageTypeView = new BStringView(rect, "ImageTypeView", NULL,
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
background->AddChild(fImageTypeView);
Window()->Unlock();
}
BFilePanel::Show();
}
示例5: MakeConfigurationView
status_t
RTFTranslator::MakeConfigurationView(BMessage *ioExtension, BView **_view,
BRect *_extent)
{
if (_view == NULL || _extent == NULL)
return B_BAD_VALUE;
BView *view = new ConfigView(BRect(0, 0, 225, 175));
if (view == NULL)
return BTranslator::MakeConfigurationView(ioExtension, _view, _extent);
*_view = view;
*_extent = view->Bounds();
return B_OK;
}
示例6: rect
/*
* Make inside state picture.
*/
BPicture*
HToolbarButton::MakeInsidePicture(BBitmap *in)
{
HToolbar *toolbar = cast_as(Parent(),HToolbar);
BRect buttonRect = toolbar->ButtonRect();
BView *view = new BView(BRect(0,0,buttonRect.Width(),buttonRect.Height())
,"offview",0,0);
BBitmap *bitmap = new BBitmap(view->Bounds(), in->ColorSpace(), true);
BPicture *pict;
bitmap->AddChild(view);
bitmap->Lock();
view->SetDrawingMode(B_OP_ALPHA);
view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
view->BeginPicture(new BPicture);
DrawBitmap(view,in);
DrawString(view,fName.String());
//view->SetHighColor(White);
//view->FillRect(BRect(0,0,0,22));
//view->FillRect(BRect(0,0,22,0));
//view->SetHighColor(BeShadow);
//view->FillRect(BRect(21,0,21,21));
//view->FillRect(BRect(0,21,21,21));
BRect rect(Bounds());
view->SetDrawingMode(B_OP_OVER);
rect.InsetBy(1,1);
view->BeginLineArray(5);
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
view->AddLine(rect.LeftTop(), rect.RightTop(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
rect.bottom--;
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
view->AddLine(rect.RightTop(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
view->EndLineArray();
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
view->StrokeRect(Bounds());
pict = view->EndPicture();
bitmap->Unlock();
delete bitmap;
return pict;
}
示例7: Update
//*****************************************************
void ToolBarView::Update()
{
tool[3]->SetEnabled(Pool.selection != NONE); // save selection
tool[2]->SetEnabled(Pool.sample_type != NONE && Pool.changed); // save
tool[10]->SetEnabled(Pool.selection != NONE); // cut
tool[11]->SetEnabled(Pool.selection != NONE); // copy
tool[8]->SetEnabled(Hist.HasUndo()); // need history class for this
#ifdef __SAMPLE_STUDIO_LE
tool[9]->SetEnabled(Hist.HasRedo()); // need history class for this
tool[14]->SetEnabled(Pool.selection != NONE); // copy to stack
tool[13]->SetEnabled(ClipBoard.HasClip());
#endif
tool[12]->SetEnabled(ClipBoard.HasClip());
if (Pool.sample_type != STEREO || Pool.selection == NONE){
tool[5]->SetEnabled(false); // L
tool[6]->SetEnabled(false); // R
tool[7]->SetEnabled(false); // B
}else{
tool[5]->SetEnabled(Pool.selection != LEFT);
tool[6]->SetEnabled(Pool.selection != RIGHT);
tool[7]->SetEnabled(Pool.selection != BOTH);
}
bool draw = false;
BView *view = Window()->FindView("Sample view");
if (view){
float step = (Pool.r_pointer-Pool.l_pointer)/view->Bounds().Width();
if (step < 64) draw = true;
}
if (Pool.tool_mode == DRAW_TOOL && !draw) // make sure that the correct mode is active
Pool.tool_mode = SELECT_TOOL;
tool[16]->SetEnabled(Pool.sample_type != NONE);
tool[16]->SetValue(Pool.tool_mode == SELECT_TOOL && Pool.sample_type != NONE);
tool[17]->SetEnabled(Pool.sample_type != NONE && draw);
tool[17]->SetValue(Pool.tool_mode == DRAW_TOOL);
tool[18]->SetEnabled(Pool.sample_type != NONE);
tool[18]->SetValue(Pool.tool_mode == PLAY_TOOL);
tool[19]->SetEnabled(Pool.sample_type != NONE);
tool[19]->SetValue(Pool.tool_mode == SCRUB_TOOL);
}
示例8: Bounds
AboutWindow::AboutWindow()
:
BWindow(BRect(250, 200, 650, 500), "AboutWindow", B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE)
{
BRect r;
SetTitle("About");
r = Bounds();
BView* aroundView = new BView(r, "AroundView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
aroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(aroundView);
r = aroundView->Bounds();
r.InsetBy(5.0, 5.0);
aroundView->AddChild(new BButton(r, "close", "Close", new BMessage('ClWi')));
aroundView->AddChild(new AboutView(r, "AboutView"));
}
示例9: GetControlBounds
BRect GetControlBounds()
{
if (IsTop()) {
BRect bounds(fBounds);
bounds.left += kItemLeftMargin /** GetLevel()*/;
bounds.right -= kItemRightMargin /** GetLevel()*/;
return bounds;
}
BView* box = GetView();
BRect bounds(box->Bounds());
bounds.top = bounds.bottom - kBoxBottomMargin;
bounds.bottom = bounds.top + kBoxHeight;
bounds.left += kBoxLeftMargin;
bounds.right -= kBoxRightMargin;
return bounds;
}
示例10: paneVScrolled
/**
* @brief ペインが縦方向にスクロールしたら呼び出します。
* @param[in] y スクロール後の y 座標
* @param[in] fromPaneIndex この関数を呼び出しているペインのインデックス
*/
void TextDiffView::paneVScrolled(float y, TextDiffView::PaneIndex fromPaneIndex)
{
// 再入を防ぐ
if (isPanesVScrolling)
{
return;
}
isPanesVScrolling = true;
// 他のペインもスクロールさせる
int index;
for (index = 0; index < PaneMAX; index++)
{
if (index == fromPaneIndex)
{
continue;
}
const char* viewName;
switch (index)
{
case LeftPane:
viewName = NAME_LEFT_PANE;
break;
case RightPane:
viewName = NAME_RIGHT_PANE;
break;
default:
viewName = NULL;
break;
}
if (NULL != viewName)
{
BView* pane = FindView(viewName);
if (NULL != pane)
{
BRect bounds = pane->Bounds();
pane->ScrollTo(bounds.left, y);
}
}
}
isPanesVScrolling = false;
}
示例11: b
// show_window
void
show_window(BRect frame, const char* name)
{
BWindow* window = new BWindow(frame, name,
B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
BView* view = new TestView(window->Bounds(), "test", B_FOLLOW_ALL,
B_WILL_DRAW/* | B_FULL_UPDATE_ON_RESIZE*/);
window->AddChild(view);
BRect b(0.0, 0.0, 60.0, 15.0);
b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 15.0));
BButton* control = new BButton(b, "button", "Reset", new BMessage(MSG_RESET));
view->AddChild(control);
control->SetTarget(view);
window->Show();
}
示例12: MakeConfigurationView
// ---------------------------------------------------------------
// MakeConfigurationView
//
// Makes a BView object for configuring / displaying info about
// this translator.
//
// Preconditions:
//
// Parameters: ioExtension, configuration options for the
// translator
//
// outView, the view to configure the
// translator is stored here
//
// outExtent, the bounds of the view are
// stored here
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
status_t
BaseTranslator::MakeConfigurationView(BMessage *ioExtension, BView **outView,
BRect *outExtent)
{
if (!outView || !outExtent)
return B_BAD_VALUE;
if (ioExtension && fSettings->LoadSettings(ioExtension) != B_OK)
return B_BAD_VALUE;
BView *view = NewConfigView(AcquireSettings());
// implemented in derived class
if (view) {
*outView = view;
*outExtent = view->Bounds();
return B_OK;
} else
return BTranslator::MakeConfigurationView(ioExtension, outView,
outExtent);
}
示例13: BBitmap
BBitmap *DragonView::_MakeNoneImage( void )
{
// Draw an "empty" bitmap to represent "no image"; we'll use one
// that tells the user what to do.
BBitmap *bitmap = new BBitmap( BRect( 0, 0, 319, 199 ),
BScreen().ColorSpace(),
true );
BView *view = new BView( bitmap->Bounds(),
"not a bitmap",
B_FOLLOW_ALL_SIDES, 0 );
bitmap->AddChild( view );
DragonApp *app = dynamic_cast<DragonApp *>( be_app );
rgb_color White = { 255, 255, 255, 0 };
rgb_color Black = { 0, 0, 0, 0 };
bitmap->Lock();
view->SetLowColor( White );
view->SetViewColor( White );
view->SetHighColor( Black );
view->SetDrawingMode( B_OP_OVER );
view->FillRect( view->Bounds(), B_SOLID_LOW );
// Excercise for the reader here: Read the old newsletter articles
// about how to use the font metrics to find out how large a font is,
// then center to font in the window dynamically no matter what font
// settings the user has.
view->SetFont( be_plain_font );
view->MovePenTo( 5, 100 );
view->DrawString( app->rsrc_strings->FindString( RSRC_Drop_an_image ) );
view->Sync();
bitmap->Unlock();
return bitmap;
}
示例14: BView
BView *PrefsWindow::create_volumes_pane(void)
{
BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_VOLUMES_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
pane->SetViewColor(fill_color);
float right = pane->Bounds().right-10;
const char *str;
int32 index = 0;
volume_list = new VolumeListView(BRect(15, 10, pane->Bounds().right-30, 113), "volumes");
while ((str = PrefsFindString("disk", index++)) != NULL)
volume_list->AddItem(new BStringItem(str));
volume_list->SetSelectionMessage(new BMessage(MSG_VOLUME_SELECTED));
volume_list->SetInvocationMessage(new BMessage(MSG_VOLUME_INVOKED));
pane->AddChild(new BScrollView("volumes_border", volume_list, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));
pane->AddChild(new BButton(BRect(10, 118, pane->Bounds().right/3, 138), "add_volume", GetString(STR_ADD_VOLUME_BUTTON), new BMessage(MSG_ADD_VOLUME)));
pane->AddChild(new BButton(BRect(pane->Bounds().right/3, 118, pane->Bounds().right*2/3, 138), "create_volume", GetString(STR_CREATE_VOLUME_BUTTON), new BMessage(MSG_CREATE_VOLUME)));
pane->AddChild(new BButton(BRect(pane->Bounds().right*2/3, 118, pane->Bounds().right-11, 138), "remove_volume", GetString(STR_REMOVE_VOLUME_BUTTON), new BMessage(MSG_REMOVE_VOLUME)));
extfs_control = new PathControl(true, BRect(10, 145, right, 160), "extfs", GetString(STR_EXTFS_CTRL), PrefsFindString("extfs"), NULL);
extfs_control->SetDivider(90);
pane->AddChild(extfs_control);
BMenuField *menu_field;
BPopUpMenu *menu = new BPopUpMenu("");
menu_field = new BMenuField(BRect(10, 165, right, 180), "bootdriver", GetString(STR_BOOTDRIVER_CTRL), menu);
menu_field->SetDivider(90);
menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY)));
menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM)));
pane->AddChild(menu_field);
int32 i32 = PrefsFindInt32("bootdriver");
BMenuItem *item;
if (i32 == 0) {
if ((item = menu->FindItem(GetString(STR_BOOT_ANY_LAB))) != NULL)
item->SetMarked(true);
} else if (i32 == CDROMRefNum) {
if ((item = menu->FindItem(GetString(STR_BOOT_CDROM_LAB))) != NULL)
item->SetMarked(true);
}
nocdrom_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nocdrom", GetString(STR_NOCDROM_CTRL), new BMessage(MSG_NOCDROM));
pane->AddChild(nocdrom_checkbox);
nocdrom_checkbox->SetValue(PrefsFindBool("nocdrom") ? B_CONTROL_ON : B_CONTROL_OFF);
return pane;
}
示例15: revertBounds
ColorPicker::ColorPicker(BLooper * target) : BWindow(BRect(50, 75, 100 + (CP_COL_WIDTH * 32), 120 + (CP_COL_WIDTH * 8)), str(STR_SET_COLORS), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE), _target(target), _whichColor(0)
{
const float margin = 5.0f;
const float topRowHeight = 25.0f;
_colControl = new BColorControl(BPoint(margin, margin+topRowHeight+margin), B_CELLS_32x8, CP_COL_WIDTH, "color_picker", new BMessage(CP_COL_UPDATE));
ResizeTo(_colControl->Frame().right+margin, _colControl->Frame().bottom+margin);
BView * view = new BView(Bounds(), NULL, B_FOLLOW_ALL, 0);
AddChild(view);
view->SetViewColor(BeBackgroundGrey);
const BRect & bounds = view->Bounds();
float revertWidth = view->StringWidth(str(STR_REVERT))+10.0f;
BRect revertBounds(bounds.right-(revertWidth+margin), margin, bounds.right-margin, margin+topRowHeight);
view->AddChild(_revert = new BButton(revertBounds, NULL, str(STR_REVERT), new BMessage(CP_BUTTON_REVERT)));
float defaultWidth = view->StringWidth(str(STR_DEFAULT))+10.0f;
BRect defaultBounds(revertBounds.left-(margin+defaultWidth), revertBounds.top, revertBounds.left-margin, revertBounds.bottom);
view->AddChild(_default = new BButton(defaultBounds, NULL, str(STR_DEFAULT), new BMessage(CP_BUTTON_DEFAULT)));
view->AddChild(_sampleView = new BView(BRect(margin, margin, margin+topRowHeight, margin+topRowHeight), NULL, B_FOLLOW_TOP|B_FOLLOW_LEFT, B_WILL_DRAW));
_colorMenu = new BMenu("");
_colorMenu->SetLabelFromMarked(true);
for (int i=0; i<NUM_COLORS; i++)
{
BMessage * msg = new BMessage(CP_SELECTION_CHANGED);
msg->AddInt32("which", i);
BMenuItem * mi = new BMenuItem(str(STR_COLOR_BG+i), msg);
_colorMenu->AddItem(mi);
if (i==0) mi->SetMarked(true);
}
view->AddChild(new BMenuField(BRect(margin+topRowHeight+margin, margin, revertBounds.left-margin, revertBounds.bottom), NULL, NULL, _colorMenu));
view->AddChild(_colControl);
BMessage initMsg(CP_INIT);
PostMessage(&initMsg);
}