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(); }
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); }
void BTextControl::_LayoutTextView() { CALLED(); BRect frame = Bounds(); frame.left = fDivider; // we are stroking the frame around the text view, which // is 2 pixels wide frame.InsetBy(kFrameMargin, kFrameMargin); fText->MoveTo(frame.left, frame.top); fText->ResizeTo(frame.Width(), frame.Height()); fText->AlignTextRect(); TRACE("width: %.2f, height: %.2f\n", Frame().Width(), Frame().Height()); TRACE("fDivider: %.2f\n", fDivider); TRACE("fText frame: (%.2f, %.2f, %.2f, %.2f)\n", frame.left, frame.top, frame.right, frame.bottom); }
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; }
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); }
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); }
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); } }
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); }
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(); }
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; }
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(); }
void TTimeEdit::DrawSection(uint32 index, BRect bounds, bool hasFocus) { if (fFieldPositions == NULL || index * 2 + 1 >= (uint32)fFieldPosCount) return; SetLowColor(ViewColor()); if (hasFocus) SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); BString field; fText.CopyCharsInto(field, fFieldPositions[index * 2], fFieldPositions[index * 2 + 1] - fFieldPositions[index * 2]); BPoint point(bounds.LeftBottom()); point.y -= bounds.Height() / 2.0 - 6.0; point.x += (bounds.Width() - StringWidth(field)) / 2; SetHighColor(0, 0, 0, 255); FillRect(bounds, B_SOLID_LOW); DrawString(field, point); }
void TBarMenuBar::SmartResize(float width, float height) { if (width == -1.0f && height == -1.0f) { BRect frame = Frame(); width = frame.Width(); height = frame.Height(); } else ResizeTo(width, height); width -= 1; int32 count = CountItems(); if (fDeskbarMenuItem) fDeskbarMenuItem->SetWidthHeight(width / count, height); if (fAppListMenuItem) fAppListMenuItem->SetWidthHeight(width / count, height); InvalidateLayout(); }
// 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); }
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)); }
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(); }
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); } }
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 ); }
void TWindowMenuItem::DrawContent() { BMenu* menu = Menu(); BPoint contentLocation = ContentLocation() + BPoint(kHPad, 0); if (fID >= 0) { menu->SetDrawingMode(B_OP_OVER); float width = fBitmap->Bounds().Width(); if (width > 16) contentLocation.x -= 8; float height; GetContentSize(NULL, &height); contentLocation.y += (height - fBitmap->Bounds().Height()) / 2; menu->MovePenTo(contentLocation); menu->DrawBitmapAsync(fBitmap); if (width > 16) contentLocation.x += 8; contentLocation.x += kIconRect.Width() + kLabelOffset; } contentLocation.y = ContentLocation().y + kVPad + fLabelAscent; menu->SetDrawingMode(B_OP_COPY); menu->MovePenTo(contentLocation); if (IsSelected()) menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR)); else menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); float labelWidth = menu->StringWidth(Label()); BPoint penLocation = menu->PenLocation(); float offset = penLocation.x - Frame().left; menu->DrawString(Label(labelWidth + offset)); }
int screen_InitCapture( demux_t *p_demux ) { demux_sys_t *p_sys = p_demux->p_sys; screen_data_t *p_data; BRect rect; int i_chroma; int i_bits_per_pixel; p_sys->p_data = p_data = (screen_data_t *)malloc( sizeof( screen_data_t ) ); p_data->p_screen = new BScreen(); rect = p_data->p_screen->Frame(); p_data->p_bitmap = new BBitmap( rect, p_data->p_screen->ColorSpace() ); switch( p_data->p_screen->ColorSpace() ) { case B_RGB32: i_chroma = VLC_FOURCC('R','V','3','2'); i_bits_per_pixel = 32; break; case B_RGB16: i_chroma = VLC_FOURCC('R','V','1','6'); i_bits_per_pixel = 16; break; default: msg_Err( p_demux, "screen depth %i unsupported", p_data->p_screen->ColorSpace() ); delete p_data->p_bitmap; delete p_data->p_screen; free( p_data ); return VLC_EGENERIC; } es_format_Init( &p_sys->fmt, VIDEO_ES, i_chroma ); p_sys->fmt.video.i_width = (int)rect.Width(); p_sys->fmt.video.i_height = (int)rect.Height(); p_sys->fmt.video.i_bits_per_pixel = i_bits_per_pixel; return VLC_SUCCESS; }
BNavigator::BNavigator(const Model *model, BRect rect, uint32 resizeMask) : BView(rect, "Navigator", resizeMask, B_WILL_DRAW), fBack(0), fForw(0), fUp(0), fBackHistory(8, true), fForwHistory(8, true) { // Get initial path model->GetPath(&fPath); SetViewColor(kBgColor); float top = 2 + (be_plain_font->Size() - 8) / 2; // Set up widgets fBack = new BNavigatorButton(BRect(3, top, 21, top + 17), "Back", new BMessage(kNavigatorCommandBackward), kResBackNavActiveSel, kResBackNavActive, kResBackNavInactive); fBack->SetEnabled(false); AddChild(fBack); fForw = new BNavigatorButton(BRect(35, top, 53, top + 17), "Forw", new BMessage(kNavigatorCommandForward), kResForwNavActiveSel, kResForwNavActive, kResForwNavInactive); fForw->SetEnabled(false); AddChild(fForw); fUp = new BNavigatorButton(BRect(67, top, 84, top + 17), "Up", new BMessage(kNavigatorCommandUp), kResUpNavActiveSel, kResUpNavActive, kResUpNavInactive); fUp->SetEnabled(false); AddChild(fUp); fLocation = new BTextControl(BRect(97, 2, rect.Width() - 2, 21), "Location", "", "", new BMessage(kNavigatorCommandLocation), B_FOLLOW_LEFT_RIGHT); fLocation->SetDivider(0); AddChild(fLocation); }
void ShowImageWindow::_ResizeWindowToImage() { BBitmap* bitmap = fImageView->Bitmap(); BScreen screen; if (bitmap == NULL || !screen.IsValid()) return; // TODO: use View::GetPreferredSize() instead? BRect r(bitmap->Bounds()); float width = r.Width() + B_V_SCROLL_BAR_WIDTH; float height = r.Height() + 1 + fBar->Frame().Height() + B_H_SCROLL_BAR_HEIGHT; BRect frame = screen.Frame(); const float windowBorder = 5; // dimensions so that window does not reach outside of screen float maxWidth = frame.Width() + 1 - windowBorder - Frame().left; float maxHeight = frame.Height() + 1 - windowBorder - Frame().top; // We have to check size limits manually, otherwise // menu bar will be too short for small images. float minW, maxW, minH, maxH; GetSizeLimits(&minW, &maxW, &minH, &maxH); if (maxWidth > maxW) maxWidth = maxW; if (maxHeight > maxH) maxHeight = maxH; if (width < minW) width = minW; if (height < minH) height = minH; if (width > maxWidth) width = maxWidth; if (height > maxHeight) height = maxHeight; ResizeTo(width, height); }
// SimpleItem::DrawItem void SimpleItem::Draw(BView *owner, BRect frame, uint32 flags) { DrawBackground(owner, frame, flags); // label owner->SetHighColor(0, 0, 0, 255); font_height fh; owner->GetFontHeight(&fh); const char* text = Text(); BString truncatedString(text); owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE, frame.Width() - TEXT_OFFSET - 4.0); float height = frame.Height(); float textHeight = fh.ascent + fh.descent; BPoint textPoint; textPoint.x = frame.left + TEXT_OFFSET; textPoint.y = frame.top + ceilf(height / 2.0 - textHeight / 2.0 + fh.ascent); owner->DrawString(truncatedString.String(), textPoint); }
float KeyControl::DrawMods(BRect r, int32 mod) { float w = (r.Width()+2); if ((mod & B_COMMAND_KEY)){ DrawKey(r, "A"); r.OffsetBy(w,0); } if (mod & B_OPTION_KEY){ DrawKey(r, "O"); r.OffsetBy(w,0); } if (mod & B_CONTROL_KEY){ DrawKey(r, "C"); r.OffsetBy(w,0); } if (mod & B_SHIFT_KEY){ DrawKey(r, "S"); r.OffsetBy(w,0); } return r.left+4; }
//------------------------------------------------------------------------------ MenuEditor::MenuEditor(BRect rect, BMenu* men) : BBox(rect, "menueditor"), fListView(NULL), fMenu(men), fLabelText(NULL), fMsgText(NULL), fShortcutText(NULL), fModifierField(NULL), fEnabledBox(NULL), fAddItemBtn(NULL), fAddSeparatorBtn(NULL), fInit(false) { SetViewColor(216,216,216); BRect frame(10, 10, rect.Width() - 10 - B_V_SCROLL_BAR_WIDTH, 100); fListView = new DragOutlineListView(frame, Menu()); fListView->SetSelectionMessage(new BMessage(MSG_MENU_SELECTION_CHANGED)); AddChild(new BScrollView("itemscroll", fListView, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true)); }
void StatusView::AttachedToWindow() { SetFont(be_plain_font); SetFontSize(10.); BRect rect = Parent()->Bounds(); GetFontHeight(&_fh); float height = _fh.ascent + _fh.descent + 1.0; if (height < B_V_SCROLL_BAR_WIDTH) height = B_V_SCROLL_BAR_WIDTH; _height = height - _fh.descent - 1.0; ResizeTo(rect.Width(), height); MoveTo(0.0, rect.bottom - height + 1 ); }
/** * @brief コンテナのスクロールバーを調整します。 */ void TextDiffView::DiffPaneView::adjustScrollBar() { if (NULL == scroller) { return; } BRect bounds = Bounds(); // 縦スクロールバーについての調整 BScrollBar* verticalBar = scroller->ScrollBar(B_VERTICAL); if (NULL != verticalBar) { float boundsHeight = bounds.Height() + 1; float height = getDataHeight(); if (height < boundsHeight) { height = boundsHeight; } verticalBar->SetRange(0, height - boundsHeight); verticalBar->SetProportion(boundsHeight / height); BFont font; GetFont(&font); font_height fh; font.GetHeight(&fh); float lineHeight = static_cast<float>(ceil(fh.ascent + fh.descent + fh.leading)); verticalBar->SetSteps(lineHeight, boundsHeight); } // 横スクロールバーについての調整 BScrollBar* horizontalBar = scroller->ScrollBar(B_HORIZONTAL); if (NULL != horizontalBar) { float boundsWidth = bounds.Width() + 1; horizontalBar->SetRange(0, HORIZONTAL_SCROLL_MAX); horizontalBar->SetProportion(boundsWidth / (HORIZONTAL_SCROLL_MAX + boundsWidth)); horizontalBar->SetSteps(HORIZONTAL_SCROLL_MINSTEPS, boundsWidth); } }
void KeyItem::DrawItem(BView* view, BRect rect, bool all) { BFont font; view->GetFont(&font); // Draw the Outline if (fId == -1) { if (IsSelected()) view->SetLowColor(150,190,230); else view->SetLowColor(255,255,255); view->FillRect(rect, B_SOLID_LOW); view->SetHighColor(0,0,0); view->SetFont(be_bold_font); view->DrawString(Text(), BPoint(rect.left+5, rect.top+font.Size())); view->SetFont(&font); return; } const char* key; BStringItem::DrawItem(view, rect, all); view->SetHighColor(240,240,240); view->StrokeLine(BPoint(rect.left, rect.bottom), BPoint(rect.right, rect.bottom)); view->SetHighColor(0,0,0); float x = rect.left + rect.Width()/2 +(font.Size()+4)*3; // max 3 combinations DrawMods(view, BRect( x - font.Size() - 6, rect.top+1, x -4, rect.bottom-1), fMod); if (fKey >' ' && fKey < 'a') { view->DrawChar( fKey, BPoint( x, rect.top +font.Size() )); } else if (fKey) { key = _KeyLabel(fKey); DrawKey(view, BRect(x-2, rect.top+1, x+font.StringWidth(key)+2, rect.bottom-1), key); } }
void BStringColumn::DrawField(BField* _field, BRect rect, BView* parent) { float width = rect.Width() - (2 * kTEXT_MARGIN); BStringField* field = static_cast<BStringField*>(_field); float fieldWidth = field->Width(); bool updateNeeded = width != fieldWidth; if (updateNeeded) { BString out_string(field->String()); float preferredWidth = parent->StringWidth(out_string.String()); if (width < preferredWidth) { parent->TruncateString(&out_string, fTruncate, width + 2); field->SetClippedString(out_string.String()); } else field->SetClippedString(""); field->SetWidth(width); } DrawString(field->HasClippedString() ? field->ClippedString() : field->String(), parent, rect); }
void BBox::_DrawPlain(BRect labelBox) { BRect rect = Bounds(); rect.top += TopBorderOffset(); float lightTint; float shadowTint; if (be_control_look != NULL) { lightTint = B_LIGHTEN_1_TINT; shadowTint = B_DARKEN_1_TINT; } else { lightTint = B_LIGHTEN_MAX_TINT; shadowTint = B_DARKEN_3_TINT; } if (rect.Height() == 0.0 || rect.Width() == 0.0) { // used as separator rgb_color shadow = tint_color(ViewColor(), B_DARKEN_2_TINT); SetHighColor(shadow); StrokeLine(rect.LeftTop(),rect.RightBottom()); } else { // used as box rgb_color light = tint_color(ViewColor(), lightTint); rgb_color shadow = tint_color(ViewColor(), shadowTint); BeginLineArray(4); AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.top), light); AddLine(BPoint(rect.left + 1.0f, rect.top), BPoint(rect.right, rect.top), light); AddLine(BPoint(rect.left + 1.0f, rect.bottom), BPoint(rect.right, rect.bottom), shadow); AddLine(BPoint(rect.right, rect.bottom - 1.0f), BPoint(rect.right, rect.top + 1.0f), shadow); EndLineArray(); } }