本文整理汇总了C++中BRect::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ BRect::Width方法的具体用法?C++ BRect::Width怎么用?C++ BRect::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRect
的用法示例。
在下文中一共展示了BRect::Width方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BGLView
FlurryView::FlurryView(BRect bounds)
:
BGLView(bounds, (const char *)NULL, B_FOLLOW_ALL, B_FRAME_EVENTS | B_WILL_DRAW,
BGL_RGB | BGL_ALPHA | BGL_DEPTH | BGL_DOUBLE),
fOldFrameTime(-1.0),
fFlurryInfo_t(NULL)
{
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("Flurry");
fWidth = bounds.Width();
fHeight = bounds.Height();
fStartTime = _CurrentTime();
LockGL();
_SetupFlurryBaseInfo();
UnlockGL();
}
示例2: Bounds
void
ActivityView::_UpdateFrame()
{
#ifdef __HAIKU__
if (fLegendLayoutItem == NULL || fHistoryLayoutItem == NULL)
return;
BRect historyFrame = fHistoryLayoutItem->Frame();
BRect legendFrame = fLegendLayoutItem->Frame();
#else
BRect historyFrame = Bounds();
BRect legendFrame = Bounds();
historyFrame.bottom -= 2 * Bounds().Height() / 3;
legendFrame.top += Bounds().Height() / 3;
#endif
MoveTo(historyFrame.left, historyFrame.top);
ResizeTo(legendFrame.left + legendFrame.Width() - historyFrame.left,
legendFrame.top + legendFrame.Height() - historyFrame.top);
}
示例3: floorf
void
TabDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
float* _size, float* _inset) const
{
float tabSize = fTopTab->look == kLeftTitledWindowLook ?
tabRect.Width() : tabRect.Height();
bool smallTab = fTopTab->look == B_FLOATING_WINDOW_LOOK
|| fTopTab->look == kLeftTitledWindowLook;
*_offset = smallTab ? floorf(fDrawState.Font().Size() / 2.6)
: floorf(fDrawState.Font().Size() / 2.3);
*_inset = smallTab ? floorf(fDrawState.Font().Size() / 5.0)
: floorf(fDrawState.Font().Size() / 6.0);
// "+ 2" so that the rects are centered within the solid area
// (without the 2 pixels for the top border)
*_size = tabSize - 2 * *_offset + *_inset;
}
示例4: point
void
TDateEdit::DrawSeparator(uint32 index, BRect bounds)
{
if (index >= 2)
return;
if (fFieldPositions == NULL || index * 2 + 2 >= (uint32)fFieldPosCount)
return;
BString field;
fText.CopyCharsInto(field, fFieldPositions[index * 2 + 1],
fFieldPositions[index * 2 + 2] - fFieldPositions[index * 2 + 1]);
BPoint point(bounds.LeftBottom());
point.y -= bounds.Height() / 2.0 - 6.0;
point.x += (bounds.Width() - StringWidth(field)) / 2;
SetHighColor(0, 0, 0, 255);
DrawString(field, point);
}
示例5: BRect
BView *
Create_TEdit(BRect rct,int type)
{
BView *bt;
BScrollView *sc;
MyContainLv *bt1;
bool a = false,b = false;
switch(type)
{
case 1: a = false; b =true; break;
case 2: a = true; b = false; break;
case 3: a = b = true; break;
}
BRect kt = BRect(4,4,rct.IntegerWidth() - 4 - ((b) ? 14 : 0),rct.IntegerHeight() - 4 - ((a) ? 14 : 0));
if (bt = new BTextView(kt,"",BRect(5,5,kt.Width()-5,kt.Height()-5),B_FOLLOW_NONE,B_WILL_DRAW))
{
if (sc = new BScrollView("",bt,B_FOLLOW_ALL,0,a,b))
{
if (a)
{
BScrollBar *xi;
if (xi = sc->ScrollBar(B_HORIZONTAL))
{
xi->SetRange(0,0);
}
}
if (bt1 = new MyContainLv(rct))
{
bt1->AddChild(sc);
return(bt1);
}
}
}
return(NULL);
}
示例6: DoScrollBars
void BFIV_ScrollView::DoScrollBars()
{
// use BView::ScrollBar(B_VERTICAL||B_HORIZONTAL) to get scroll bars
BRect bounds = Bounds(), ibounds = fImage->Bounds();
float curWidth = bounds.Width(), curHeight = bounds.Height();
float maxWidth = ibounds.Width(), maxHeight = ibounds.Height();
float propHor, propVert, rangeHor, rangeVert;
BScrollBar *scroll;
//bounds.PrintToStream();
//ibounds.PrintToStream();
// 5 pixel gutter on each side
maxWidth += 10;
maxHeight += 10;
// proportional width and height
propHor = curWidth/maxWidth;
propVert = curHeight/maxHeight;
// width and height ranges
rangeHor = maxWidth - curWidth;
rangeVert = maxHeight - curHeight;
// sanity check
if(rangeHor < 0.0) rangeHor = 0.0;
if(rangeVert < 0.0) rangeVert = 0.0;
// update scrollbars
if ((scroll = ScrollBar(B_HORIZONTAL)) != NULL)
{
scroll->SetProportion(propHor);
scroll->SetRange(0,rangeHor);
scroll->SetSteps(curWidth / 20.0, curWidth / 5.0);
}
if ((scroll = ScrollBar(B_VERTICAL)) != NULL)
{
scroll->SetProportion(propVert);
scroll->SetRange(0,rangeVert);
scroll->SetSteps(curHeight / 20.0, curHeight / 5.0);
}
}
示例7: BWindow
MainWindow::MainWindow(BRect pieRect)
: BWindow(pieRect, "DiskUsage", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)
{
BRect r = Bounds();
r.bottom = r.top + 1.0;
fControlsView = new ControlsView(r);
float cvHeight = fControlsView->Bounds().Height();
AddChild(fControlsView);
r = Bounds();
r.top = r.bottom - 1.0;
fStatusView = new StatusView(r);
float svHeight = fStatusView->Bounds().Height();
float winHeight = pieRect.Height() + cvHeight + svHeight;
fStatusView->MoveTo(0.0, winHeight - svHeight);
ResizeTo(r.Width(), winHeight);
AddChild(fStatusView);
r = fControlsView->Frame();
r.top = r.bottom + 1.0;
r.bottom = fStatusView->Frame().top - 1.0;
fPieView = new PieView(r, this);
AddChild(fPieView);
Show();
// Note: The following code is semi-broken because BScreen::Frame()
// returns incorrect dimensions for the G200 in 1152x864 mode. I reported
// this bug, and Be said it's not a bug -- the Matrox driver actually uses
// a resolution of 1152x900 in that mode. Oh well.
Lock();
float extraHeight = fControlsView->Bounds().Height() + fStatusView->Bounds().Height();
float minHeight = kMinWinSize + extraHeight;
float maxHeight = BScreen(this).Frame().Height();
float maxWidth = maxHeight - extraHeight;
Unlock();
SetSizeLimits(kMinWinSize, maxWidth, minHeight, maxHeight);
}
示例8: job
void
TermWindow::_DoPrint()
{
BPrintJob job("Print");
if (fPrintSettings)
job.SetSettings(new BMessage(*fPrintSettings));
if (job.ConfigJob() != B_OK)
return;
BRect pageRect = job.PrintableRect();
BRect curPageRect = pageRect;
int pHeight = (int)pageRect.Height();
int pWidth = (int)pageRect.Width();
float w, h;
_ActiveTermView()->GetFrameSize(&w, &h);
int xPages = (int)ceil(w / pWidth);
int yPages = (int)ceil(h / pHeight);
job.BeginJob();
// loop through and draw each page, and write to spool
for (int x = 0; x < xPages; x++) {
for (int y = 0; y < yPages; y++) {
curPageRect.OffsetTo(x * pWidth, y * pHeight);
job.DrawView(_ActiveTermView(), curPageRect, B_ORIGIN);
job.SpoolPage();
if (!job.CanContinue()) {
// It is likely that the only way that the job was cancelled is
// because the user hit 'Cancel' in the page setup window, in
// which case, the user does *not* need to be told that it was
// cancelled.
// He/she will simply expect that it was done.
return;
}
}
}
job.CommitJob();
}
示例9: Init
void InputRequest::Init(const char* label, const char* text, const char* btn0_label, const char* btn1_label, const char* btn2_label)
{
BRect frame = Bounds();
fIrView = new InputRequestView(frame, btn0_label, btn1_label, btn2_label);
// now move and resize the window with the calculated width of our view
BRect screenRect = fScreen.Frame();
MoveTo(BPoint(screenRect.Width()/2-fIrView->Width()/2, screenRect.Height()/2-IR_WINDOW_HEIGHT/2-125));
ResizeTo(fIrView->Width(), IR_WINDOW_HEIGHT);
AddChild(fIrView);
SetLabel(label);
SetText(text);
fIrView->SelectText();
//init
fButton_index = -1;
}
示例10: sizeof
void
MediaView::BuildMediaFormat(
BBitmap *bitmap,
media_format *format)
{
media_raw_video_format *rvf = &format->u.raw_video;
memset(format, 0, sizeof(*format));
BRect bitmapBounds = bitmap->Bounds();
rvf->last_active = (uint32)(bitmapBounds.Height() - 1.0);
rvf->orientation = B_VIDEO_TOP_LEFT_RIGHT;
rvf->pixel_width_aspect = 1;
rvf->pixel_height_aspect = 3;
rvf->display.format = bitmap->ColorSpace();
rvf->display.line_width = (int32)bitmapBounds.Width();
rvf->display.line_count = (int32)bitmapBounds.Height();
rvf->display.bytes_per_row = bitmap->BytesPerRow();
}
示例11: BView
// InfoLinesView constructor
InfoLinesView::InfoLinesView(BRect frame, int32 nLines)
: BView(frame, "info", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW)
, mLines(nLines)
{
mLineTexts = new const char *[mLines];
for (int32 i = 0; i < mLines; ++i)
mLineTexts[i] = 0;
SetViewColor(222, 222, 222);
SetLowColor(222, 222, 222);
BFont view_font;
GetFont(&view_font);
font_height fh;
view_font.GetHeight(&fh);
text_descent = fh.descent;
text_height = fh.ascent + fh.descent + fh.leading;
ResizeTo(frame.Width(), nLines * text_height);
}
示例12: BBitmap
TSliderView::TSliderView(BRect rect, char *name, float val, slider_func func, void *arg)
:BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
{
BRect r;
fValue = val;
callback = func;
callback_arg = arg;
// load in our canned slider knob bitmap
r.Set(0, 0, ((KNOB_WIDTH + 7) & 0xfff8) - 1, KNOB_HEIGHT);
fKnob = new BBitmap(r, B_COLOR_8_BIT);
fKnob->SetBits((char*)knob, fKnob->BitsLength(), 0, B_COLOR_8_BIT);
// create our offscreen drawing environment
r = Bounds();
back_width = r.Width();
fSlider = new BBitmap(r, B_COLOR_8_BIT, TRUE);
fSlider->AddChild(fOffView = new BView(r, "", B_FOLLOW_ALL, B_WILL_DRAW));
}
示例13: Bounds
void
TReplicantTray::AdjustPlacement()
{
// called when an add-on has been added or removed
// need to resize the parent of this accordingly
BRect bounds = Bounds();
float width, height;
GetPreferredSize(&width, &height);
if (width == bounds.Width() && height == bounds.Height()) {
// no need to change anything
return;
}
Parent()->ResizeToPreferred();
fBarView->UpdatePlacement();
Parent()->Invalidate();
Invalidate();
}
示例14: DrawMods
void KeyItem::DrawMods(BView *view, BRect r, int32 mod)
{
float w = -(r.Width()+2);
if (mod & B_SHIFT_KEY){
DrawKey(view, r, "S");
r.OffsetBy(w,0);
}
if (mod & B_CONTROL_KEY){
DrawKey(view, r, "C");
r.OffsetBy(w,0);
}
if (mod & B_OPTION_KEY){
DrawKey(view, r, "O");
r.OffsetBy(w,0);
}
if ((mod & B_COMMAND_KEY)){
DrawKey(view, r, "A");
r.OffsetBy(w,0);
}
}
示例15: gInit
void TutGLView::gInit( void )
{
// Set up our OpenGL context.
// Clear to black
glClearColor( 0.0, 0.0, 0.0, 0.0 );
// Set up the depth buffer
glClearDepth( 1.0 );
glDepthFunc( GL_LESS );
glEnable( GL_DEPTH_TEST );
// Set up perspective view
glShadeModel( GL_SMOOTH );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
BRect r = Bounds();
gluPerspective( 45.0, r.Width() / r.Height(), 0.1, 100.0 );
glMatrixMode( GL_MODELVIEW );
}