当前位置: 首页>>代码示例>>C++>>正文


C++ BView::Frame方法代码示例

本文整理汇总了C++中BView::Frame方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::Frame方法的具体用法?C++ BView::Frame怎么用?C++ BView::Frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BView的用法示例。


在下文中一共展示了BView::Frame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loc

BPoint
TReplicantTray::LocationForReplicant(int32 index, float width)
{
	BPoint loc(kIconGap + 1, kGutter + 1);

	if (fMultiRowMode) {
		// try to find free space in every row
		for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) {
			// determine free space in this row
			BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth - kIconGap
				- 2.0, loc.y + kMaxReplicantHeight);
			if (row == 0 && !fTime->IsHidden())
				rect.right -= fTime->Frame().Width() + kIconGap;

			for (int32 i = 0; i < index; i++) {
				BView* view = NULL;
				fShelf->ReplicantAt(i, &view);
				if (view == NULL || view->Frame().top != rect.top)
					continue;

				rect.left = view->Frame().right + kIconGap + 1;
			}

			if (rect.Width() >= width) {
				// the icon fits in this row
				loc = rect.LeftTop();
				break;
			}
		}
	} else {
		if (index > 0) {
			// get the last replicant added for placement reference
			BView* view = NULL;
			fShelf->ReplicantAt(index - 1, &view);
			if (view) {
				// push this rep placement past the last one
				loc.x = view->Frame().right + kIconGap + 1;
				loc.y = view->Frame().top;
			}
		}
	}

	if ((loc.y == fRightBottomReplicant.top && loc.x
		> fRightBottomReplicant.left) || loc.y > fRightBottomReplicant.top) {
		fRightBottomReplicant.Set(loc.x, loc.y, loc.x + width, loc.y
		+ kMaxReplicantHeight);
		fLastReplicant = index;
	}

	return loc;
}
开发者ID:RTOSkit,项目名称:haiku,代码行数:51,代码来源:StatusView.cpp

示例2: AttachedToWindow

void SnowView::AttachedToWindow()
{
	BView *p;
	rgb_color col;
	fAttached = true;
/*	if (!fMsgRunner)
		fMsgRunner = new BMessageRunner(BMessenger(this), 
					new BMessage(MSG_PULSE_ME), 
					INTERVAL);
*/
	p = Parent();
	if (p)
		col = B_TRANSPARENT_32_BIT;//Parent()->ViewColor();
	else
		col = ui_color(B_PANEL_BACKGROUND_COLOR);
	SetViewColor(col);
//	BScreen bs;
//	fCachedWsWidth = bs.Frame().IntegerWidth();
//	fCachedWsHeight = bs.Frame().IntegerHeight();
	fDragger = dynamic_cast<BDragger *>(FindView("_dragger_"));
	if (fDragger && p) {
		fCachedParent = p;
		fCachedWsWidth = p->Frame().IntegerWidth();
		fCachedWsHeight = p->Frame().IntegerHeight();
		fDragger->SetViewColor(col);
		if (fDragger->InShelf()) {
			p->SetFlags(p->Flags() | B_DRAW_ON_CHILDREN);
#ifdef B_BEOS_VERSION_DANO
			p->SetDoubleBuffering(p->DoubleBuffering() | B_UPDATE_EXPOSED);
#endif
			ResizeTo(p->Bounds().Width(), p->Bounds().Height());
			MoveTo(0,0);
			fDragger->MoveTo(p->Bounds().Width()-7, p->Bounds().Height()-7);
		}
		BRect fallenRect(p->Bounds());
		fallenRect.top = fallenRect.bottom - FALLEN_HEIGHT;
		fFallenBmp = new BBitmap(fallenRect, B_BITMAP_ACCEPTS_VIEWS, B_CMAP8);
		memset(fFallenBmp->Bits(), B_TRANSPARENT_MAGIC_CMAP8, (size_t)(fallenRect.Height()*fFallenBmp->BytesPerRow()));
		fFallenView = new BView(fallenRect, "offscreen fallen snow", B_FOLLOW_NONE, 0);
		fFallenBmp->AddChild(fFallenView);
		fFallenReg = new BRegion;
		fInvalidator = spawn_thread(SnowMakerThread, INVALIDATOR_THREAD_NAME, B_LOW_PRIORITY, (void *)this);
		resume_thread(fInvalidator);
		printf("BSnow: OK: ws = %ld x %ld\n", fCachedWsWidth, fCachedWsHeight);
#ifdef DEBUG
		Window()->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, msgfilter));
#endif
	}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:49,代码来源:SnowView.cpp

示例3: FrameMoved

void TScrollViewComponent::FrameMoved(BPoint screenPoint)		
{
	printf("TScrollViewComponent::FrameMoved....\n");
	Invalidate();
	BView *child; 
   	if ( child = ChildAt(0) ) 
   	{
   		child->Invalidate();
   		child->FrameResized(0,0);
		BRect AFrame = this->Frame();
		BRect AFrame2 = child->Frame();
		printf("TScrollViewComponent::FrameMoved Getting ScrollBar\n");
		BScrollBar *truc = this->ScrollBar(B_HORIZONTAL);
		AFrame2 = truc->Frame();
		FPropertyList->SetPropertyValue(PROP_BOTTOM,FloatToStr(AFrame.bottom -2 -((AFrame2.bottom - AFrame2.top))));
		truc = this->ScrollBar(B_VERTICAL);		
		AFrame2 = truc->Frame();
		FPropertyList->SetPropertyValue(PROP_RIGHT,FloatToStr(AFrame.right -2 - ((AFrame2.right-AFrame2.left))));
		FPropertyList->SetPropertyValue(PROP_TOP,FloatToStr(AFrame.top + 2));
		FPropertyList->SetPropertyValue(PROP_LEFT,FloatToStr(AFrame.left + 2));
   	}
   	BScrollView::FrameMoved(screenPoint);
//	FrameMovedComponent(FInternalComponent);
//	FInternalComponent->FrameMovedComponent(FInternalComponent);
}
开发者ID:HaikuArchives,项目名称:BeBuilder,代码行数:25,代码来源:ScrollViewComponent.cpp

示例4: BOutlineListView

TestWindow::TestWindow(BApplication* myApp)
	: BWindow(BRect(20,20,100,100),
	  "Code Profile", B_TITLED_WINDOW, 0)
{
	BRect frm = Bounds();

	BView* myview = new BView(BRect(),"testView",0,0);
	
	BOutlineListView* olist =
		new BOutlineListView(BRect(),"MyList",
							B_SINGLE_SELECTION_LIST,B_FOLLOW_NONE);
	if( myview && olist ) {
		myview->AddChild(olist);
		BView* vw = olist;
		vw->SetViewColor(0xc0,0xc0,0xc0);
		vw->Invalidate();
		vw->SetLowColor(0xc0,0xc0,0xc0);
		vw->Invalidate();
		vw->SetHighColor(0x00,0x00,0x00);
		vw->Invalidate();
		vw->SetFont(be_bold_font);
		this->AddChild(myview);
		BRect frm = vw->Frame();
		vw->ResizeTo(1,1);
		vw->Draw(vw->Bounds());
		vw->ResizeToPreferred();
		float w=0,h=0;
		vw->GetPreferredSize(&w,&h);
		printf("Preferred size = %f x %f\n",w,h);
	}
	
	string = new BStringView(BRect(0,0,100,20),"String",
								"Ready to profile...");	
	
	if( string ) {
		string->SetViewColor(0xc0,0xc0,0xc0);
		this->AddChild(string);
		float w=0, h=0;
		string->GetPreferredSize(&w,&h);
		MoveTo(30,30);
		ResizeTo(w,h);
	}
	
	BMenuBar* menu = new BMenuBar(BRect(),"MainMenu",B_FOLLOW_NONE);
	if( menu ) {
		this->AddChild(menu);
		float w=0, h=0;
		menu->GetPreferredSize(&w,&h);
		printf("Preferred Size = (%f,%f)\n",w,h);
		menu->SetFont(be_plain_font);
		menu->GetPreferredSize(&w,&h);
		printf("Preferred Size = (%f,%f)\n",w,h);
		menu->SetFont(be_bold_font);
		menu->GetPreferredSize(&w,&h);
		printf("Preferred Size = (%f,%f)\n",w,h);
		menu->SetFont(be_fixed_font);
		menu->GetPreferredSize(&w,&h);
		printf("Preferred Size = (%f,%f)\n",w,h);
	}
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:60,代码来源:Profile.cpp

示例5: AdjustBottomRightOfAllPanes

BPoint HTabSheet::AdjustBottomRightOfAllPanes()
{
	BPoint overallBottomRight(0.0, 0.0);
	for(int i=0; i<fPanes.CountItems(); ++i)
	{
		BView* pane = (BView*)fPanes.ItemAt(i);
		if (!pane)
			continue;
		BPoint paneBottomRight = DetermineBottomRightOfPane(pane);
		if (overallBottomRight.x < paneBottomRight.x)
			overallBottomRight.x = paneBottomRight.x;
		if (overallBottomRight.y < paneBottomRight.y)
			overallBottomRight.y = paneBottomRight.y;
	}
	BPoint paneLeftTop;
	for(int i=0; i<fPanes.CountItems(); ++i)
	{
		BView* pane = (BView*)fPanes.ItemAt(i);
		if (!pane)
			continue;
		if (i == 0)
			paneLeftTop = pane->Frame().LeftTop();
		pane->ResizeTo(overallBottomRight.x + 1, overallBottomRight.y + 1);
	}
	return overallBottomRight+paneLeftTop;
}
开发者ID:jscipione,项目名称:Paladin,代码行数:26,代码来源:HTabSheet.cpp

示例6: getSelBounds

void MainView::getSelBounds(BRect& bounds)
{
	BPoint upper_left, lower_right;
	
	upper_left.x = upper_left.y = 999999;
	lower_right.x = lower_right.y = 0;
	
	for(int i = 0; i < selected_fields.CountItems(); i++) {
		BView *field = (BView *)selected_fields.ItemAt(i);
		BRect frame = field->Frame();
		BPoint tl = frame.LeftTop();
		BPoint br = frame.RightBottom();
		
		if(tl.x < upper_left.x) {
			upper_left.x = tl.x;
		}
		if(br.x > lower_right.x) {
			lower_right.x = br.x;
		}
		if(tl.y < upper_left.y) {
			upper_left.y = tl.y;
		}
		if(br.y > lower_right.y) {
			lower_right.y = br.y;
		}
	}
	
	bounds.SetLeftTop(upper_left);
	bounds.SetRightBottom(lower_right);
}
开发者ID:brennanos,项目名称:XFile-Haiku,代码行数:30,代码来源:MainView.cpp

示例7: Minimize

void CharismaWindow::Minimize(bool minimize)
{
	const float margin=4.0f;
	BRect r;
	
	// en réalité, minimize est ignoré
	
	if(!isminim){
		menubar->Hide();
		setupview->MoveTo(B_ORIGIN);
		modemenu->MoveTo(margin,margin);
	
		r=modemenu->Frame();
		ResizeTo(r.right+margin,r.bottom+margin);
		
		SetLook(B_MODAL_WINDOW_LOOK);

		isminim=1;
	}else{
		menubar->Show();
		setupview->MoveTo(0,menubar->Frame().bottom);
		modemenu->MoveTo(10.0f,10.0f);

		r=setupview->Frame();
		ResizeTo(r.right,r.bottom);

		SetLook(B_TITLED_WINDOW_LOOK);

		isminim=0;
	}
}
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:31,代码来源:main.cpp

示例8: Invalidate

void
PackagesView::FrameResized(float width, float height)
{
    if (CountChildren() == 0)
        Invalidate();

    BScrollBar* scrollBar = ScrollBar(B_VERTICAL);
    if (scrollBar == NULL)
        return;

    float virtualHeight = 0.0;

    int32 count = CountChildren();
    if (count > 0) {
        BView* child = ChildAt(count - 1);
        virtualHeight = child->Frame().bottom;
    }

    if (height > virtualHeight) {
        scrollBar->SetRange(0.0f, 0.0f);
        scrollBar->SetValue(0.0f);
    } else {
        scrollBar->SetRange(0.0f, virtualHeight - height);
        scrollBar->SetProportion(height / virtualHeight);
    }

    scrollBar->SetSteps(15, height);
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:28,代码来源:PackageViews.cpp

示例9: Expand

/*=============================================================================================*\
|	Expand																						|
+-----------------------------------------------------------------------------------------------+
|	Effet: Reduire la view, la fenetre mere et deplacer les autre view si necessaire.			|
\*=============================================================================================*/
void ShrinkView::Expand()
{
	BView * pTempView;	//Utiliser pour parcourir les View attacher a la meme fenetre mere.
	
	//Agradir la View.
	ResizeTo(Frame().Width(), m_fFullHeight);
	m_bShrink = false;

	//Redimentionner la fenetre mere
	if( Window() != NULL )
	{
		Window()->ResizeBy(0, m_fFullHeight - 15.0 );		
	}
	
	//Deplacer, si necessaire, les autre View. 
	pTempView = this;
	while( pTempView->PreviousSibling() != NULL)
	{
		pTempView = pTempView->PreviousSibling();
	}
	while(pTempView != NULL)
	{
		if(Frame().top + 16.0 <= pTempView->Frame().top )
		{	
			pTempView->MoveBy(0, m_fFullHeight - 15.0);
		}
		pTempView = pTempView->NextSibling();
	}
	
	Draw(Bounds());
}//End of Expand.
开发者ID:BackupTheBerlios,项目名称:dengon-svn,代码行数:36,代码来源:ShrinkView.cpp

示例10: furthest_right

/* This is a hack necessary because sometimes this view gets bogus FrameResize()
 * messages.  Not sure what's happening exactly, but fairly frequently I receive
 * a correct FrameResized() view followed by one that reports the Window()'s frame
 * to be 140 pixels shorter then the immediately preceding call.  Checking the
 * frame of the child views seems to bypass the bug.
 */
static float furthest_right(BWindow* window)
{
    float	right = 0;
    for (BView* child = window->ChildAt(0); child; child = child->NextSibling() ) {
        BRect	f = child->Frame();
        if (f.right > right) right = f.right;
    }
    return right;
}
开发者ID:dtbinh,项目名称:Sequitur,代码行数:15,代码来源:SeqPhraseMatrixView.cpp

示例11: BRect

BRect
TReplicantTray::IconFrame(int32 target, bool byIndex)
{
	int32 index, id;
	BView* view = ViewAt(&index, &id, target, byIndex);
	if (view)
		return view->Frame();

	return BRect(0, 0, 0, 0);
}
开发者ID:RTOSkit,项目名称:haiku,代码行数:10,代码来源:StatusView.cpp

示例12: CalculateVerticalOffset

void WrappingTextView::CalculateVerticalOffset() {
	float offset = 0;
	int max=CountChildren();
	for( int i=0; i<max; ++i) {
		BView* child = ChildAt(i);
		child->MoveTo( 0, offset);
		BRect frame = child->Frame();
		offset += frame.Height();
	}
	m_vertical_offset = MAX( offset, 0);
	ResetTextRect();
}
开发者ID:HaikuArchives,项目名称:Beam,代码行数:12,代码来源:WrappingTextView.cpp

示例13: ItemTop

float MessageView::ItemTop()
{
	int32 count	= CountChildren();
	if (count > 0)
	{
		BView *tmpChild = ChildAt(count-1);
		return tmpChild->Frame().bottom+MARGIN_SPACE;
		
	}
	else
		return MARGIN_SPACE;	
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:12,代码来源:MessageView.cpp

示例14: 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(&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();
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:53,代码来源:PrintJob.cpp

示例15: GetPreferredSize

void ArpKnobPanel::GetPreferredSize(float* width, float* height)
{
	float	w = 0, h = 0;
	BView*	view;
	for( view = ChildAt(0); view != 0; view = view->NextSibling() ) {
		BRect	b = view->Frame();
		if( b.right > w ) w = b.right;
		if( b.bottom > h ) h = b.bottom;
	}
	*width = w;
	*height = h;
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:12,代码来源:ArpKnobControl.cpp


注:本文中的BView::Frame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。