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


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

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


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

示例1: rect

/*
 * Make inside state picture.
 */
BPicture*
HToolbarButton::MakeInsidePicture(BBitmap *in)
{
	HToolbar *toolbar = cast_as(Parent(),HToolbar);
	BRect buttonRect = toolbar->ButtonRect();
	BView *view = new BView(BRect(0,0,buttonRect.Width(),buttonRect.Height())
							,"offview",0,0);
	BBitmap *bitmap = new BBitmap(view->Bounds(), in->ColorSpace(), true);
	BPicture *pict;
	bitmap->AddChild(view);
	bitmap->Lock();
	view->SetDrawingMode(B_OP_ALPHA); 
	view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
	view->BeginPicture(new BPicture); 
	
	DrawBitmap(view,in);
	DrawString(view,fName.String());
	
	//view->SetHighColor(White);
	//view->FillRect(BRect(0,0,0,22));
	//view->FillRect(BRect(0,0,22,0));
	//view->SetHighColor(BeShadow);
	//view->FillRect(BRect(21,0,21,21));
	//view->FillRect(BRect(0,21,21,21));
	BRect rect(Bounds());
	view->SetDrawingMode(B_OP_OVER); 
	rect.InsetBy(1,1);
	view->BeginLineArray(5);
	view->AddLine(rect.LeftTop(), rect.LeftBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
	view->AddLine(rect.LeftTop(), rect.RightTop(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
	view->AddLine(rect.LeftBottom(), rect.RightBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
	rect.bottom--;
	view->AddLine(rect.LeftBottom(), rect.RightBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	view->AddLine(rect.RightTop(), rect.RightBottom(),
			tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
	view->EndLineArray();
	
	view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
	view->StrokeRect(Bounds());
	pict = view->EndPicture();
	bitmap->Unlock();
	delete bitmap;
	return pict;
}
开发者ID:kallisti5,项目名称:libtoolbar,代码行数:51,代码来源:HToolbarButton.cpp

示例2: bounds

void 
BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
	const BColumnTitle *pressedColumn,
	void (*trackRectBlitter)(BView *, BRect), BRect passThru)
{
	BRect bounds(Bounds());
	BView *view;

	if (useOffscreen) {
		ASSERT(sOffscreen);
		BRect frame(bounds);
		frame.right += frame.left;
			// this is kind of messy way of avoiding being clipped by the ammount the
			// title is scrolled to the left
			// ToDo: fix this
		view = sOffscreen->BeginUsing(frame);
		view->SetOrigin(-bounds.left, 0);
		view->SetLowColor(LowColor());
		view->SetHighColor(HighColor());
		BFont font(be_plain_font);
		font.SetSize(9);
		view->SetFont(&font);
	} else
		view = this;

	if (be_control_look != NULL) {
		rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
		view->SetHighColor(tint_color(base, B_DARKEN_2_TINT));
		view->StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
		bounds.bottom--;

		be_control_look->DrawButtonBackground(view, bounds, bounds, base, 0,
			BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);
	} else {
		// fill background with light gray background
		if (!updateOnly)
			view->FillRect(bounds, B_SOLID_LOW);
	
		view->BeginLineArray(4);
		view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor);
		view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor);
		// draw lighter gray and white inset lines
		bounds.InsetBy(0, 1);
		view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor);
		view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor);
		view->EndLineArray();
	}

	int32 count = fTitleList.CountItems();
	float minx = bounds.right;
	float maxx = bounds.left;
	for (int32 index = 0; index < count; index++) {
		BColumnTitle *title = fTitleList.ItemAt(index);
		title->Draw(view, title == pressedColumn);
		BRect titleBounds(title->Bounds());
		if (titleBounds.left < minx)
			minx = titleBounds.left;
		if (titleBounds.right > maxx)
			maxx = titleBounds.right;
	}

	if (be_control_look != NULL) {
		bounds = Bounds();
		minx--;
		view->SetHighColor(sLightShadowColor);
		view->StrokeLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom - 1));
	} else {
		// first and last shades before and after first column
		maxx++;
		minx--;
		view->BeginLineArray(2);
		view->AddLine(BPoint(minx, bounds.top),
					  BPoint(minx, bounds.bottom), sShadowColor);
		view->AddLine(BPoint(maxx, bounds.top),
					  BPoint(maxx, bounds.bottom), sShineColor);
		view->EndLineArray();
	}

#if !(APP_SERVER_CLEARS_BACKGROUND)
	FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1), B_SOLID_LOW);
	FillRect(BRect(maxx + 1, bounds.top + 1, bounds.right, bounds.bottom - 1), B_SOLID_LOW);
#endif

	if (useOffscreen) {
		if (trackRectBlitter)
			(trackRectBlitter)(view, passThru);
		view->Sync();
		DrawBitmap(sOffscreen->Bitmap());
		sOffscreen->DoneUsing();
	} else if (trackRectBlitter)
		(trackRectBlitter)(view, passThru);
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:92,代码来源:TitleView.cpp

示例3: reply


//.........这里部分代码省略.........
						bounds, *gradient);
					delete gradient;
				}

				invalidRegion.Include(bounds);
				break;
			}

			case RP_STROKE_LINE:
			{
				BPoint points[2];
				if (message.ReadList(points, 2) != B_OK)
					continue;

				offscreen->StrokeLine(points[0], points[1], pattern);

				BRect bounds = _BuildInvalidateRect(points, 2);
				invalidRegion.Include(bounds.InsetBySelf(-penSize, -penSize));
				break;
			}

			case RP_STROKE_LINE_ARRAY:
			{
				int32 numLines;
				if (message.Read(numLines) != B_OK)
					continue;

				BRect bounds;
				offscreen->BeginLineArray(numLines);
				for (int32 i = 0; i < numLines; i++) {
					rgb_color color;
					BPoint start, end;
					message.ReadArrayLine(start, end, color);
					offscreen->AddLine(start, end, color);

					bounds.left = min_c(bounds.left, min_c(start.x, end.x));
					bounds.top = min_c(bounds.top, min_c(start.y, end.y));
					bounds.right = max_c(bounds.right, max_c(start.x, end.x));
					bounds.bottom = max_c(bounds.bottom, max_c(start.y, end.y));
				}

				offscreen->EndLineArray();
				invalidRegion.Include(bounds);
				break;
			}

			case RP_FILL_REGION:
			case RP_FILL_REGION_GRADIENT:
			{
				BRegion region;
				if (message.ReadRegion(region) != B_OK)
					continue;

				if (code == RP_FILL_REGION)
					offscreen->FillRegion(&region, pattern);
				else {
					BGradient *gradient;
					if (message.ReadGradient(&gradient) != B_OK)
						continue;

					offscreen->FillRegion(&region, *gradient);
					delete gradient;
				}

				invalidRegion.Include(&region);
				break;
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:67,代码来源:RemoteView.cpp

示例4: CreatePicture

/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
BPicture* BmToolbarButton::CreatePicture( int32 mode, float width, 
														float height) {
	const char* label = mLabel.String();
	BmBitmapHandle* imageHandle 
		= TheResources->IconByName(BmString("Button_")<<mResourceName);
	BBitmap* image = imageHandle ? imageHandle->bitmap : NULL;
	// Calc icon/label positions
	BFont font( be_plain_font);
	bool showIcons = ThePrefs->GetBool( "ShowToolbarIcons", true);
	BmString labelMode = ThePrefs->GetString( "ShowToolbarLabel", "Bottom");
	float labelWidth 
		= (label && labelMode != "Hide") ? font.StringWidth( label) : 0;
	float labelHeight 
		= (label && labelMode != "Hide") 
				? TheResources->FontLineHeight( &font) 
				: 0;
	float iconWidth  = (showIcons && image) ? image->Bounds().Width()  : 0;
	float iconHeight = (showIcons && image) ? image->Bounds().Height() : 0;

	BPoint posIcon( 0,0), posLabel( 0,0);
	if (showIcons && (labelMode == "Left")) {
		// Icon + Label/Left
		float d = (width-(mNeedsLatch ? DIVLATCHW : 0)-DIVW-labelWidth-iconWidth)/2;
		posLabel = BPoint( d,(height-labelHeight)/2);
		posIcon = BPoint( d+DIVW+labelWidth+(mNeedsLatch ? DIVLATCHW : 0),
								(height-iconHeight)/2-1);
	} else if (showIcons && (labelMode == "Right")) {
		// Icon + Label/Right
		float d = (width-(mNeedsLatch ? DIVLATCHW : 0)-DIVW-labelWidth-iconWidth)/2;
		posLabel = BPoint( d+DIVW+iconWidth,(height-labelHeight)/2);
		posIcon = BPoint( d,(height-iconHeight)/2-1);
	} else if (showIcons && (labelMode == "Top")) {
		// Icon + Label/top
		float d = (height-DIVH-labelHeight-iconHeight)/2-2;
		posLabel = BPoint( (width-labelWidth-(mNeedsLatch ? DIVLATCHW : 0))/2, d);
		posIcon = BPoint( (width-iconWidth)/2-1,d+DIVH+labelHeight);
	} else if (showIcons && (labelMode == "Bottom")) {
		// Icon + Label/bottom
		float d = (height-DIVH-labelHeight-iconHeight)/2;
		posLabel = BPoint( (width-labelWidth-(mNeedsLatch ? DIVLATCHW : 0))/2, 
								 d+DIVH+iconHeight);
		posIcon = BPoint( (width-iconWidth)/2-1,d);
	} else if (!showIcons && labelMode != "Hide") {
		// Label only
		posLabel = BPoint( (width-labelWidth-(mNeedsLatch ? DIVLATCHW : 0))/2, 
								 (height-labelHeight)/2);
	} else if (showIcons && labelMode == "Hide") {
		// Icon only
		posIcon = BPoint( (width-iconWidth-(mNeedsLatch ? DIVLATCHW : 0))/2,
								(height-iconHeight)/2);
	}
	
	if (mNeedsLatch) {
		if (labelMode == "Hide")
			mLatchRect.Set( posIcon.x+iconWidth+2, 
								 posIcon.y+iconHeight/2-LATCHSZ/2, 
								 width, height);
		else
			mLatchRect.Set( posLabel.x+labelWidth+2, 
								 posLabel.y+labelHeight/2-LATCHSZ/2, 
								 width, height);
	} else
		mLatchRect.Set( -1, -1, -1, -1);

	// Draw
	BRect rect(0,0,width-1,height-1);
	BView* view = new BView( rect, NULL, B_FOLLOW_NONE, 0);
	BBitmap* drawImage = new BBitmap( rect, B_RGBA32, true);
	drawImage->AddChild( view);
	drawImage->Lock();
	BPicture* picture = new BPicture();
	view->BeginPicture( picture);
	view->SetHighColor( ui_color( B_PANEL_TEXT_COLOR));
	view->SetViewColor( B_TRANSPARENT_COLOR);
	view->SetLowColor( ui_color( B_PANEL_BACKGROUND_COLOR));

#ifndef __HAIKU__
	BmToolbar* toolbar = dynamic_cast<BmToolbar*>(Parent()->Parent());
	BBitmap* toolbarBackground = NULL;
	if (toolbar) {
		toolbarBackground = toolbar->BackgroundBitmap();
		if (toolbarBackground)
			view->DrawBitmap( toolbarBackground, Frame(), rect);
	}

	if (mode == STATE_ON) {
		rect.InsetBy( 1, 1);
		view->BeginLineArray(4);
		view->AddLine( rect.LeftBottom(), rect.LeftTop(), 
							BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
		view->AddLine( rect.LeftTop(), rect.RightTop(), 
							BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
		view->AddLine( rect.LeftBottom(), rect.RightBottom(), 
							ui_color( B_SHINE_COLOR));
		view->AddLine( rect.RightBottom(), rect.RightTop(), 
							ui_color( B_SHINE_COLOR));
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Beam,代码行数:101,代码来源:BmToolbarButton.cpp

示例5: _InitWindow


//.........这里部分代码省略.........
		inputHeight->SetViewColor(200,200,200,255);
		inputHeight->SetDrawingMode(B_OP_OVER);

//		(inputHeight->TextView())->MakeEditable(false);
		pictureSizeView->AddChild(label2);
		pictureSizeView->AddChild(inputWidth);
		pictureSizeView->AddChild(unit2);
		inputWidth->SetViewColor(200,200,200,255);
		inputWidth->SetDrawingMode(B_OP_OVER);

//		(inputWidth->TextView())->MakeEditable(false);
		//---Originalgrößen View---

		//+++Neue Größe View+++
		BRect newPictureSize = background;
		newPictureSize.top=(pictureSize.bottom+3);
		newPictureSize.bottom -=50;
		BBox *newPictureSizeView=new BBox(newPictureSize,"pictureView2",B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT);
		newPictureSizeView->SetLabel(new BStringView(BRect(10,0,50,20),"Label","Neue Größe:"));
		outputWidth=new BTextControl(BRect(5,15,newPictureSize.Width()-80,20),"oWidth","Width:","",new BMessage(OUTPUT_WIDTH_CHANGED),B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED);
		outputHeight=new BTextControl(BRect(5,35,newPictureSize.Width()-80,20),"oHeight","Height:","",new BMessage(OUTPUT_HEIGHT_CHANGED),B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED);


		//Die Maseinheiten auswahl...
		BMenu *messureMenu=new BMenu("px",B_ITEMS_IN_COLUMN);
		messureMenu->SetRadioMode(true);
		messureMenu->SetLabelFromMarked(true);
		messureMenu->AddItem(item=new BMenuItem("px",new BMessage(MESSURE_MENU_PIXEL)));
		item->SetMarked(true);
		messureMenu->AddItem(item=new BMenuItem("%",new BMessage(MESSURE_MENU_PERCENT)));
		BMenuField *messureKind=new BMenuField(BRect(newPictureSize.Width()-40,25,newPictureSize.Width()-5,40),"messureKind",NULL,messureMenu,B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT);
		
		BRect rect=BRect(newPictureSize.Width()-75,20,newPictureSize.Width()-45,50);
		BView *tmpView = new BView(rect, "temp", B_FOLLOW_NONE, B_WILL_DRAW );
 			
		// der Verknüpfungsknop
		AddChild(tmpView);
		//create on picture
		rgb_color back=backView->ViewColor();
		//back.alpha=255;
	   	BPicture *on;
 		tmpView->BeginPicture(new BPicture); 
			tmpView->SetHighColor(back);
 			tmpView->FillRect(tmpView->Bounds());
			tmpView->BeginLineArray(7);
				tmpView->AddLine(BPoint(0,3),BPoint(15,3),black);
				tmpView->AddLine(BPoint(0,3),BPoint(5,0),black);
				tmpView->AddLine(BPoint(0,3),BPoint(5,6),black);
				tmpView->AddLine(BPoint(15,3),BPoint(15,27),black);
				tmpView->AddLine(BPoint(0,27),BPoint(15,27),black);
				tmpView->AddLine(BPoint(0,27),BPoint(5,24),black);
				tmpView->AddLine(BPoint(0,27),BPoint(5,30),black);
			tmpView->EndLineArray();
 			on = tmpView->EndPicture();
   			//create off picture
   			BPicture *off;
   			tmpView->BeginPicture(new BPicture); 
			tmpView->SetHighColor(back);
			tmpView->FillRect(tmpView->Bounds());
			tmpView->BeginLineArray(8);
				tmpView->AddLine(BPoint(0,3),BPoint(15,3),black);
				tmpView->AddLine(BPoint(0,3),BPoint(5,0),black);
				tmpView->AddLine(BPoint(0,3),BPoint(5,6),black);
				tmpView->AddLine(BPoint(15,3),BPoint(15,10),black);
				tmpView->AddLine(BPoint(15,20),BPoint(15,27),black);
				tmpView->AddLine(BPoint(0,27),BPoint(15,27),black);
				tmpView->AddLine(BPoint(0,27),BPoint(5,24),black);
				tmpView->AddLine(BPoint(0,27),BPoint(5,30),black);
			tmpView->EndLineArray();
			tmpView->SetPenSize(1.5);
			tmpView->SetHighColor(red);
			tmpView->StrokeArc(BPoint(15,7),4,2,180,180);
			tmpView->StrokeArc(BPoint(15,23),4,2,0,180);
   			off = tmpView->EndPicture();
   			//get rid of tmpView

		RemoveChild(tmpView);
		delete tmpView;
		depent = new BPictureButton(rect,"concate", on, off, NULL,B_TWO_STATE_BUTTON,B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT);
		
		newPictureSizeView->AddChild(outputHeight);
		newPictureSizeView->AddChild(outputWidth);
		newPictureSizeView->AddChild(depent);
		newPictureSizeView->AddChild(messureKind);
		backView->AddChild(newPictureSizeView);
		
//		BButton	*testButton=new BButton(BRect(10,Bounds().Height()-45,70,Bounds().Height()-25),"TestButton","Test",new BMessage(TEST_REQUEST),B_FOLLOW_BOTTOM);
		BButton	*testButton=new BButton(BRect(Bounds().Width()-60,Bounds().Height()-45,Bounds().Width()-7,Bounds().Height()-25),"TestButton","Berechnen",new BMessage(TEST_REQUEST),B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
//		BButton	*speichernButton=new BButton(BRect(Bounds().Width()-70,Bounds().Height()-45,Bounds().Width()-10,Bounds().Height()-25),"SaveButton","Save",new BMessage(TEST_REQUEST),B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
		backView->AddChild(testButton);
//		backView->AddChild(speichernButton);
		
		//---Neue Größe View---

	pluginWindow=NULL;
	

	LoadPlugins();

}
开发者ID:Paradoxianer,项目名称:ImmersiveVideo,代码行数:101,代码来源:ImmersiveVideoWindow.cpp


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