コード例 #1
0
ファイル: OptionsPanel.cpp プロジェクト: HaikuArchives/TraX
void OptionsPanel :: Draw( BRect r )
{
	inherited::Draw( r ) ;
	
	r = Bounds() ;
	BeginLineArray( 1 ) ;
	AddLine( r.LeftTop()    , r.RightTop()    , Colours::Grey85 ) ;
	EndLineArray( ) ;
}
コード例 #2
0
ファイル: StyleListView.cpp プロジェクト: AmirAbrams/haiku
	// SimpleItem interface
	virtual	void Draw(BView* owner, BRect itemFrame, uint32 flags)
	{
		SimpleItem::DrawBackground(owner, itemFrame, flags);

		// text
		if (IsSelected())
			owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
		else
			owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
		font_height fh;
		owner->GetFontHeight(&fh);
		BString truncatedString(Text());
		owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
			itemFrame.Width() - kBorderOffset - kMarkWidth - kTextOffset
			- kBorderOffset);
		float height = itemFrame.Height();
		float textHeight = fh.ascent + fh.descent;
		BPoint pos;
		pos.x = itemFrame.left + kBorderOffset + kMarkWidth + kTextOffset;
		pos.y = itemFrame.top + ceilf((height - textHeight) / 2.0 + fh.ascent);
		owner->DrawString(truncatedString.String(), pos);

		if (!fMarkEnabled)
			return;

		// mark
		BRect markRect = itemFrame;
		float markRectBorderTint = B_DARKEN_1_TINT;
		float markRectFillTint = 1.04;
		float markTint = B_DARKEN_4_TINT;
					// Dark Themes
		rgb_color lowColor = owner->LowColor();
		if (lowColor.red + lowColor.green + lowColor.blue < 128 * 3) {
			markRectBorderTint = B_LIGHTEN_2_TINT;
			markRectFillTint = 0.85;
			markTint = 0.1;
		}
		markRect.left += kBorderOffset;
		markRect.right = markRect.left + kMarkWidth;
		markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
		markRect.bottom = markRect.top + kMarkWidth;
		owner->SetHighColor(tint_color(owner->LowColor(), markRectBorderTint));
		owner->StrokeRect(markRect);
		markRect.InsetBy(1, 1);
		owner->SetHighColor(tint_color(owner->LowColor(), markRectFillTint));
		owner->FillRect(markRect);
		if (fMarked) {
			markRect.InsetBy(2, 2);
			owner->SetHighColor(tint_color(owner->LowColor(),
				markTint));
			owner->SetPenSize(2);
			owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
			owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
			owner->SetPenSize(1);
		}
	}
コード例 #3
0
ファイル: PicturePlayer.cpp プロジェクト: AmirAbrams/haiku
static void
draw_ellipse(void* _context, const BRect& rect, bool fill)
{
	adapter_context* context = reinterpret_cast<adapter_context*>(_context);
	BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f);
	BPoint center = rect.LeftTop() + radii;
	((void (*)(void*, BPoint, BPoint))
		context->function_table[fill ? 12 : 11])(context->user_data, center,
			radii);
}
コード例 #4
0
ファイル: PopupSlider.cpp プロジェクト: mmanley/Antares
// layout
BRect
PopupSlider::layout(BRect frame)
{
	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(), frame.Height());

	fSliderButtonRect.OffsetTo(Bounds().right - fSliderButtonRect.Width(),
							   fSliderButtonRect.top);
	return Frame();
}
コード例 #5
0
BPoint
TReplicantShelf::AdjustReplicantBy(BRect frame, BMessage* message) const
{
	// added in AcceptAddon, from TReplicantTray
	BPoint point;
	message->FindPoint("_pjp_loc", &point);
	message->RemoveName("_pjp_loc");

	return point - frame.LeftTop();
}
コード例 #6
0
int32
Controller::CaptureThread()
{
	Settings settings;
	BScreen screen;
	BRect bounds = settings.CaptureArea();
	bigtime_t captureDelay = (bigtime_t)settings.CaptureFrameDelay() * 1000;
	
	// TODO: Validate captureDelay with some limits
	
	_DumpSettings();
	_TestWaitForRetrace();
	
	const int32 windowBorder = settings.WindowFrameBorderSize();
	int32 token = GetWindowTokenForFrame(bounds, windowBorder);
	bigtime_t waitTime = 0;
	status_t error = B_ERROR;
	while (!fKillThread) {
		if (!fPaused) {		
			if (token != -1) {
				BRect windowBounds = GetWindowFrameForToken(token, windowBorder);
				if (windowBounds.IsValid())
					bounds.OffsetTo(windowBounds.LeftTop());
			}
				
			_WaitForRetrace(captureDelay); // Wait for Vsync
			BBitmap *bitmap = new BBitmap(bounds, screen.ColorSpace());
			error = ReadBitmap(bitmap, true, bounds);
			bigtime_t currentTime = system_time();
			// Takes ownership of the bitmap
	    	if (error == B_OK && fFileList->AddItem(bitmap, currentTime))
				atomic_add(&fNumFrames, 1);
			else {
				delete bitmap;
				break;
			}
		} else
			snooze(500000);
	}
	
	fCaptureThread = -1;
	fKillThread = true;
	
	if (error != B_OK) {
		BMessage message(kMsgControllerCaptureStopped);
		message.AddInt32("status", (int32)error);
		SendNotices(kMsgControllerCaptureStopped, &message);
		
		delete fFileList;
		fFileList = NULL;
	}
		
	return B_OK;
}
コード例 #7
0
ファイル: ColorField.cpp プロジェクト: AmirAbrams/haiku
// PositionMarkerAt
void
ColorField::PositionMarkerAt(BPoint where)
{
	BRect rect = _BitmapRect();
	where.ConstrainTo(rect);
	where -= rect.LeftTop();

	fLastMarkerPosition = fMarkerPosition;
	fMarkerPosition = where;
	Invalidate();
}
コード例 #8
0
ファイル: ToolBar.cpp プロジェクト: kodybrown/haiku
BToolBar::BToolBar(BRect frame, orientation ont)
	:
	BGroupView(ont),
	fOrientation(ont)
{
	_Init();

	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(), frame.Height());
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
}
コード例 #9
0
ファイル: Shelf.cpp プロジェクト: mariuz/haiku
filter_result
ShelfContainerViewFilter::_ObjectDropFilter(BMessage *msg, BHandler **_handler)
{
	BView *mouseView = NULL;
	if (*_handler)
		mouseView = dynamic_cast<BView*>(*_handler);

	if (msg->WasDropped()) {
		if (!fShelf->fAllowDragging) {
			printf("Dragging replicants isn't allowed to this shelf.");
			beep();
			return B_SKIP_MESSAGE;
		}
	}

	BPoint point;
	BPoint offset;

	if (msg->WasDropped()) {
		point = msg->DropPoint(&offset);
		point = mouseView->ConvertFromScreen(point - offset);
	}

	BLooper *looper = NULL;
	BHandler *handler = msg->ReturnAddress().Target(&looper);

	if (Looper() == looper) {
		BDragger *dragger = NULL;
		if (handler)
			dragger = dynamic_cast<BDragger*>(handler);

		BRect rect;
		if (dragger->fRelation == BDragger::TARGET_IS_CHILD)
			rect = dragger->Frame();
		else
			rect = dragger->fTarget->Frame();
		rect.OffsetTo(point);
		point = rect.LeftTop() + fShelf->AdjustReplicantBy(rect, msg);

		if (dragger->fRelation == BDragger::TARGET_IS_PARENT)
			dragger->fTarget->MoveTo(point);
		else if (dragger->fRelation == BDragger::TARGET_IS_CHILD)
			dragger->MoveTo(point);
		else {
			//TODO: TARGET_UNKNOWN/TARGET_SIBLING
		}

	} else {
		if (fShelf->_AddReplicant(msg, &point, fShelf->fGenCount++) == B_OK)
			Looper()->DetachCurrentMessage();
	}

	return B_SKIP_MESSAGE;
}
コード例 #10
0
void TPanelWindowView::Draw( BRect updateRect )
{
	BRegion Region;
	Region.Include(updateRect);
	ConstrainClippingRegion(&Region);

	float w, h;

	w = Bounds().Width();
	h = Bounds().Height();

	SetHighColor( fColor2 );
	FillRect( BRect( 0, 0, h, h ) );
	FillRect( BRect( w-h, 0, w, h ) );

	FillRect( BRect( h/2, 0, w-(h/2), h/2) );
	FillRect( BRect( 0, h/2, w, h ) );

	SetHighColor( 196, 196, 176 );
	FillRect( BRect( 0, h - 2, w, h ) );

	fPanels.Lock();
	for ( int i=0; i<fPanels.CountItems(); i++ )
	{
		TInnerPanel *panel = fPanels.ItemAt(i);
		if ( panel->Frame().Intersects( updateRect ) )
		{
			BRect rect( panel->Frame() );
			if ( rect.left < updateRect.left )
				rect.left = updateRect.left;
			if ( rect.right > updateRect.right )
				rect.right = updateRect.right;
			if ( rect.top < updateRect.top )
				rect.top = updateRect.top;
			if ( rect.bottom > updateRect.bottom )
				rect.bottom = updateRect.bottom;
			panel->Draw(rect);
		}
	}
	fPanels.Unlock();

	if ( fDrawOuterFrame )
	{
		SetDrawingMode( B_OP_COPY );
		SetHighColor( fOuterFrameColor );

		BRect bounds = Bounds();
		StrokeLine( bounds.LeftTop(), bounds.RightTop() );
		StrokeLine( bounds.LeftTop(), bounds.LeftBottom() );
		StrokeLine( bounds.RightTop(), bounds.RightBottom() );
	}

	ConstrainClippingRegion(NULL);
}
コード例 #11
0
ファイル: PictureTestCases.cpp プロジェクト: mariuz/haiku
static void testSetDrawingMode(BView *view, BRect frame)
{
	frame.InsetBy(2, 2);
	view->StrokeLine(frame.LeftTop(), frame.RightBottom());
	view->StrokeLine(frame.LeftBottom(), frame.RightTop());
	view->SetDrawingMode(B_OP_ALPHA);
	rgb_color color = kRed;
	color.alpha = 127;	
	view->SetHighColor(color);
	view->FillRect(frame, B_SOLID_HIGH);
}
コード例 #12
0
void SetConfig(void *data, BMessage *config)
{
	GlSpectrumAnalyzerWindow *win=(GlSpectrumAnalyzerWindow *)data;
	BRect frame;
	if(B_OK==config->FindRect("frame",&frame))
	{
		win->Lock();
		win->MoveTo(frame.LeftTop());
		win->Unlock();
	}
}
コード例 #13
0
ファイル: ContactItem.cpp プロジェクト: HaikuArchives/Bme
void ContactItem::DrawItem(BView *owner, BRect itemRect, bool drawEverything)
{
	BString name = m_contact->FriendlyName();
	Status *status = m_contact->GetStatus();
	//draw status icon
	BBitmap *statusBitmap = status->GetStatusIcon();
	
	owner->SetDrawingMode(B_OP_OVER);
	float bitmapWidth = (statusBitmap->Bounds()).Width();
	BRect fillRect = itemRect;
	itemRect.left += bitmapWidth;

	//if selected
	if(IsSelected())
		owner->SetHighColor(ui_color(B_MENU_SELECTION_BACKGROUND_COLOR));
	else
		owner->SetHighColor(255,255,255);	
	owner->FillRect(fillRect);
	
	owner->SetDrawingMode(B_OP_ALPHA);
	if (statusBitmap)
		owner->DrawBitmap(statusBitmap, itemRect.LeftTop() + BPoint(0.0f,1.0f));
	
	//draw name(with emoticons)
	float textHeight = 12.0f;			
	BFont normal;
	owner->SetFont(&normal);
	owner->SetHighColor(0,0,0);
	owner->SetDrawingMode(B_OP_ALPHA);
	owner->DrawString(name.String(), itemRect.LeftTop() + BPoint(bitmapWidth + 5.0f, 1.0f + textHeight));
	//draw personal message, if available
	if (m_contact->HasPersonalMessage())
	{
		owner->DrawString(" - ");
		BFont italic;
		italic.SetFace(B_ITALIC_FACE); 
		owner->SetFont(&italic);	
		BString personalMessage = m_contact->PersonalMessage();
		owner->DrawString(personalMessage.String());
	}
}
コード例 #14
0
ファイル: PrintJob.cpp プロジェクト: mariuz/haiku
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(&region);

	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(&region);
		view->fIsPrinting = true;
		view->DrawAfterChildren(rect);
		view->fIsPrinting = false;
		view->PopState();
		view->EndPicture();
	}
}
コード例 #15
0
ファイル: TCuePosition.cpp プロジェクト: ModeenF/UltraDV
void TCuePosition::Outline(BRect outline)
{
	// Use the rect for the four corners
	Corner1(outline.LeftTop());
	Corner2(outline.RightTop());
	Corner3(outline.RightBottom());
	Corner4(outline.LeftBottom());

	// Set the registration in the center
	BPoint center(outline.left + outline.Width() / 2, outline.top +
			outline.Height() / 2);
	Registration(center);
}
コード例 #16
0
ファイル: RouteWindow.cpp プロジェクト: mariuz/haiku
void
RouteWindow::_constrainToScreen()
{
	D_INTERNAL(("RouteWindow::_constrainToScreen()\n"));

	BScreen screen(this);
	BRect screenRect = screen.Frame();
	BRect windowRect = Frame();

	// if the window is outside the screen rect
	// move it to the default position
	if (!screenRect.Intersects(windowRect)) {
		windowRect.OffsetTo(screenRect.LeftTop());
		MoveTo(windowRect.LeftTop());
		windowRect = Frame();
	}

	// if the window is larger than the screen rect
	// resize it to fit at each side
	if (!screenRect.Contains(windowRect)) {
		if (windowRect.left < screenRect.left) {
			windowRect.left = screenRect.left + 5.0;
			MoveTo(windowRect.LeftTop());
			windowRect = Frame();
		}
		if (windowRect.top < screenRect.top) {
			windowRect.top = screenRect.top + 5.0;
			MoveTo(windowRect.LeftTop());
			windowRect = Frame();
		}
		if (windowRect.right > screenRect.right) {
			windowRect.right = screenRect.right - 5.0;
		}
		if (windowRect.bottom > screenRect.bottom) {
			windowRect.bottom = screenRect.bottom - 5.0;
		}
		ResizeTo(windowRect.Width(), windowRect.Height());
	}
}
コード例 #17
0
ファイル: HDialog.cpp プロジェクト: HaikuArchives/Pe
void HDialog::Hide()
{
	BRect frame = Frame();
	if (!IsHidden() && fPlacement == H_PLACE_LAST_POS && frame != fInitialFrame)
	{	// store dialog's position only if changed since last time
		string dlgRect = string("dialog ") + Name() + " rect";
		string dlgOrigin = string("dialog ") + Name() + " origin";
		char origin[3] = "";
		BRect cr = fOwner ? fOwner->Frame() : CallerFrame(fCaller);
		if (cr.IsValid())
		{
			// store coordinates relative to closest corner of owner-frame:
			origin[0] =
				(fabs(cr.left-frame.left) < fabs(frame.left-cr.right))
					? 'L'
					: 'R';
			origin[1] =
				(fabs(cr.top-frame.top) < fabs(frame.top-cr.bottom))
					? 'T'
					: 'B';
			origin[2] = '\0';
			if (!strcmp(origin, "LT"))
				frame.OffsetTo(frame.LeftTop()-cr.LeftTop());
			else if (!strcmp(origin, "RT"))
				frame.OffsetTo(frame.LeftTop()-cr.RightTop());
			else if (!strcmp(origin, "LB"))
				frame.OffsetTo(frame.LeftTop()-cr.LeftBottom());
			else if (!strcmp(origin, "RB"))
				frame.OffsetTo(frame.LeftTop()-cr.RightBottom());
		}
		if (origin[0] == '\0')
			gPrefs->RemovePref(dlgOrigin.c_str());
		else
			gPrefs->SetPrefString(dlgOrigin.c_str(), origin);
		gPrefs->SetPrefRect(dlgRect.c_str(), frame);
	}
	BWindow::Hide();
}
コード例 #18
0
ファイル: HTabSheet.cpp プロジェクト: jscipione/Paladin
void HTabSheet::Draw(BRect update)
{
	BRect f;
	BPoint p;

	font_height fh;
	be_plain_font->GetHeight(&fh);

	f = fClientArea;
	f.top = fListArea.top;
	f.bottom = ceil(fClientArea.top - 8 * gFactor);

	f.InsetBy(2, 2);
	
	SetLowColor(0x77, 0xdd, 0xdd);
	FillRect(f, B_SOLID_LOW);

	p.x = f.left + 4;
	p.y = f.bottom - fh.descent;
	DrawString((char *)fDescs.ItemAt(fCurrent), p);
	SetLowColor(ViewColor());

	BeginLineArray(8);

	f.InsetBy(-2, -2);
	AddLine(f.LeftTop(), f.RightTop(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	AddLine(f.LeftTop(), f.LeftBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	AddLine(f.RightTop(), f.RightBottom(), kWhite);
	AddLine(f.LeftBottom(), f.RightBottom(), kWhite);
	
	f.InsetBy(1, 1);
	AddLine(f.LeftTop(), f.RightTop(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
	AddLine(f.LeftTop(), f.LeftBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
	AddLine(f.RightTop(), f.RightBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	AddLine(f.LeftBottom(), f.RightBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	
	EndLineArray();
} /* HTabSheet::Draw */
コード例 #19
0
void
Preferences::LoadWindowFrame(BWindow* window, const char* name)
{
	Lock();

	BRect frame;
	if (FindRect(name, &frame) == B_OK) {
		window->MoveTo(frame.LeftTop());
		window->ResizeTo(frame.Width(), frame.Height());
		make_window_visible(window);
	}

	Unlock();
}
コード例 #20
0
ファイル: SplitView.cpp プロジェクト: HaikuArchives/Album
/**
	Lays out child views.
*/
void SplitView::Arrange()
{
	fLayout.Frame()= Bounds();
	fLayout.Reset();
	BView *child;
	uint32 hint = LAYOUT_HINT_NONE;
	for (int32 i = 0; (child = ChildAt(i)); i++) {
		if (i == CountChildren() - 1)
			hint |= (LAYOUT_HINT_LAST | LAYOUT_HINT_CLIP);
		BRect frame = fLayout.Next(child->Frame(), hint);
		child->MoveTo(frame.LeftTop());
		child->ResizeTo(frame.Width(), frame.Height());
	}
}
コード例 #21
0
ファイル: ColorField.cpp プロジェクト: mariuz/haiku
// layout
BRect
ColorField::layout(BRect frame)
{
	MoveTo(frame.LeftTop());

	// reposition marker
	fMarkerPosition.x *= (frame.Width() - 4.0) / (Bounds().Width() - 4.0);
	fMarkerPosition.y *= (frame.Height() - 4.0) / (Bounds().Height() - 4.0);

	ResizeTo(frame.Width(), frame.Height());
	_DrawBorder();
	Update(3);
	return Frame();
}
コード例 #22
0
            bool    Init(BRect frame, agg::platform_support* agg, agg::pix_format_e format,
                              bool flipY, uint32 flags)
                    {
                        MoveTo(frame.LeftTop());
                        ResizeTo(frame.Width(), frame.Height());

                        SetFlags(flags);

                        frame.OffsetTo(0.0, 0.0);
                        fView = new AGGView(frame, agg, format, flipY);
                        AddChild(fView);

                        return fView->Bitmap() != NULL;
                    }
コード例 #23
0
void
TPeopleApp::_SavePreferences(BMessage* message) const
{
	BRect frame;
	if (message->FindRect("frame", &frame) != B_OK)
		return;

	BPoint leftTop = frame.LeftTop();

	if (fPrefs != NULL) {
		fPrefs->Seek(0, 0);
		fPrefs->Write(&leftTop, sizeof(BPoint));
	}
}
コード例 #24
0
BToolbar::BToolbar(BRect frame, orientation ont)
	:
	BGroupView(ont),
	fOrientation(ont)
{
	float inset = ceilf(be_control_look->DefaultItemSpacing() / 2);
	GroupLayout()->SetInsets(inset, 0, inset, 0);
	GroupLayout()->SetSpacing(1);

	SetFlags(Flags() | B_FRAME_EVENTS | B_PULSE_NEEDED);

	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(), frame.Height());
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
}
コード例 #25
0
//------------------------------------------------------------------------------
void	TCErisoApp::AboutRequested()
{
	BRect		aWinFrame;

	if ( mAboutWin == NULL ) {
		aWinFrame = mCErisoWin->Frame();
		aWinFrame.top += FUC_HEIGHT_WIN_TAB;
		mAboutWin = new TSHINTAAboutWindow(aWinFrame);
		mAboutWin->IntelligentMoveTo(aWinFrame.LeftTop());
		mAboutWin->SetAppInfo(gAppNameEnUs, gAppVer, gCright);
		mAboutWin->SetTranslatorInfo(LKK_ABOUT_TRANSLATOR_INFO);
		mAboutWin->SetIAPRef(&gIAPs);
	}
	mAboutWin->Appear();
}
コード例 #26
0
    // SimpleItem interface
    virtual	void	Draw(BView* owner, BRect itemFrame, uint32 flags)
    {
        SimpleItem::DrawBackground(owner, itemFrame, flags);

        // text
        owner->SetHighColor(0, 0, 0, 255);
        font_height fh;
        owner->GetFontHeight(&fh);
        BString truncatedString(Text());
        owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
                              itemFrame.Width()
                              - kBorderOffset
                              - kMarkWidth
                              - kTextOffset
                              - kBorderOffset);
        float height = itemFrame.Height();
        float textHeight = fh.ascent + fh.descent;
        BPoint pos;
        pos.x = itemFrame.left
                + kBorderOffset + kMarkWidth + kTextOffset;
        pos.y = itemFrame.top
                + ceilf((height - textHeight) / 2.0 + fh.ascent);
        owner->DrawString(truncatedString.String(), pos);

        if (!fMarkEnabled)
            return;

        // mark
        BRect markRect = itemFrame;
        markRect.left += kBorderOffset;
        markRect.right = markRect.left + kMarkWidth;
        markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
        markRect.bottom = markRect.top + kMarkWidth;
        owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_1_TINT));
        owner->StrokeRect(markRect);
        markRect.InsetBy(1, 1);
        owner->SetHighColor(tint_color(owner->LowColor(), 1.04));
        owner->FillRect(markRect);
        if (fMarked) {
            markRect.InsetBy(2, 2);
            owner->SetHighColor(tint_color(owner->LowColor(),
                                           B_DARKEN_4_TINT));
            owner->SetPenSize(2);
            owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
            owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
            owner->SetPenSize(1);
        }
    }
コード例 #27
0
ファイル: Group.cpp プロジェクト: AmirAbrams/haiku
// _LayoutControl
void
Group::_LayoutControl(BView* view, BRect frame,
					  bool resizeWidth, bool resizeHeight) const
{
	if (!resizeHeight)
		// center vertically
		frame.top = (frame.top + frame.bottom) / 2.0 - view->Bounds().Height() / 2.0;
	if (!resizeWidth)
		// center horizontally
		frame.left = (frame.left + frame.right) / 2.0 - view->Bounds().Width() / 2.0;
	view->MoveTo(frame.LeftTop());
	float width = resizeWidth ? frame.Width() : view->Bounds().Width();
	float height = resizeHeight ? frame.Height() : view->Bounds().Height();
	if (resizeWidth || resizeHeight)
		view->ResizeTo(width, height);
}
コード例 #28
0
//------------------------------------------------------------------------------
void	TCErisoApp::MItemRangeIDClicked()
{
	BRect		aWinFrame;

	if ( mRangeIDWin == NULL ) {
		aWinFrame = mCErisoWin->Frame();
		aWinFrame.top += FUC_HEIGHT_WIN_TAB;
		mRangeIDWin = new TSimpleInputWindow(aWinFrame);
		mRangeIDWin->IntelligentMoveTo(aWinFrame.LeftTop());
		mRangeIDWin->SetMessage(new BMessage(RANGE_ID_REQUESTED));
		mRangeIDWin->SetTarget(mCErisoWin);
		SetRangeIDWindowLabels();
	}
	mRangeIDWin->SetText(mCErisoWin->StartID().c_str());
	mRangeIDWin->Appear();
}
コード例 #29
0
ファイル: InterfaceWindow.cpp プロジェクト: FLYKingdom/vlc
// set_window_pos
void
set_window_pos( BWindow* window, BRect frame )
{
    // sanity checks: make sure window is not too big/small
    // and that it's not off-screen
    float minWidth, maxWidth, minHeight, maxHeight;
    window->GetSizeLimits( &minWidth, &maxWidth, &minHeight, &maxHeight );

    make_sure_frame_is_within_limits( frame,
                                      minWidth, minHeight, maxWidth, maxHeight );
    if ( make_sure_frame_is_on_screen( frame ) )
    {
        window->MoveTo( frame.LeftTop() );
        window->ResizeTo( frame.Width(), frame.Height() );
    }
}
コード例 #30
0
ファイル: EditAction.cpp プロジェクト: czeidler/ALEditor
bool
InsertionIntoEmptyArea::FindOptimalArea(BPoint point, BRect dragFrame,
	Area* movedArea)
{
	BALM::area_ref emptyArea;
	BALM::area_ref availableSpace;
	bool result = FindOptimalAreaFor(point, dragFrame, fPreferredSize,
		fMinSize, emptyArea, availableSpace, movedArea);
	if (!result)
		 return false;

	fEmptyArea.SetTo(emptyArea, fView->Layout());
	fAvailableArea.SetTo(availableSpace, fView->Layout());
	fFreePosition = dragFrame.LeftTop();
	return true;
}