本文整理汇总了C++中BRect::LeftTop方法的典型用法代码示例。如果您正苦于以下问题:C++ BRect::LeftTop方法的具体用法?C++ BRect::LeftTop怎么用?C++ BRect::LeftTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRect
的用法示例。
在下文中一共展示了BRect::LeftTop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void OptionsPanel :: Draw( BRect r )
{
inherited::Draw( r ) ;
r = Bounds() ;
BeginLineArray( 1 ) ;
AddLine( r.LeftTop() , r.RightTop() , Colours::Grey85 ) ;
EndLineArray( ) ;
}
示例2: truncatedString
// 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: radii
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: Frame
// 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:
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:
// PositionMarkerAt
void
ColorField::PositionMarkerAt(BPoint where)
{
BRect rect = _BitmapRect();
where.ConstrainTo(rect);
where -= rect.LeftTop();
fLastMarkerPosition = fMarkerPosition;
fMarkerPosition = where;
Invalidate();
}
示例7:
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);
}
示例8: if
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;
}
示例9: Draw
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);
}
示例10: testSetDrawingMode
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);
}
示例11: SetConfig
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();
}
}
示例12: DrawItem
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());
}
}
示例13: 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();
}
}
示例14: Outline
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);
}
示例15: screen
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());
}
}