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


C++ BLayoutItem类代码示例

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


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

示例1: BTextControl

void
BreakpointEditWindow::_Init()
{
	fConditionInput = new BTextControl(NULL, NULL, NULL);
	BLayoutItem* textLayoutItem = fConditionInput->CreateTextViewLayoutItem();
	textLayoutItem->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET));
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.SetInsets(B_USE_DEFAULT_SPACING)
		.Add((fAlwaysRadio = new BRadioButton("Break always",
				new BMessage(MSG_SET_BREAK_ALWAYS))))
		.AddGroup(B_HORIZONTAL)
			.Add((fConditionRadio = new BRadioButton("Break on condition: ",
				new BMessage(MSG_SET_BREAK_ON_CONDITION))))
			.Add(textLayoutItem)
		.End()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add((fSaveButton = new BButton("Save",
				new BMessage(MSG_SAVE_BREAKPOINT_SETTINGS))))
			.Add((fCancelButton = new BButton("Cancel",
				new BMessage(B_CANCEL))))
		.End()
	.End();

	AutoLocker< ::Team> teamLocker(fTeam);
	if (fTargetBreakpoint->HasCondition()) {
		fConditionRadio->SetValue(B_CONTROL_ON);
		fConditionInput->SetText(fTargetBreakpoint->Condition());
	} else {
		fAlwaysRadio->SetValue(B_CONTROL_ON);
		fConditionInput->SetEnabled(false);
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:33,代码来源:BreakpointEditWindow.cpp

示例2:

LaunchButton*
PadView::ButtonAt(int32 index) const
{
	BLayoutItem* item = fButtonLayout->ItemAt(index);
	if (item == NULL)
		return NULL;
	return dynamic_cast<LaunchButton*>(item->View());
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:8,代码来源:PadView.cpp

示例3:

BView*
TabManager::ViewForTab(int32 tabIndex) const
{
	BLayoutItem* item = fCardLayout->ItemAt(tabIndex);
	if (item != NULL)
		return item->View();
	return NULL;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:8,代码来源:TabManager.cpp

示例4: Panel

NamePanel::NamePanel(const char* label, const char* text, BWindow* window,
		BHandler* target, BMessage* message, const BSize& size)
	:
	Panel(BRect(B_ORIGIN, size), B_TRANSLATE("Name Panel"),
		B_MODAL_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
		B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE
			| B_AUTO_UPDATE_SIZE_LIMITS),
	fWindow(window),
	fTarget(target),
	fMessage(message)
{
	BButton* defaultButton = new BButton(B_TRANSLATE("OK"),
		new BMessage(MSG_PANEL_OK));
	BButton* cancelButton = new BButton(B_TRANSLATE("Cancel"),
		new BMessage(MSG_PANEL_CANCEL));
	fNameTC = new BTextControl(label, text, NULL);
	BLayoutItem* inputItem = fNameTC->CreateTextViewLayoutItem();
	inputItem->SetExplicitMinSize(
		BSize(fNameTC->StringWidth("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
			B_SIZE_UNSET));

	BLayoutBuilder::Group<>(this, B_VERTICAL, 10)
		.AddGlue()

		// controls
		.AddGroup(B_HORIZONTAL, 5)
			.AddStrut(5)

			// text control
			.Add(fNameTC->CreateLabelLayoutItem())
			.Add(inputItem)
			.AddStrut(5)
			.End()

		.AddGlue()

		// buttons
		.AddGroup(B_HORIZONTAL, 5)
			.AddGlue()
			.Add(cancelButton)
			.Add(defaultButton)
			.AddStrut(5)
			.End()

		.AddGlue();

	SetDefaultButton(defaultButton);
	fNameTC->MakeFocus(true);

	if (fWindow && fWindow->Lock()) {
		fSavedTargetWindowFeel = fWindow->Feel();
		if (fSavedTargetWindowFeel != B_NORMAL_WINDOW_FEEL)
			fWindow->SetFeel(B_NORMAL_WINDOW_FEEL);
		fWindow->Unlock();
	}	

	AddToSubset(fWindow);
}
开发者ID:DonCN,项目名称:haiku,代码行数:58,代码来源:NamePanel.cpp

示例5:

int32
BLayout::IndexOfView(BView* child) const
{
	int itemCount = fItems.CountItems();
	for (int32 i = 0; i < itemCount; i++) {
		BLayoutItem* item = (BLayoutItem*)fItems.ItemAt(i);
		if (dynamic_cast<BViewLayoutItem*>(item) && item->View() == child)
			return i;
	}

	return -1;
}
开发者ID:mariuz,项目名称:haiku,代码行数:12,代码来源:Layout.cpp

示例6: _ValidateMinMax

void
BTwoDimensionalLayout::LayoutView()
{
	_ValidateMinMax();

	// layout the horizontal/vertical elements
	BSize size = SubtractInsets(View()->Frame().Size());

#ifdef DEBUG_LAYOUT
printf("BTwoDimensionalLayout::LayoutView(%p): size: (%.1f, %.1f)\n",
View(), size.width, size.height);
#endif

	fLocalLayouter->Layout(size);

	// layout the items
	int itemCount = CountItems();
	for (int i = 0; i < itemCount; i++) {
		BLayoutItem* item = ItemAt(i);
		if (item->IsVisible()) {
			Dimensions itemDimensions;
			GetItemDimensions(item, &itemDimensions);
			BRect frame = fLocalLayouter->ItemFrame(itemDimensions);
			frame.left += fLeftInset;
			frame.top += fTopInset;
			frame.right += fLeftInset;
			frame.bottom += fTopInset;
{
#ifdef DEBUG_LAYOUT
printf("  frame for item %2d (view: %p): ", i, item->View());
frame.PrintToStream();
#endif
//BSize min(item->MinSize());
//BSize max(item->MaxSize());
//printf("    min: (%.1f, %.1f), max: (%.1f, %.1f)\n", min.width, min.height,
//	max.width, max.height);
//if (item->HasHeightForWidth()) {
//float minHeight, maxHeight, preferredHeight;
//item->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight,
//	&preferredHeight);
//printf("    hfw: min: %.1f, max: %.1f, pref: %.1f\n", minHeight, maxHeight,
//	preferredHeight);
//}
}

			item->AlignInFrame(frame);
		}
//else
//printf("  item %2d not visible", i);
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:51,代码来源:TwoDimensionalLayout.cpp

示例7: BView

/*!	
 *	\brief			Default constructor
 *	\param[in]	frame	The rectangle enclosing the view
 *	\param[in]	name	Name of the view. Will be passed to BView's constructor.
 *
 */
CalendarModulePreferencesView::CalendarModulePreferencesView( BRect frame )
	:
	BView( BRect( frame.left, frame.top, frame.right, frame.bottom-10 ), 
		 "Calendar Module Preferences",
		 B_FOLLOW_LEFT | B_FOLLOW_TOP,
		 B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS )
{
	BRect tempFrame = this->Bounds();	// Got the boundaries
	
	this->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
	tempFrame.InsetBySelf( 5, 5 );
	tempFrame.bottom -= 10;
	
	/* Add the chooser for the calendar modules */
	BGroupLayout* groupLayout = new BGroupLayout( B_VERTICAL );
	if ( !groupLayout ) {
		/* Panic! */
		exit( 1 );
	}
	groupLayout->SetSpacing( 2 );
	this->SetLayout( groupLayout );
	
	// Create the menu with all supported calendar modules
	calendarModules = PopulateModulesMenu();
	if ( ! calendarModules ) {
		/* Panic! */
		exit ( 1 );
	}
	
	calendarModuleSelector = new BMenuField( BRect( 0, 0, this->Bounds().Width() - 10, 1 ),
											 "Calendar Modules selector",
											 "Calendar module:",
											 calendarModules,
											 B_FOLLOW_H_CENTER | B_FOLLOW_TOP );
	if ( !calendarModuleSelector ) {
		/* Panic! */
		exit ( 1 );
	}
	
	calendarModuleSelector->ResizeToPreferred();
	
	// Add the menu with all calendar modules to the layout
	BLayoutItem* layoutItem = groupLayout->AddView( 0, calendarModuleSelector, 1 );
	if ( layoutItem ) {
		layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_TOP ) );
	}
	
	// Relayout
	groupLayout->Relayout();
}	// <-- end of constructor for CalendarModulePreferencesView
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:56,代码来源:CalendarModulePreferencesView.cpp

示例8:

void
MediaWindow::_ClearParamView()
{
	BLayoutItem* item = fContentLayout->VisibleItem();
	if (!item)
		return;

	BView* view = item->View();
	if (view != fVideoView && view != fAudioView && view != fMidiView) {
		fContentLayout->RemoveItem(item);
		delete item;
		delete view;
		delete fParamWeb;
		fParamWeb = NULL;
	}
}
开发者ID:bhanug,项目名称:haiku,代码行数:16,代码来源:MediaWindow.cpp

示例9: _FindInsertIndex

	int32 _FindInsertIndex(PartitionView* view, BGroupLayout* layout) const
	{
		int32 insertIndex = 0;
		int32 count = layout->CountItems();
		for (int32 i = 0; i < count; i++) {
			BLayoutItem* item = layout->ItemAt(i);
			if (!item)
				break;
			PartitionView* sibling
				= dynamic_cast<PartitionView*>(item->View());
			if (sibling && sibling->Offset() > view->Offset())
				break;
			insertIndex++;
		}
		return insertIndex;
	}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:16,代码来源:DiskView.cpp

示例10: CountItems

// _ValidateMinMax
void
BCardLayout::_ValidateMinMax()
{
	if (fMinMaxValid)
		return;

	fMin.width = 0;
	fMin.height = 0;
	fMax.width = B_SIZE_UNLIMITED;
	fMax.height = B_SIZE_UNLIMITED;
	fPreferred.width = 0;
	fPreferred.height = 0;

	int32 itemCount = CountItems();
	for (int32 i = 0; i < itemCount; i++) {
		BLayoutItem* item = ItemAt(i);

		BSize min = item->MinSize();
		BSize max = item->MaxSize();
		BSize preferred = item->PreferredSize();

		fMin.width = max_c(fMin.width, min.width);
		fMin.height = max_c(fMin.height, min.height);

		fMax.width = min_c(fMax.width, max.width);
		fMax.height = min_c(fMax.height, max.height);

		fPreferred.width = max_c(fPreferred.width, preferred.width);
		fPreferred.height = max_c(fPreferred.height, preferred.height);
	}

	fMax.width = max_c(fMax.width, fMin.width);
	fMax.height = max_c(fMax.height, fMin.height);

	fPreferred.width = max_c(fPreferred.width, fMin.width);
	fPreferred.height = max_c(fPreferred.height, fMin.height);
	fPreferred.width = min_c(fPreferred.width, fMax.width);
	fPreferred.height = min_c(fPreferred.height, fMax.height);

	fMinMaxValid = true;

	if (BView* view = View())
		view->ResetLayoutInvalidation();
}
开发者ID:mariuz,项目名称:haiku,代码行数:45,代码来源:CardLayout.cpp

示例11: streamNodeSource

void
TFilePanel::RestoreState()
{
	BNode defaultingNode;
	if (DefaultStateSourceNode(kDefaultFilePanelTemplate, &defaultingNode,
			false)) {
		AttributeStreamFileNode streamNodeSource(&defaultingNode);
		RestoreWindowState(&streamNodeSource);
		PoseView()->Init(&streamNodeSource);
	} else {
		RestoreWindowState(NULL);
		PoseView()->Init(NULL);
	}

	// Finish UI creation now that the PoseView is initialized
	BLayoutItem* item
		= fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
	BSize minSize = item->MinSize();
	BSize maxSize = item->MaxSize();
	item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight));
	item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight));

	BRect rect(fBorderedView->Frame());
	rect.right = rect.left + kCountViewWidth;
	rect.top = rect.bottom + 1;
	rect.bottom = rect.top + PoseView()->HScrollBar()->Bounds().Height() - 1;
	PoseView()->CountView()->MoveTo(rect.LeftTop());
	PoseView()->CountView()->ResizeTo(rect.Size());
	PoseView()->CountView()->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fBackView->AddChild(PoseView()->CountView(), fBorderedView);

	PoseView()->HScrollBar()->MoveBy(kCountViewWidth + 1, 0);
	PoseView()->HScrollBar()->ResizeBy(-kCountViewWidth - 1, 0);

	// The Be Book states that the BTitleView will have a name of "TitleView",
	// and so some apps will try to grab it by that name and move it around.
	// They don't need to, because resizing "PoseView" (really the BorderedView)
	// will resize the BTitleView as well. So just create a dummy view here
	// so that they don't get NULL when trying to find the view.
	BView* dummyTitleView = new BView(BRect(), "TitleView", B_FOLLOW_NONE, 0);
	fBackView->AddChild(dummyTitleView);
	dummyTitleView->Hide();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:43,代码来源:FilePanelPriv.cpp

示例12: ItemAt

bool
BLayout::RemoveView(BView* child)
{
	bool removed = false;

	// a view can have any number of layout items - we need to remove them all
	for (int32 i = fItems.CountItems(); i-- > 0;) {
		BLayoutItem* item = ItemAt(i);

		if (item->View() != child)
			continue;

		RemoveItem(i);
		removed = true;
		delete item;
	}

	return removed;
}
开发者ID:mariuz,项目名称:haiku,代码行数:19,代码来源:Layout.cpp

示例13: _ValidateMinMax

// GetHeightForWidth
void
BCardLayout::GetHeightForWidth(float width, float* min, float* max,
	float* preferred)
{
	_ValidateMinMax();

	// init with useful values
	float minHeight = fMin.height;
	float maxHeight = fMax.height;
	float preferredHeight = fPreferred.height;

	// apply the items' constraints
	int32 count = CountItems();
	for (int32 i = 0; i < count; i++) {
		BLayoutItem* item = ItemAt(i);
		if (item->HasHeightForWidth()) {
			float itemMinHeight;
			float itemMaxHeight;
			float itemPreferredHeight;
			item->GetHeightForWidth(width, &itemMinHeight, &itemMaxHeight,
				&itemPreferredHeight);
			minHeight = max_c(minHeight, itemMinHeight);
			maxHeight = min_c(maxHeight, itemMaxHeight);
			preferredHeight = min_c(preferredHeight, itemPreferredHeight);
		}
	}

	// adjust max and preferred, if necessary
	maxHeight = max_c(maxHeight, minHeight);
	preferredHeight = max_c(preferredHeight, minHeight);
	preferredHeight = min_c(preferredHeight, maxHeight);

	if (min)
		*min = minHeight;
	if (max)
		*max = maxHeight;
	if (preferred)
		*preferred = preferredHeight;
}
开发者ID:mariuz,项目名称:haiku,代码行数:40,代码来源:CardLayout.cpp

示例14:

bool
BTwoDimensionalLayout::LocalLayouter::AddHeightForWidthConstraints(
	VerticalCompoundLayouter* compoundLayouter, Layouter* layouter,
	BLayoutContext* context)
{
	if (context != fHorizontalLayoutContext)
		return false;

	if (fHeightForWidthConstraintsAdded)
		return false;

	LayoutInfo* hLayoutInfo = fHLayouter->GetLayoutInfo();

	// add the children's height for width constraints
	int32 itemCount = fHeightForWidthItems.CountItems();
	for (int32 i = 0; i < itemCount; i++) {
		BLayoutItem* item = (BLayoutItem*)fHeightForWidthItems.ItemAt(i);
		Dimensions itemDimensions;
		fLayout->GetItemDimensions(item, &itemDimensions);

		float minHeight, maxHeight, preferredHeight;
		item->GetHeightForWidth(
			hLayoutInfo->ElementRangeSize(itemDimensions.x,
				itemDimensions.width),
			&minHeight, &maxHeight, &preferredHeight);
		layouter->AddConstraints(
			itemDimensions.y,
			itemDimensions.height,
			minHeight,
			maxHeight,
			preferredHeight);
	}

	SetHeightForWidthConstraintsAdded(true);

	return true;
}
开发者ID:mariuz,项目名称:haiku,代码行数:37,代码来源:TwoDimensionalLayout.cpp

示例15: CountElements

void
BTwoDimensionalLayout::LocalLayouter::AddConstraints(
	CompoundLayouter* compoundLayouter, Layouter* layouter)
{
	enum orientation orientation = compoundLayouter->Orientation();
	int itemCount = fLayout->CountItems();
	if (itemCount > 0) {
		for (int i = 0; i < itemCount; i++) {
			BLayoutItem* item = fLayout->ItemAt(i);
			if (item->IsVisible()) {
				Dimensions itemDimensions;
				fLayout->GetItemDimensions(item, &itemDimensions);

				BSize min = item->MinSize();
				BSize max = item->MaxSize();
				BSize preferred = item->PreferredSize();

				if (orientation == B_HORIZONTAL) {
					layouter->AddConstraints(
						itemDimensions.x,
						itemDimensions.width,
						min.width,
						max.width,
						preferred.width);

					if (item->HasHeightForWidth())
						fHeightForWidthItems.AddItem(item);

				} else {
					layouter->AddConstraints(
						itemDimensions.y,
						itemDimensions.height,
						min.height,
						max.height,
						preferred.height);
				}
			}
		}

		// add column/row constraints
		ColumnRowConstraints constraints;
		int elementCount = CountElements(compoundLayouter);
		for (int element = 0; element < elementCount; element++) {
			fLayout->GetColumnRowConstraints(orientation, element,
				&constraints);
			layouter->SetWeight(element, constraints.weight);
			layouter->AddConstraints(element, 1, constraints.min,
				constraints.max, constraints.min);
		}
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:51,代码来源:TwoDimensionalLayout.cpp


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