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


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

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


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

示例1: BGroupLayout

PreviewView::PreviewView(const char* name)
	:
	BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
	fSaverView(NULL),
	fNoPreview(NULL)
{
	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

	BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
	// We draw the "monitor" around the preview, hence the strange insets.
	layout->SetInsets(7, 6, 8, 12);
	SetLayout(layout);

	// A BStringView would be enough, if only it handled word wrapping.
	fNoPreview = new BTextView("no preview");
	fNoPreview->SetText(B_TRANSLATE("No preview available"));
	fNoPreview->SetFontAndColor(be_plain_font, B_FONT_ALL, &kWhite);
	fNoPreview->MakeEditable(false);
	fNoPreview->MakeResizable(false);
	fNoPreview->MakeSelectable(false);
	fNoPreview->SetViewColor(0, 0, 0);
	fNoPreview->SetLowColor(0, 0, 0);

	fNoPreview->Hide();

	BView* container = new BView("preview container", 0);
	container->SetLayout(new BCardLayout());
	AddChild(container);
	container->SetViewColor(0, 0, 0);
	container->SetLowColor(0, 0, 0);
	container->AddChild(fNoPreview);

	fNoPreview->SetHighColor(255, 255, 255);
	fNoPreview->SetAlignment(B_ALIGN_CENTER);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:35,代码来源:PreviewView.cpp

示例2: BStringView

TeamDescriptionView::TeamDescriptionView()
	:
	BView("description view", B_WILL_DRAW),
	fItem(NULL),
	fSeconds(4),
	fRebootRunner(NULL)
{
	fInfoString = B_TRANSLATE(
		"Select an application from the list above and click one of "
		"the buttons 'Kill application' and 'Quit application' "
		"in order to close it.\n\n"
		"Hold CONTROL+ALT+DELETE for %ld seconds to reboot.");

	fTeamName = new BStringView("team name", "team name");
	fSysComponent = new BStringView("system component", B_TRANSLATE(
		"(This team is a system component)"));
	fQuitOverdue = new BStringView("quit overdue", B_TRANSLATE(
		"If the application will not quit you may have to kill it."));
	fQuitOverdue->SetFont(be_bold_font);

	fInfoTextView = new AllShowingTextView("info text");
	BGroupView* group = new BGroupView(B_VERTICAL);
	BGroupLayoutBuilder(group)
		.Add(fInfoTextView)
		.AddGlue();

	fIconView = new IconView();
	fIconView->SetExplicitAlignment(
		BAlignment(B_ALIGN_HORIZONTAL_UNSET, B_ALIGN_VERTICAL_CENTER));

	BView* teamPropertiesView = new BView("team properties", B_WILL_DRAW);
	teamPropertiesView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
	teamPropertiesView->SetLayout(layout);
	BGroupLayoutBuilder(layout)
		.Add(fIconView)
		.AddGroup(B_VERTICAL)
			.Add(fTeamName)
			.Add(fSysComponent)
			.Add(fQuitOverdue)
		.End()
		.AddGlue();

	fLayout = new BCardLayout();
	SetLayout(fLayout);
	fLayout->AddView(group);
	fLayout->AddView(teamPropertiesView);

	SetItem(NULL);
}
开发者ID:Ithamar,项目名称:haiku,代码行数:50,代码来源:TeamMonitorWindow.cpp

示例3: BView

MusicCollectionWindow::MusicCollectionWindow(BRect frame, const char* title)
	:
	BWindow(frame, title, B_DOCUMENT_WINDOW, B_AVOID_FRONT)
{
	BView* rootView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(rootView);
	rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fQueryField = new BTextControl("Search: ", "", NULL);
	fQueryField->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
		B_ALIGN_USE_FULL_HEIGHT));
	fQueryField->SetModificationMessage(new BMessage(kMsgQueryInput));

	fCountView = new BStringView("Count View", "Count:");

	fFileListView = new MusicFileListView("File List View");
	fFileListView->SetInvocationMessage(new BMessage(kMsgItemInvoked));
	BScrollView* scrollView = new BScrollView("list scroll", fFileListView, 0,
		true, true, B_PLAIN_BORDER);

	float spacing = be_control_look->DefaultItemSpacing() / 2;
	BALMLayout* layout = new BALMLayout(spacing);
	layout->SetInset(spacing);
	rootView->SetLayout(layout);

	layout->AddView(fQueryField, layout->Left(), layout->Top());
	layout->AddViewToRight(fCountView, layout->Right());
	layout->AddView(scrollView, layout->Left(),
		layout->AreaFor(fQueryField)->Bottom(), layout->Right(),
		layout->Bottom());

	Area* area = layout->AreaFor(scrollView);
	area->SetLeftInset(0);
	area->SetRightInset(0);
	area->SetBottomInset(0);

	BSize min = layout->MinSize();
	BSize max = layout->MaxSize();
	SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());

	fEntryViewInterface = new ListViewListener<FileListItem>(fFileListView,
		fCountView);
	fQueryHandler = new QueryHandler(fEntryViewInterface);
	AddHandler(fQueryHandler);
	fQueryReader = new QueryReader(fQueryHandler);
	fQueryHandler->SetReadThread(fQueryReader);

	// start initial query
	PostMessage(kMsgQueryInput);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:50,代码来源:MusicCollectionWindow.cpp

示例4: BMessage

FolderConfigWindow::FolderConfigWindow(BRect parent, const BMessage& settings)
	:
	BWindow(BRect(0, 0, 300, 300), B_TRANSLATE("IMAP Folders"),
		B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
		B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE | B_AVOID_FRONT),
	fSettings(settings)
{
	BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(rootView);
	rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	float spacing = be_control_look->DefaultItemSpacing();
	BALMLayout* layout = new BALMLayout(spacing);
	rootView->SetLayout(layout);
	layout->SetInset(spacing);

	fFolderListView = new EditListView(B_TRANSLATE("IMAP Folders"));
	fFolderListView->SetExplicitPreferredSize(BSize(B_SIZE_UNLIMITED,
		B_SIZE_UNLIMITED));
	fApplyButton = new BButton("Apply", B_TRANSLATE("Apply"),
		new BMessage(kMsgApplyButton));

	fQuotaView = new BStringView("quota view",
		B_TRANSLATE("Failed to fetch available storage."));
	fQuotaView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	layout->AddView(fFolderListView, layout->Left(), layout->Top(),
		layout->Right(), layout->Bottom());

	GroupItem item = GroupItem(fQuotaView) / GroupItem(fFolderListView)
		/ (GroupItem(BSpaceLayoutItem::CreateGlue())
			| GroupItem(fApplyButton));
	layout->BuildLayout(item);

	PostMessage(kMsgInit);

	BSize min = layout->MinSize();
	BSize max = layout->MaxSize();
	SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());

	CenterIn(parent);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:43,代码来源:IMAPFolderConfig.cpp

示例5: BView

	StatusWindow(const char* text)
		:
		BWindow(BRect(0, 0, 10, 10), B_TRANSLATE("status"), B_MODAL_WINDOW_LOOK,
			B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE
				| B_AVOID_FRONT | B_NOT_RESIZABLE)
	{
		BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL,
			B_WILL_DRAW);
		AddChild(rootView);
		rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
		float spacing = be_control_look->DefaultItemSpacing();
		BALMLayout* layout = new BALMLayout(spacing);
		rootView->SetLayout(layout);
		layout->SetInset(spacing);

		BStringView* string = new BStringView("text", text);
		layout->AddView(string, layout->Left(), layout->Top(), layout->Right(),
			layout->Bottom());
		BSize min = layout->MinSize();
		ResizeTo(min.Width(), min.Height());
		CenterOnScreen();
	}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:22,代码来源:IMAPFolderConfig.cpp

示例6: BRect

/*!	\function	ColorUpdateWindow::ColorUpdateWindow
 *	\brief		Constructor.
 *	\param[in]	corner	One of the corners of the window IN SCREEN COORDINATES!
 *	\param[in]	label	Label of the color. (Usually name of the category).
 *	\param[in]	enableEditingLabel	If "true", label can be edited. If "false", it's constant.
 *	\param[in]	title			Title of the window
 *	\param[in]	defaultColor	Original color. Defaults to black.
 *	\param[in]	targetLooper	The target which receives message with the results.
 *	\param[in]	currentScreen	Defines the screen the program runs in. Usually it's
 *								B_MAIN_SCREEN_ID.
 *	\param[in]	message			The template message to be used. If this parameter is NULL,
 *								a new message is constructed.
 */
ColorUpdateWindow::ColorUpdateWindow( BPoint corner,
								  	  BString& label,
								  	  rgb_color &defaultColor,
								  	  bool enableEditingLabel,
								  	  BString title,
								      BHandler *targetHandler,
								      screen_id currentScreen,
								   	  BMessage* message )
	:
	BWindow( BRect( 100, 100, 300, 500 ),
			 title.String(),
			 B_MODAL_WINDOW,
			 B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK ),
	originalString( label ),
	originalColor( defaultColor),
	labelView( NULL ),
	okButton( NULL ),
	revertButton( NULL ),
	messageToSend( NULL ),
	target( targetHandler ),
	dirty( false )
{
	BSize layoutSize;
	BLayoutItem* item = NULL;
	float width, height, dontCare;
	BView* background = new BView( this->Bounds(),
								   "Background",
								   B_FOLLOW_LEFT | B_FOLLOW_TOP,
								   B_FRAME_EVENTS | B_WILL_DRAW );
	if ( !background )
	{
		/* Panic! */
		exit(1);
	}
	background->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );	
	
	this->enableEditingLabel = enableEditingLabel;
	
	/* There are three parts in the interface of the control.
	 * Upmost is the label, which, according to the user's settings,
	 * can be editable or not.
	 * Next is the color control.
	 * Last is the row of two buttons, Revert and Ok.
	 */

	// Debugging
	printf( "Color Selected = %u, Color Reverted = %u.\n",
			kColorSelected,
			kColorReverted );

	// Construct background view and layout
	BGridLayout* layout = new BGridLayout( B_VERTICAL );
	if ( !layout ) { /* Panic! */ exit(1); }
	layout->SetInsets( 5, 5, 5, 5 );
	
	background->SetLayout( layout );
	this->AddChild( background );

	// Constructing the name label, editable or not.
	if ( enableEditingLabel )
	{
		labelView = new BTextControl( BRect(0, 0, 1, 1),
									  "Label",
								   	  NULL,
								   	  label.String(),
								   	  NULL );
	} else {
		labelView = new BStringView( BRect (0, 0, 1, 1),
									 "Label",
									 label.String() );
	}
	if ( !labelView )
	{
		/* Panic! */
		exit(1);
	}
	labelView->ResizeToPreferred();
	item = layout->AddView( labelView, 0, 0, 3, 1 );
	if ( !item ) { /* Panic! */ exit(1); }
	item->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_CENTER ) );
//	item->SetExplicitMinSize( BSize( width, height ) );
	
	// Construct color control
	BMessage* toSend = new BMessage( kColorChanged );
	if ( !toSend ) { /* Panic! */ exit(1); }
	colorControl = new BColorControl( BPoint( 0, 0 ),
								      B_CELLS_32x8,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:101,代码来源:CategoryItem.cpp

示例7: batteryRect

ExtendedInfoWindow::ExtendedInfoWindow(PowerStatusDriverInterface* interface)
	:
	BWindow(BRect(100, 150, 500, 500), "Extended battery info", B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT |
		B_ASYNCHRONOUS_CONTROLS),
	fDriverInterface(interface),
	fSelectedView(NULL)
{
	fDriverInterface->AcquireReference();

	BView *view = new BView(Bounds(), "view", B_FOLLOW_ALL, 0);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BGroupLayout* mainLayout = new BGroupLayout(B_VERTICAL);
	mainLayout->SetSpacing(10);
	mainLayout->SetInsets(10, 10, 10, 10);
	view->SetLayout(mainLayout);

	BRect rect = Bounds();
	rect.InsetBy(5, 5);
	BBox *infoBox = new BBox(rect, "Power status box");
	infoBox->SetLabel("Battery info");
	BGroupLayout* infoLayout = new BGroupLayout(B_HORIZONTAL);
	infoLayout->SetInsets(10, infoBox->TopBorderOffset() * 2 + 10, 10, 10);
	infoLayout->SetSpacing(10);
	infoBox->SetLayout(infoLayout);
	mainLayout->AddView(infoBox);

	BGroupView* batteryView = new BGroupView(B_VERTICAL);
	batteryView->GroupLayout()->SetSpacing(10);
	infoLayout->AddView(batteryView);

	// create before the battery views
	fBatteryInfoView = new BatteryInfoView();

	BGroupLayout* batteryLayout = batteryView->GroupLayout();
	BRect batteryRect(0, 0, 50, 30);
	for (int i = 0; i < interface->GetBatteryCount(); i++) {
		ExtPowerStatusView* view = new ExtPowerStatusView(interface,
			batteryRect, B_FOLLOW_NONE, i, this);
		view->SetExplicitMaxSize(BSize(70, 80));
		view->SetExplicitMinSize(BSize(70, 80));

		batteryLayout->AddView(view);
		fBatteryViewList.AddItem(view);
		fDriverInterface->StartWatching(view);
		if (!view->IsCritical())
			fSelectedView = view;
	}

	batteryLayout->AddItem(BSpaceLayoutItem::CreateGlue());

	infoLayout->AddView(fBatteryInfoView);

	if (!fSelectedView && fBatteryViewList.CountItems() > 0)
		fSelectedView = fBatteryViewList.ItemAt(0);
	fSelectedView->Select();

	BSize size = mainLayout->PreferredSize();
	ResizeTo(size.width, size.height);
}
开发者ID:mmanley,项目名称:Antares,代码行数:62,代码来源:ExtendedInfoWindow.cpp

示例8: boldFont

/*!	\brief		Constructor for the ActivityWindow class.
 *		\param[in]	data			The data to be displayed.
 *		\param[in]	target		The process to be notified about user's choise.
 *		\param[in]	name			Name of the Event.
 *		\param[in]	category		Category of the Event.
 *		\param[in]	templateMessage		The message to be sent to the target.
 *										If \c NULL is passed, then a new message is constructed
 *										with \c kActivityWindowRepsonceMessage value in \c what.
 *		\param[in]	reminder		\c true if the window is constructed for a reminder, else
 *										\c false. Actually, it matters only for explanation to user.
 *										Default is \c false (it's not a reminder).
 *		\note			A note on memory management:
 *						\c data (the ActionData) belongs to the caller, but it's used only for
 *						initialization of this window. I. e., if the user makes changes to the
 *						data while an ActivityWindow is open, the changes won't be reflected.
 *						However, \c target and \c templateMessage belong to this object. User
 *						shouldn't free them or do anything else.
 */
ActivityWindow::ActivityWindow( ActivityData* data,
									 BMessenger* target,
									 BString		 name,
									 Category*	 category,
									 BMessage* templateMessage,
									 bool reminder )
	:
	BWindow( BRect( 0, 0, 400, 500 ),
				"Event occurred",
				B_FLOATING_WINDOW_LOOK,
				B_NORMAL_WINDOW_FEEL,
				B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS ),
	fTarget( target ),
	fData( data ),
	fTemplateMessage( templateMessage ),
	bIsReminder( reminder ),
	fLastError( B_OK ),
	fEventName( name ),
	fCategory( category ),
	fTitle( NULL ),
	fEventNameView( NULL ),
	fCategoryView( NULL ),
	fTextScroller( NULL ),
	fSnoozeTime( NULL ),
	fNoteText( NULL ),
	fSnooze( NULL ),
	fOk( NULL )
{
	BFont boldFont( be_bold_font );
	BFont plainFont( be_plain_font );
	BFont font;			// For various font-related activities
	font_height	fh;	// For setting the height of the Text View with notification text
	plainFont.GetHeight( &fh );
	int	numberOfColumnsInLayout = 2;
	
	// Sanity check
	if ( !data || !target ) {
		/* Panic! */
		fLastError = B_BAD_VALUE;
		return;
	}
	
	if ( ! fData->GetNotification( NULL ) &&
		  ! fData->GetSound( NULL ) &&
		  ! fData->GetProgram( NULL, NULL ) )
	{
		// Nothing to do! This is not an error!
		fLastError = B_NO_INIT;
		return;
	}
	BView*	background = new BView( Bounds(),
												"Background view",
												B_FOLLOW_ALL_SIDES,
												B_WILL_DRAW );
	if ( !background ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	this->AddChild( background );
	BGridLayout* gridLayout = new BGridLayout();
	if ( !gridLayout ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;
	}
	background->SetLayout( gridLayout );
	background->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
	gridLayout->SetInsets( 5, 5, 5, 5 );
	
	/*-------------------------------------------------
	 * First line - explaining what's happening here
	 *------------------------------------------------*/
	BStringView* exp = new BStringView( BRect( 0, 0, 1, 1 ),
													"Explanation 1",
													( bIsReminder ? 
															"A Reminder has occured!" : 
															"An Event has occured!" ) );
	if ( ! exp ) {
		/* Panic! */
		fLastError = B_NO_MEMORY;
		return;	
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:101,代码来源:ActivityWindow.cpp

示例9: BMessage

void
DataTranslationsWindow::_SetupViews()
{
	fConfigView = NULL;
	// This is NULL until a translator is
	// selected from the listview

	// Window box
	BView* mainView = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
	mainView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(mainView);

	// Add the translators list view
	fTranslatorListView = new TranslatorListView(BRect(0, 0, 1, 1), "TransList",
		B_SINGLE_SELECTION_LIST);
	fTranslatorListView->SetSelectionMessage(new BMessage(kMsgSelectedTranslator));

	BScrollView *scrollView = new BScrollView("scroll_trans", fTranslatorListView,
    		B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS,
    		false, true, B_FANCY_BORDER);

	// Box around the config and info panels
	fRightBox = new BBox("Right_Side");

	// Add the translator icon view
	fIconView = new IconView(BRect(0, 0, 31, 31), "Icon",
		B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS);

	// Add the translator info button
	BButton *button = new BButton("STD", "Info" B_UTF8_ELLIPSIS,
		new BMessage(kMsgTranslatorInfo), B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);

	// Add the translator name view
	fTranslatorNameView = new BStringView("TranName", "None");

	// Populate the translators list view
	_PopulateListView();

	// Build the layout
	BALMLayout *layout = new BALMLayout();
	mainView->SetLayout(layout);

	XTab *x1 = layout->AddXTab();
	XTab *x2 = layout->AddXTab();
	XTab *x3 = layout->AddXTab();
	YTab *y1 = layout->AddYTab();

	Area *leftArea = layout->AddArea(layout->Left(), layout->Top(),
		x1, layout->Bottom(), scrollView);
	leftArea->SetLeftInset(10);
	leftArea->SetTopInset(10);
	leftArea->SetBottomInset(10);

	Area *rightArea = layout->AddArea(x1, layout->Top(), layout->Right(), y1, fRightBox);
	rightArea->SetLeftInset(10);
	rightArea->SetTopInset(10);
	rightArea->SetRightInset(10);
	rightArea->SetBottomInset(10);

	Area *iconArea = layout->AddArea(x1, y1, x2, layout->Bottom(), fIconView);
	iconArea->SetLeftInset(10);
	iconArea->SetBottomInset(10);

	Area *infoButtonArea = layout->AddArea(x3, y1, layout->Right(), layout->Bottom(), button);
	infoButtonArea->SetRightInset(10);
	infoButtonArea->SetBottomInset(10);

	layout->AddConstraint(3.0, x1, -1.0, layout->Right(), OperatorType(EQ), 0.0);

	fTranslatorListView->MakeFocus();
	fTranslatorListView->Select(0);
}
开发者ID:mariuz,项目名称:haiku,代码行数:72,代码来源:DataTranslationsWindow.cpp

示例10: frame

PAccountDialog::PAccountDialog(const char *title, const char *protocol,
                               const char *account, BMessage settingsTemplate,
                               BMessage settings, BMessenger *target,
                               BMessage save, BMessage cancel)
	: BWindow(WINDOW_RECT, title, B_TITLED_WINDOW,
		B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS |
                B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
	fOriginalAccount(account),
	fTemplate(settingsTemplate),
	fSettings(settings),
	fTarget(target),
	fSave(save),
	fCancel(cancel)
{
	BRect frame(0, 0, 1, 1);
#ifndef __HAIKU__
	frame = Bounds();
#endif

	BView *view = ViewFactory::Create<BView>(frame, "top", B_FOLLOW_ALL_SIDES,
		B_WILL_DRAW | B_FRAME_EVENTS);

	// Account name
	fAccountName = ViewFactory::Create<BTextControl>(frame, "account_name", _T("Account name:"),
		fOriginalAccount.String(), NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS);
	fAccountName->SetFont(be_bold_font);
	fAccountName->MakeFocus();

	// Account name divider
	fAccountNameDivider = new Divider(frame, "AccountNameDivider", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS);
	fAccountNameDivider->ResizeToPreferred();

	fProtocolControl = new PClientView(frame, "ProtocolControls", NULL, fTemplate, fSettings);

	fCancelButton = ViewFactory::Create<BButton>(frame, "cancel", _T("Cancel"), new BMessage(kAddAccountCancel));
	fOKButton = ViewFactory::Create<BButton>(frame, "ok", _T("OK"), new BMessage(kAddAccountOk));

#ifdef __HAIKU__
	float inset = ceilf(be_plain_font->Size() * 0.7f);

	fAccountNameDivider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));
	//fProtocolControl->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

	view->SetLayout(new BGroupLayout(B_VERTICAL));
	view->AddChild(BGroupLayoutBuilder(B_VERTICAL, inset)
		.AddGroup(B_VERTICAL, inset)
			.Add(fAccountName)
			.Add(fAccountNameDivider)
			.Add(fProtocolControl)
		.End()
		.SetInsets(inset, inset, inset, inset)
	);
	view->AddChild(BGroupLayoutBuilder(B_VERTICAL, inset)
		.AddGroup(B_HORIZONTAL, inset)
			.AddGlue()
			.Add(fCancelButton)
			.Add(fOKButton)
		.End()
		.SetInsets(inset, inset, inset, inset)
	);

	SetLayout(new BGroupLayout(B_HORIZONTAL));
	GetLayout()->AddView(view);
#else
	view->AddChild(fAccountName);
	view->AddChild(fAccountNameDivider);
	
	view->AddChild(fProtocolControl);
	
	view->AddChild(fCancelButton);
	view->AddChild(fOKButton);
	AddChild(view);
	
	LayoutGUI();
#endif

	CenterWindowOnScreen(this);
};
开发者ID:HaikuArchives,项目名称:IMKit,代码行数:78,代码来源:PAccountDialog.cpp

示例11: dummyRect

CapabilitiesView::CapabilitiesView()
	: BView(TR("Capabilities"), 0, NULL)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetLayout(new BGroupLayout(B_VERTICAL));

	BRect dummyRect(0, 0, 0, 0);

	const float kInset = 10;

	int lights = 0;
	int clippingPlanes = 0;
	int modelStack = 0;
	int projectionStack = 0;
	int textureStack = 0;
	int maxTex3d = 0;
	int maxTex2d = 0;
	int nameStack = 0;
	int listStack = 0;
	int maxPoly = 0;
	int attribStack = 0;
	int buffers = 0;
	int convolutionWidth = 0;
	int convolutionHeight = 0;
	int maxIndex = 0;
	int maxVertex = 0;
	int textureUnits = 0;

	glGetIntegerv(GL_MAX_LIGHTS, &lights);
	glGetIntegerv(GL_MAX_CLIP_PLANES, &clippingPlanes);
	glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &modelStack);
	glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, &projectionStack);
	glGetIntegerv(GL_MAX_TEXTURE_STACK_DEPTH, &textureStack);
	glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &maxTex3d);
	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTex2d);
	glGetIntegerv(GL_MAX_NAME_STACK_DEPTH, &nameStack);
	glGetIntegerv(GL_MAX_LIST_NESTING, &listStack);
	glGetIntegerv(GL_MAX_EVAL_ORDER, &maxPoly);
	glGetIntegerv(GL_MAX_ATTRIB_STACK_DEPTH, &attribStack);
	glGetIntegerv(GL_AUX_BUFFERS, &buffers);
	glGetIntegerv(GL_MAX_CONVOLUTION_WIDTH, &convolutionWidth);
	glGetIntegerv(GL_MAX_CONVOLUTION_HEIGHT, &convolutionHeight);
	glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &maxIndex);
	glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &maxVertex);
	glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &textureUnits);

	BString tempString;
	BView *rootView = new BView("root view", 0, NULL);
	rootView->SetLayout(new BGroupLayout(B_VERTICAL));

	tempString << (int32) buffers;
	AddStringView(rootView, "Buffers", TR("Auxiliary buffer(s):"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) modelStack;
	AddStringView(rootView, "ModelStack", TR("Model stack size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) projectionStack;
	AddStringView(rootView, "ProjectionStack", TR("Projection stack size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) textureStack;
	AddStringView(rootView, "TextureStack", TR("Texture stack size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) nameStack;
	AddStringView(rootView, "NameStack", TR("Name stack size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) listStack;
	AddStringView(rootView, "ListStack", TR("List stack size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) attribStack;
	AddStringView(rootView, "AttribStack", TR("Attributes stack size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) maxTex3d;
	AddStringView(rootView, "MaxTex3D", TR("Max. 3D texture size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) maxTex2d;
	AddStringView(rootView, "MaxTex2D", TR("Max. 2D texture size:"),
		tempString.String(), true);

	tempString.SetTo("");
	tempString << (int32) textureUnits;
	AddStringView(rootView, "MaxTexUnits", TR("Max. texture units:"),
		tempString.String(), true);

	tempString.SetTo("");
//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:CapabilitiesView.cpp

示例12: BMessage

LocaleWindow::LocaleWindow()
	:
	BWindow(BRect(0, 0, 0, 0), "Locale", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE
		| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	BCountry* defaultCountry;
	be_locale_roster->GetDefaultCountry(&defaultCountry);

	SetLayout(new BGroupLayout(B_HORIZONTAL));

	float spacing = be_control_look->DefaultItemSpacing();

	BTabView* tabView = new BTabView("tabview");
	BGroupView* languageTab = new BGroupView(B_TRANSLATE("Language"),
		B_HORIZONTAL, spacing);

	// first list: available languages
	fLanguageListView = new LanguageListView("available",
		B_MULTIPLE_SELECTION_LIST);
	BScrollView* scrollView = new BScrollView("scroller", fLanguageListView,
		B_WILL_DRAW | B_FRAME_EVENTS, false, true);

	fLanguageListView->SetInvocationMessage(new BMessage(kMsgLanguageInvoked));
	fLanguageListView->SetDragMessage(new BMessage(kMsgLanguageDragged));

	// Fill the language list from the LocaleRoster data
	BMessage installedLanguages;
	if (be_locale_roster->GetInstalledLanguages(&installedLanguages) == B_OK) {
		BString currentID;
		LanguageListItem* lastAddedCountryItem = NULL;

		for (int i = 0; installedLanguages.FindString("langs", i, &currentID)
				== B_OK; i++) {
			// Now get an human-readable, localized name for each language
			BLanguage* currentLanguage;
			be_locale_roster->GetLanguage(currentID.String(),
				&currentLanguage);

			BString name;
			currentLanguage->GetName(name);

			// TODO: as long as the app_server doesn't support font overlays,
			// use the translated name if problematic characters are used...
			const char* string = name.String();
			while (uint32 code = BUnicodeChar::FromUTF8(&string)) {
				if (code > 1424) {
					currentLanguage->GetTranslatedName(name);
					break;
				}
			}

			LanguageListItem* item = new LanguageListItem(name,
				currentID.String(), currentLanguage->Code());
			if (currentLanguage->IsCountrySpecific()
				&& lastAddedCountryItem != NULL
				&& lastAddedCountryItem->Code() == item->Code()) {
				fLanguageListView->AddUnder(item, lastAddedCountryItem);
			} else {
				// This is a language variant, add it at top-level
				fLanguageListView->AddItem(item);
				if (!currentLanguage->IsCountrySpecific()) {
					item->SetExpanded(false);
					lastAddedCountryItem = item;
				}
			}

			delete currentLanguage;
		}

		fLanguageListView->FullListSortItems(compare_typed_list_items);
	} else {
		BAlert* alert = new BAlert("Error",
			B_TRANSLATE("Unable to find the available languages! You can't "
				"use this preflet!"),
			B_TRANSLATE("OK"), NULL, NULL,
			B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT);
		alert->Go();
	}

	// Second list: active languages
	fPreferredListView = new LanguageListView("preferred",
		B_MULTIPLE_SELECTION_LIST);
	BScrollView* scrollViewEnabled = new BScrollView("scroller",
		fPreferredListView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);

	fPreferredListView->SetInvocationMessage(
		new BMessage(kMsgPreferredLanguageInvoked));
	fPreferredListView->SetDeleteMessage(
		new BMessage(kMsgPreferredLanguageDeleted));
	fPreferredListView->SetDragMessage(
		new BMessage(kMsgPreferredLanguageDragged));

	BLayoutBuilder::Group<>(languageTab)
		.AddGroup(B_VERTICAL, spacing)
			.Add(new BStringView("", B_TRANSLATE("Available languages")))
			.Add(scrollView)
			.End()
		.AddGroup(B_VERTICAL, spacing)
			.Add(new BStringView("", B_TRANSLATE("Preferred languages")))
			.Add(scrollViewEnabled)
//.........这里部分代码省略.........
开发者ID:mariuz,项目名称:haiku,代码行数:101,代码来源:LocaleWindow.cpp


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