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


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

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


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

示例1: 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

示例2: copy_font

void ArpTextControl::copy_font(BView* v)
{
	// Make no assumptions about the structure of the children.
	if( !v ) return;
	int32 num = v->CountChildren();
	for( int32 i=0; i<num; i++ ) {
		BView* child = v->ChildAt(i);
		if( child ) {
			copy_font(child);
			BTextView* text = dynamic_cast<BTextView*>(child);
			if( text ) {
				text->SetFontAndColor(&PV_FillFont);
			} else {
				child->SetFont(&PV_FillFont);
			}
		}
	}
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:18,代码来源:ViewStubs.cpp

示例3: BBitmap

BBitmap *DragonView::_MakeNoneImage( void )
{
	// Draw an "empty" bitmap to represent "no image"; we'll use one
	// that tells the user what to do.
	BBitmap *bitmap = new BBitmap( BRect( 0, 0, 319, 199 ),
								   BScreen().ColorSpace(),
								   true );
	BView *view = new BView( bitmap->Bounds(),
							 "not a bitmap",
							 B_FOLLOW_ALL_SIDES, 0 );
	bitmap->AddChild( view );

	DragonApp *app = dynamic_cast<DragonApp *>( be_app );
	
	rgb_color White = { 255, 255, 255, 0 };
	rgb_color Black = { 0, 0, 0, 0 };
	
	bitmap->Lock();

	view->SetLowColor( White );
	view->SetViewColor( White );
	view->SetHighColor( Black );
	view->SetDrawingMode( B_OP_OVER );
	view->FillRect( view->Bounds(), B_SOLID_LOW );

	// Excercise for the reader here:  Read the old newsletter articles
	// about how to use the font metrics to find out how large a font is,
	// then center to font in the window dynamically no matter what font
	// settings the user has.

	view->SetFont( be_plain_font );
	view->MovePenTo( 5, 100 );
	view->DrawString( app->rsrc_strings->FindString( RSRC_Drop_an_image ) );
	view->Sync();
	
	bitmap->Unlock();

	return bitmap;
}
开发者ID:Taffer,项目名称:BeOS,代码行数:39,代码来源:DragonView.cpp

示例4: SetFont

void BochsView::SetFont(const BFont *font, uint32 mask)
{
  backing_store->Lock();
  backing_view->SetFont(font,mask);
  backing_store->Unlock();
}
开发者ID:hack477,项目名称:bochs4wii,代码行数:6,代码来源:beos.cpp

示例5: 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

示例6: reply


//.........这里部分代码省略.........
				alpha_function alphaFunction;

				message.Read(sourceAlpha);
				if (message.Read(alphaFunction) != B_OK)
					continue;

				offscreen->SetBlendingMode(sourceAlpha, alphaFunction);
				break;
			}

			case RP_SET_PATTERN:
			{
				if (message.Read(pattern) != B_OK)
					continue;
				break;
			}

			case RP_SET_DRAWING_MODE:
			{
				drawing_mode drawingMode;
				if (message.Read(drawingMode) != B_OK)
					continue;

				offscreen->SetDrawingMode(drawingMode);
				break;
			}

			case RP_SET_FONT:
			{
				BFont font;
				if (message.ReadFontState(font) != B_OK)
					continue;

				offscreen->SetFont(&font);
				break;
			}

			case RP_CONSTRAIN_CLIPPING_REGION:
			{
				if (message.ReadRegion(clippingRegion) != B_OK)
					continue;

				offscreen->ConstrainClippingRegion(&clippingRegion);
				break;
			}

			case RP_INVERT_RECT:
			{
				BRect rect;
				if (message.Read(rect) != B_OK)
					continue;

				offscreen->InvertRect(rect);
				invalidRegion.Include(rect);
				break;
			}

			case RP_DRAW_BITMAP:
			{
				BBitmap *bitmap;
				BRect bitmapRect, viewRect;
				uint32 options;

				message.Read(bitmapRect);
				message.Read(viewRect);
				message.Read(options);
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:67,代码来源:RemoteView.cpp

示例7: 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;
			// ToDo: this is kind of messy way of avoiding being clipped
			// by the amount the title is scrolled to the left
		view = sOffscreen->BeginUsing(frame);
		view->SetOrigin(-bounds.left, 0);
		view->SetLowColor(LowColor());
		view->SetHighColor(HighColor());
		BFont font;
		GetFont(&font);
		view->SetFont(&font);
	} else
		view = this;

	view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT);
	view->StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
	bounds.bottom--;

	rgb_color baseColor = ui_color(B_PANEL_BACKGROUND_COLOR);
	be_control_look->DrawButtonBackground(view, bounds, bounds, baseColor, 0,
		BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);

	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;
	}

	bounds = Bounds();
	minx--;
	view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_1_TINT);
	view->StrokeLine(BPoint(minx, bounds.top),
		BPoint(minx, bounds.bottom - 1));

#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:bhanug,项目名称:haiku,代码行数:68,代码来源:TitleView.cpp

示例8: Draw

void CalcoloKtView::Draw(BRect)
{
	
	BView *iconView;
    iconView = (BView *)FindView("iconView");
         	
	iconView->SetHighColor(0, 0, 0);	
	
	BPoint	p1, p2;
	
	// Dimensioni della BView iconView 130 x 60 pixels
	
	float x_origin;
	float y_origin;
	float l_tot;
	float h_tot;
	
	// .:: Dimensioni principali dell'icona ::.
	
	x_origin = 25;
	y_origin = 5;
	l_tot = 90;
	h_tot = 52;
	
	// .:: Sezione Sx ::.
	
	p1.x = x_origin;
	p1.y = y_origin;
	p2.x = x_origin + l_tot * 5 / 9;
	p2.y = y_origin;
	
	iconView->StrokeLine(p1, p2, B_SOLID_HIGH);

	p1.x = x_origin;
	p1.y = y_origin + h_tot;
	p2.x = x_origin + l_tot * 5 / 9;
	p2.y = y_origin + h_tot;
	
	iconView->StrokeLine(p1, p2, B_SOLID_HIGH);

	p1.x = x_origin + l_tot * 5 / 9;
	p1.y = y_origin;
	p2.x = x_origin + l_tot * 5 / 9;
	p2.y = y_origin + h_tot;
	
	iconView->StrokeLine(p1, p2, B_SOLID_HIGH);
	
	// .:: Quota Sx ::.
	
	p1.x = x_origin + (l_tot * 5 / 9)/2;
	p1.y = y_origin;
	p2.x = x_origin + (l_tot * 5 / 9)/2;
	p2.y = y_origin + h_tot;
	
	iconView->StrokeLine(p1, p2, B_SOLID_HIGH);
	
	// .:: Freccie quota Sx ::.
	
	float largfreccie;
	BPoint p3;
	
	largfreccie = h_tot * 3 / 52;
	
	p1.x = x_origin + (l_tot * 5 / 9)/2;
	p1.y = y_origin;
	p2.x = p1.x - largfreccie / 2;
	p2.y = p1.y + largfreccie * 2;
	p3.x = p1.x + largfreccie / 2;
	p3.y = p1.y + largfreccie * 2;
	
	iconView->FillTriangle(p1, p2, p3, B_SOLID_HIGH);
	
	p1.x = x_origin + (l_tot * 5 / 9)/2;
	p1.y = y_origin + h_tot;
	p2.x = p1.x - largfreccie / 2;
	p2.y = p1.y - largfreccie * 2;
	p3.x = p1.x + largfreccie / 2;
	p3.y = p1.y - largfreccie * 2;
	
	iconView->FillTriangle(p1, p2, p3, B_SOLID_HIGH);
	
	// .:: Testo quota Sx ::.
	
	BPoint dimtext;
	BFont font(be_plain_font); 
	
	float fontsize;
	
	fontsize = h_tot * 7 / 52;
	
	font.SetSize(fontsize);
	iconView->SetFont(&font);

	dimtext.x = x_origin + (l_tot * 5 / 9)/2 + l_tot * 5 / 90;
	dimtext.y = y_origin + h_tot / 2 + fontsize / 2;
	
	iconView->MovePenTo(dimtext);
   	iconView->DrawString("D");
	
	// .:: Sezione Dx ::.
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:KtCalc,代码行数:101,代码来源:Calcolo_Kt_View.cpp

示例9: clipRect

// This function returns the number of pixels of the text that
// were clipped if the text does not fit into the clipping rect.
// If the text all fit, it returns 0.
int
BeOSCanvas::RenderText( int iFontHeight, Rect& oClipRect,
                        string& oText, AlignEnum eAlign,
                        Font* pFont, const Color& oColor,
                        bool bBold, bool bItalic, bool bUnderline )
{
    Erase( oClipRect );

    BView* v = m_pBufferBitmap->OffscreenView();
    if ( !v ) return 0;

    BBitmap* bitmap = m_pBufferBitmap->GetBBitmap();
    assert( bitmap );

    BFont font;
    font_height fontHeight;
    BRect clipRect( float(oClipRect.x1), float(oClipRect.y1),
                    float(oClipRect.x2-1), float(oClipRect.y2-1) );
    BRegion clipRegion;
    clipRegion.Set( clipRect );

    if ( !bitmap->Lock() )
    {
        puts( "lock failed" );
        return 0;
    }

    v->ConstrainClippingRegion( &clipRegion );
    v->SetDrawingMode( B_OP_OVER );
    if ( bBold )
    {
        v->SetFont( be_bold_font );
    }
    else
    {
        v->SetFont( be_plain_font );
    }
    v->SetFontSize( (float)iFontHeight - 1 );
    v->GetFont( &font );
    font.GetHeight( &fontHeight );
    
    float width = v->StringWidth(oText.c_str(), oText.size());
    
    if(eAlign == eCenter)
        v->MovePenTo( float(oClipRect.x1) +
                      (float(oClipRect.x2 - oClipRect.x1) - width)/2,
                      float(oClipRect.y2-fontHeight.descent) );	
    else if (eAlign == eRight)
        v->MovePenTo( float(oClipRect.x2) - width,
                      float(oClipRect.y2-fontHeight.descent) );
    else
        v->MovePenTo( float(oClipRect.x1),
                      float(oClipRect.y2-fontHeight.descent) );

    v->DrawString( oText.c_str() );
    v->Sync();

    bitmap->Unlock();

    Invalidate( oClipRect );

    return (width < oClipRect.Width()) ? 0 : int(width - oClipRect.Width());
}
开发者ID:mayhem,项目名称:freeamp,代码行数:66,代码来源:BeOSCanvas.cpp

示例10: DoPersonDrag

void URLView::DoPersonDrag() {
	// Handle all of the bookmark dragging.  This includes setting up
	// the drag message and drawing the dragged bitmap.
	
	// Set up the drag message to support both BTextView dragging (using
	// the e-mail address) and file dropping (to Tracker).
	BMessage *dragMessage = new BMessage( B_MIME_DATA );
	dragMessage->AddInt32( "be:actions", B_COPY_TARGET );
	dragMessage->AddString( "be:types", "application/octet-stream" );
	dragMessage->AddString( "be:filetypes", "application/x-person" );
	dragMessage->AddString( "be:type_descriptions", "person" );
	dragMessage->AddString( "be:clip_name", Text() );
	
	// This allows the user to drag the e-mail address into a
	// standard BTextView.
	BString email = GetImportantURL();
	dragMessage->AddData( "text/plain", B_MIME_DATA, email.String(),
						  email.Length() + 1 );
	
	// Query for the system's icon for bookmarks.
	BBitmap *personIcon = new BBitmap( BRect( 0, 0, iconSize - 1,
									   iconSize - 1 ), B_CMAP8 );
	#ifdef ZETA
		BMimeType mime( "application/x-vnd.Be-PEPL" );
	#else
		BMimeType mime( "application/x-person" );
	#endif
	if( iconSize == 16 ) mime.GetIcon( personIcon, B_MINI_ICON );
	else mime.GetIcon( personIcon, B_LARGE_ICON );
	
	// Find the size of the bitmap to drag.  If the text is bigger than the
	// icon, use that size.  Otherwise, use the icon's.  Center the icon
	// vertically in the bitmap.
	BRect rect = GetTextRect();
	rect.right += iconSize + 4;
	if( (rect.bottom - rect.top) < iconSize ) {
		int adjustment = (int) ((iconSize - (rect.bottom - rect.top)) / 2) + 1;
		rect.top -= adjustment;
		rect.bottom += adjustment;
	}
	
	// Make sure the rectangle starts at 0,0.
	rect.bottom += 0 - rect.top;
	rect.top = 0;
	
	// Create the bitmap to draw the dragged image in.
	BBitmap *dragBitmap = new BBitmap( rect, B_RGBA32, true );
	BView *dragView = new BView( rect, "Drag View", 0, 0 );
	dragBitmap->Lock();
	dragBitmap->AddChild( dragView );
	
	BRect frameRect = dragView->Frame();
	
	// Make the background of the dragged image transparent.
	dragView->SetHighColor( B_TRANSPARENT_COLOR );
	dragView->FillRect( frameRect );

	// We want 'g's, etc. to go below the underline.  When the BeOS can
	// do underlining of any font, this code can be removed.
	font_height height;
	GetFontHeight( &height );
	float descent = height.descent;

	// Find the vertical center of the view so we can vertically
	// center everything.
	int centerPixel = (int) ((frameRect.bottom - frameRect.top) / 2);
	int textCenter  = (int) (descent + underlineThickness) + centerPixel;

	// We want to draw everything only half opaque.
	dragView->SetDrawingMode( B_OP_ALPHA );
	dragView->SetHighColor( 0.0, 0.0, 0.0, 128.0 );
	dragView->SetBlendingMode( B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE );

	// Center the icon in the view.
	dragView->MovePenTo( BPoint( frameRect.left,
								 centerPixel - (iconSize / 2) ) );
	dragView->DrawBitmap( personIcon );

	// Draw the text in the same font (size, etc.) as the link view.
	// Note:  DrawString() draws the text at one pixel above the pen's
	//		  current y coordinate.
	BFont font;
	GetFont( &font );
	dragView->SetFont( &font );
	dragView->MovePenTo( BPoint( frameRect.left + iconSize + 4, textCenter ) );
	dragView->DrawString( Text() );
	
	// Be sure to flush the view buffer so everything is drawn.
	dragView->Flush();
	dragBitmap->Unlock();
	
	// The Person icon adds some width to the bitmap that we are
	// going to draw.  So horizontally offset the bitmap proportionally
	// to where the user clicked on the link.
	float horiz = dragOffset.x / GetTextRect().Width();
	dragOffset.x = horiz * frameRect.right;

	DragMessage( dragMessage, dragBitmap, B_OP_ALPHA,
				 BPoint( dragOffset.x,
				 		 (rect.Height() + underlineThickness) / 2 + 2), this );
//.........这里部分代码省略.........
开发者ID:bbjimmy,项目名称:YAB,代码行数:101,代码来源:URLView.cpp

示例11: CreateField

void HDialog::CreateField(int kind, BPositionIO& data, BView*& inside)
{
	dRect r;
	char name[256];
	char label[256];
	uint32 cmd;
	BView *v;

	switch (kind)
	{
		case 'btn ':
			data >> r >> name >> label >> cmd;
			inside->AddChild(v = new BButton(r.ToBe(), name, label, new BMessage(cmd)));
			if (cmd == msg_OK || strcmp(name, "ok") == 0)
				SetDefaultButton(static_cast<BButton*>(v));
			break;
		case 'radb':
			data >> r >> name >> label;
			inside->AddChild(new BRadioButton(r.ToBe(), name, label, new BMessage(msg_FieldChanged)));
			break;
		case 'chkb':
			data >> r >> name >> label;
			inside->AddChild(new BCheckBox(r.ToBe(), name, label, new BMessage(msg_FieldChanged)));
			break;
		case 'edit':
		{
			char val[256], allowed[256];
			short max, divider;
			data >> r >> name >> label >> val >> allowed >> max >> divider;

			BRect b = r.ToBe();

			inside->AddChild(v = new BTextControl(b, name, *label ? label : NULL,
				val, new BMessage(msg_FieldChanged), B_FOLLOW_NONE));

			BTextView *tv = static_cast<BTextControl*>(v)->TextView();
			if (*allowed)
			{
				for (int i = 0; i < 256; i++)
					if (isprint(i))
					{
						if (strchr(allowed, i)) tv->AllowChar(i);
						else tv->DisallowChar(i);
					}
			}

			if (max) tv->SetMaxBytes(max);
			if (divider) static_cast<BTextControl*>(v)->SetDivider(divider * gFactor);

			if (v->Bounds().Height() < b.Height())
			{
				float d = v->Bounds().Height() - tv->Bounds().Height();
				v->ResizeTo(b.Width(), b.Height());
				tv->ResizeTo(tv->Bounds().Width(), b.Height() - d);
			}
			break;
		}
		case 'capt':
			data >> r >> name >> label;
			inside->AddChild(v = new BStringView(r.ToBe(), name, label));
			v->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
			break;
		case 'popu':
		{
			short id, div;
			data >> r >> name >> label >> id >> div;
			inside->AddChild(v = new BMenuField(r.ToBe(), name, *label ? label : NULL,
				HResources::GetMenu(id, true)));
			if (div) static_cast<BMenuField*>(v)->SetDivider(div * gFactor);
			break;
		}
		case 'tabb':
			data >> r >> name;
			inside->AddChild(v = new HTabSheet(r.ToBe(), name));
			inside = v;
			break;
		case 'tabe':
			inside = inside->Parent();
			break;
		case 'shet':
			data >> name >> label;
			inside = dynamic_cast<HTabSheet*>(inside)->AddSheet(name, label);
			break;
		case 'shte':
			inside = inside->Parent();
			break;
		case 'box ':
			data >> r >> name;
			inside->AddChild(v = new BBox(r.ToBe(), name));
			if (*name) dynamic_cast<BBox*>(v)->SetLabel(name);
			v->SetFont(be_plain_font);
			inside = v;
			break;
		case 'boxe':
			inside = inside->Parent();
			break;
		case 'list':
		case 'olst':
		{
			data >> r >> name;
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Pe,代码行数:101,代码来源:HDialog.cpp


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