本文整理汇总了C++中BRect::Intersects方法的典型用法代码示例。如果您正苦于以下问题:C++ BRect::Intersects方法的具体用法?C++ BRect::Intersects怎么用?C++ BRect::Intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRect
的用法示例。
在下文中一共展示了BRect::Intersects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawInMarker
void TExportZone::DrawInMarker(BRect updateRect)
{
// Set up environment
PushState();
BPoint drawPt;
// Draw left marker
if (updateRect.Intersects(m_InRect) )
{
// Draw indicator in new location
drawPt.Set(m_InRect.left, m_InRect.top);
DrawBitmap(m_InMarker, drawPt);
}
// Draw right marker
if (updateRect.Intersects(m_OutRect) )
{
// Draw indicator in new location
drawPt.Set(m_OutRect.left, m_OutRect.top);
DrawBitmap(m_OutMarker, drawPt);
}
// Restore environment
PopState();
}
示例2:
void
TabDecorator::_DrawButtons(Decorator::Tab* tab, const BRect& invalid)
{
STRACE(("TabDecorator: _DrawButtons\n"));
// Draw the buttons if we're supposed to
if (!(tab->flags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect))
_DrawClose(tab, false, tab->closeRect);
if (!(tab->flags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect))
_DrawZoom(tab, false, tab->zoomRect);
}
示例3: Bounds
void
PieView::_DrawPieChart(BRect updateRect)
{
BRect pieRect = Bounds();
if (!updateRect.Intersects(pieRect))
return;
pieRect.InsetBy(kPieOuterMargin, kPieOuterMargin);
SetHighColor(kPieBGColor);
FillRect(updateRect);
// constraint proportions
if (pieRect.Width() > pieRect.Height()) {
float moveBy = (pieRect.Width() - pieRect.Height()) / 2;
pieRect.left += moveBy;
pieRect.right -= moveBy;
} else {
float moveBy = (pieRect.Height() - pieRect.Width()) / 2;
pieRect.top -= moveBy;
pieRect.bottom += moveBy;
}
int colorIdx = 0;
FileInfo* currentDir = fScanner->CurrentDir();
FileInfo* parent = currentDir;
while (parent != NULL) {
parent = parent->parent;
colorIdx++;
}
_DrawDirectory(pieRect, currentDir, 0.0, 0.0,
colorIdx % kBasePieColorCount, 0);
}
示例4:
void
WinDecorator::_DrawButtons(Decorator::Tab* tab, const BRect& invalid)
{
if ((tab->flags & B_NOT_MINIMIZABLE) == 0
&& invalid.Intersects(tab->minimizeRect)) {
_DrawMinimize(tab, false, tab->minimizeRect);
}
if ((tab->flags & B_NOT_ZOOMABLE) == 0
&& invalid.Intersects(tab->zoomRect)) {
_DrawZoom(tab, false, tab->zoomRect);
}
if ((tab->flags & B_NOT_CLOSABLE) == 0
&& invalid.Intersects(tab->closeRect)) {
_DrawClose(tab, false, tab->closeRect);
}
}
示例5: Arrange
/**
Lays out items one after another.
*/
void AlbumView::Arrange(bool invalidate)
{
// scale back the page relative to zoom ratio
BRect bounds = Bounds();
bounds.left /= fZoom;
bounds.top /= fZoom;
bounds.right /= fZoom;
bounds.bottom /= fZoom;
FlowLayout layout(bounds.OffsetToCopy(0,0), fColumns);
layout.SetSpacing(1,1);
// The entire set must be examined.
float width = 0;
float height = 0;
AlbumItem *item;
for (int32 i = 0; (item = ItemAt(i)); i++) {
if (!IsItemVisible(item))
continue;
BRect frame0 = item->Frame();
// separator
uint32 hint = item->Flags() & ALBUMITEM_SEPARATOR ? LAYOUT_HINT_BREAK : 0;
BRect frame = layout.Next(frame0, hint);
if (hint == LAYOUT_HINT_BREAK) {
// shift the last frame, so we get a gap in the layout
layout.Last().OffsetBy(0,fSeparatorHeight);
frame = layout.Last();
}
if (frame != frame0) {
// rects outside the bounds are new
if (invalidate && bounds.Intersects(frame0) && frame0.left >= 0) {
// clear the old rect
Invalidate(Adjust(frame0));
}
// reposition to the new location
item->SetFrame(frame);
if (invalidate && bounds.Intersects(frame)) {
// show on the new location
Invalidate(Adjust(frame));
}
}
if (frame.right > width)
width = frame.right;
if (frame.bottom > height)
height = frame.bottom;
}
SetPageBounds(BRect(0,0,width,height));
}
示例6: DrawOffscreen
/**
Renders all visible items.
*/
void AlbumView::DrawOffscreen(BView *view, BRect update)
{
view->SetScale(fZoom);
AlbumItem *item;
for (int i = 0; (item = ItemAt(i)); i++) {
if (IsItemVisible(item) && update.Intersects(Adjust(item->Frame()))) {
item->DrawItem(view);
}
}
}
示例7: iconRect
void
LeftView::Draw(BRect updateRect)
{
float right = Bounds().Width() - kSmallHMargin;
BRect iconRect(right - 31.0, kSmallVMargin, right, kSmallVMargin + 31.0);
if (updateRect.Intersects(iconRect)) {
SetDrawingMode(B_OP_OVER);
DrawBitmap(fIcon, iconRect);
}
}
示例8:
void
WinDecorator::_DrawTab(BRect invalid)
{
// If a window has a tab, this will draw it and any buttons which are
// in it.
if (!fTabRect.IsValid() || !invalid.Intersects(fTabRect) || fLook==B_NO_BORDER_WINDOW_LOOK)
return;
fDrawingEngine->FillRect(fTabRect,tab_highcol);
_DrawTitle(fTabRect);
// Draw the buttons if we're supposed to
// TODO : we should still draw the buttons if they are disabled, but grey them out
if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(fCloseRect))
_DrawClose(fCloseRect);
if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(fZoomRect))
_DrawZoom(fZoomRect);
}
示例9: bounds
void
TTimeWindow::_AlignWindow()
{
BPoint pt = TimeSettings().LeftTop();
MoveTo(pt);
BRect frame = Frame();
BRect screen = BScreen().Frame();
if (!frame.Intersects(screen.InsetByCopy(50.0, 50.0))) {
BRect bounds(Bounds());
BPoint leftTop((screen.Width() - bounds.Width()) / 2.0,
(screen.Height() - bounds.Height()) / 2.0);
MoveTo(leftTop);
}
}
示例10: Draw
void Slider::Draw (BRect rect)
{
BRect label = BRect (0, 0, sep, height);
if (rect.Intersects (label)) // Label needs to be redrawn
{
SetLowColor (LightGrey);
SetHighColor (Black);
FillRect (label, B_SOLID_LOW);
DrawString (name, BPoint (0, label.bottom - 5));
}
offslid->Lock ();
offview->SetHighColor (Grey21);
offview->FillRect (bounds);
offview->SetHighColor (Grey30);
offview->StrokeLine (bounds.RightTop (), bounds.RightBottom ());
offview->StrokeLine (bounds.LeftBottom ());
offview->SetHighColor (Grey14);
offview->StrokeLine (bounds.LeftTop ());
offview->StrokeLine (bounds.RightTop ());
knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1);
knob = BRect (knobpos.x + 1, knobpos.y + 1, knobpos.x + knobsize - 2, knobpos.y + height - 2);
offview->SetHighColor (Grey27);
offview->FillRect (knob);
offview->SetHighColor (Black);
offview->SetLowColor (Grey27);
offview->SetFont (be_plain_font);
char val[KNOBVAL];
sprintf (val, fmt, value);
offview->DrawString (val, BPoint (knobpos.x + (knobsize - StringWidth (val))/2 + 1, knobpos.y + 12));
offview->SetHighColor (Grey30);
offview->StrokeLine (BPoint (knobpos.x + knobsize - 1, knobpos.y), BPoint (knobpos.x + 1, knobpos.y));
offview->StrokeLine (BPoint (knobpos.x + 1, knobpos.y + height - 2));
offview->SetHighColor (Grey13);
offview->StrokeLine (BPoint (knobpos.x + knobsize - 1, knobpos.y + height - 2));
offview->StrokeLine (BPoint (knobpos.x + knobsize - 1, knobpos.y));
if (IsFocus())
{
// printf ("%s focused!\n", Name());
BRect k (knobpos.x, knobpos.y - 1, knobpos.x + knobsize - 1, knobpos.y + height - 2);
k.InsetBy (1, 1);
offview->SetHighColor (ui_color (B_KEYBOARD_NAVIGATION_COLOR));
offview->StrokeRect (k);
}
offview->Sync ();
offslid->Unlock ();
DrawBitmapAsync (offslid, BPoint (sep, 0));
}
示例11: Draw
/**
Draws all spliters.
*/
void SplitView::Draw(BRect update)
{
BView *child;
for (int i = 0; i < CountChildren() -1; i++) {
child = ChildAt(i);
BRect frame = child->Frame();
if (fLayout.Mode() == B_HORIZONTAL) {
frame.left = frame.right+1;
frame.right = frame.left + fLayout.Spacing().x-2;
}
else {
frame.top = frame.bottom+1;
frame.bottom = frame.top + fLayout.Spacing().y-2;
}
if (frame.Intersects(update))
DrawSplitter(frame, child == fSelected && fDragged);
}
}
示例12:
void
BAbstractSpinner::_DrawTextView(BRect updateRect)
{
BRect rect = fTextView->Frame();
rect.InsetBy(-kFrameMargin, -kFrameMargin);
if (!rect.IsValid() || !rect.Intersects(updateRect))
return;
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
uint32 flags = 0;
if (!IsEnabled())
flags |= BControlLook::B_DISABLED;
if (fTextView->IsFocus() && Window()->IsActive())
flags |= BControlLook::B_FOCUSED;
be_control_look->DrawTextControlBorder(this, rect, updateRect, base,
flags);
}
示例13: Draw
void TElementsSorter::Draw(BRect updateRect)
{
PushState();
// Draw dummy header to the right of our rightmost TSorter
TSorterContainer* sorter = static_cast<TSorterContainer*>(fSorterList->ItemAt( fSorterList->CountItems()-1) );
if (sorter) {
BRect bounds = Bounds();
bounds.bottom = bounds.top + kSorterHeight;
bounds.left = sorter->Frame().right;
if (updateRect.Intersects(bounds) ) {
// Fill background
SetHighColor(kBeGrey);
FillRect(bounds);
// Frame it
BPoint endPt;
SetHighColor(kWhite);
MovePenTo(bounds.left, bounds.top+1);
endPt.Set( bounds.right, bounds.top+1 );
StrokeLine(endPt);
SetHighColor(kMediumGrey);
MovePenTo(bounds.left, bounds.bottom-1);
endPt.Set( bounds.right, bounds.bottom-1 );
StrokeLine(endPt);
SetHighColor(kBlack);
MovePenTo(bounds.left, bounds.top);
endPt.Set( bounds.right, bounds.top );
StrokeLine(endPt);
MovePenTo(bounds.left, bounds.bottom);
endPt.Set( bounds.right, bounds.bottom );
StrokeLine(endPt);
}
}
PopState();
}
示例14: Draw
void TextEntryAlertBackgroundView::Draw(BRect update_rect)
{
if(update_rect.Intersects(m_entry_text_rect))
{
SetHighColor(m_dark_1_color);
StrokeLine(BPoint(m_entry_text_rect.left,m_entry_text_rect.top),
BPoint(m_entry_text_rect.right,m_entry_text_rect.top));
StrokeLine(BPoint(m_entry_text_rect.left,m_entry_text_rect.top+1),
BPoint(m_entry_text_rect.left,m_entry_text_rect.bottom));
SetHighColor( ui_color(B_SHINE_COLOR));
StrokeLine(BPoint(m_entry_text_rect.right,m_entry_text_rect.top+1),
BPoint(m_entry_text_rect.right,m_entry_text_rect.bottom-1));
StrokeLine(BPoint(m_entry_text_rect.left+1,m_entry_text_rect.bottom),
BPoint(m_entry_text_rect.right,m_entry_text_rect.bottom));
SetHighColor( BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
StrokeLine(BPoint(m_entry_text_rect.left+1,m_entry_text_rect.top+1),
BPoint(m_entry_text_rect.right-1,m_entry_text_rect.top+1));
StrokeLine(BPoint(m_entry_text_rect.left+1,m_entry_text_rect.top+2),
BPoint(m_entry_text_rect.left+1,m_entry_text_rect.bottom-1));
}
}
示例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());
}
}