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


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

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


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

示例1: MoveSplitter

/**
	Resizes a child view (pane) and its sibling.
*/
void SplitView::MoveSplitter(BView *pane, BPoint d)
{
	pane->ResizeBy(d.x, d.y);
	BView *sibling = pane->NextSibling();
	if (sibling) {
		// Don't overlap the next view (a smaller update rect).
		if (d.x > 0 || d.y  > 0)
			sibling->ResizeBy(-d.x, -d.y);
		sibling->MoveBy(d.x, d.y);
		if (d.x < 0 || d.y < 0)
			sibling->ResizeBy(-d.x, -d.y);
	}	
	Draw(Bounds());
}
开发者ID:HaikuArchives,项目名称:Album,代码行数:17,代码来源:SplitView.cpp

示例2: textRect

TextRequestDialog::TextRequestDialog(const char *title, const char *information,
		const char *request, const char *text)
	: BWindow(kWindowRect, title, B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE, 0),
	fInvoker(NULL)
{
	BRect rect = Bounds();
	BView *backgroundView = new BView(rect, "background", B_FOLLOW_ALL_SIDES, 0);
	backgroundView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	rect.InsetBy(5, 5);
	rect.bottom = rect.top;
		// init
	
	if(information) {
		BRect textRect(rect);
		textRect.OffsetTo(0, 0);
		fTextView = new BTextView(rect, "TextView", textRect, B_FOLLOW_NONE,
			B_WILL_DRAW);
		fTextView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
		fTextView->MakeSelectable(false);
		fTextView->MakeEditable(false);
		fTextView->SetText(information);
		float textHeight = fTextView->TextHeight(0, fTextView->CountLines());
		backgroundView->ResizeBy(0, textHeight + 5);
		ResizeBy(0, textHeight + 5);
		fTextView->ResizeBy(0, textHeight - textRect.Height());
		rect.bottom += textHeight + 5;
		backgroundView->AddChild(fTextView);
	} else
		fTextView = NULL;
	
	rect.top = rect.bottom + 5;
	rect.bottom = rect.top + 20;
	fTextControl = new BTextControl(rect, "request", request, text, NULL);
	fTextControl->SetModificationMessage(new BMessage(kMsgUpdateControls));
	fTextControl->SetDivider(fTextControl->StringWidth(fTextControl->Label()) + 5);
	if(text && strlen(text) > 0)
		fTextControl->TextView()->SelectAll();
	
	rect.top = rect.bottom + 10;
	rect.bottom = rect.top + 25;
	rect.left = rect.right - kDefaultButtonWidth;
	BMessage message(kMsgButton);
	message.AddInt32("which", 1);
	fOKButton = new BButton(rect, "okButton", kLabelOK, new BMessage(message));
	rect.right = rect.left - 10;
	rect.left = rect.right - kDefaultButtonWidth;
	message.ReplaceInt32("which", 0);
	BButton *cancelButton = new BButton(rect, "cancelButton", kLabelCancel,
		new BMessage(message));
	backgroundView->AddChild(cancelButton);
	backgroundView->AddChild(fOKButton);
	backgroundView->AddChild(fTextControl);
	AddChild(backgroundView);
	
	fTextControl->MakeFocus(true);
	SetDefaultButton(fOKButton);
	
	UpdateControls();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:59,代码来源:TextRequestDialog.cpp

示例3: UpdateParentHeight

	void UpdateParentHeight(float height)
	{
		if (IsTop()) {
			fBounds.OffsetBy(0, height);
		} else {
			BView* parent = GetView();
			parent->ResizeBy(0, height);
		}
	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:9,代码来源:PPDConfigView.cpp

示例4: BWindow

AddOnListInfo::AddOnListInfo(BRect frame,BView *mother)
: BWindow(frame,"DontWorryWindow",B_BORDERED_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,B_AVOID_FOCUS ),
_motherMessenger(mother)
{
	CPreferences	prefs(PREF_FILE_NAME,PREF_PATH_NAME);
	BRect			listRect = Bounds();
	BScrollView		*scrollinfo;
	BView			*scrollHBar;
	float			scrollHsize;

	_lastClass = NULL;
	_typeRequested = -1;

				
	// initialisees les images
	prefs.Load();
	_classesBitmap = prefs.GetBitmap("classes");
	_metodesBitmap = prefs.GetBitmap("metodes");
	_variablesBitmap = prefs.GetBitmap("variables");
	_privateBitmap = prefs.GetBitmap("private");
	_protectedBitmap = prefs.GetBitmap("protected");
	_virtualBitmap = prefs.GetBitmap("virtual");
	
	listRect.right -= 15;
	listRect.bottom -=15;
	_listOfInfos = new AddOnListView(listRect);
	scrollinfo = new BScrollView("scroll-info",_listOfInfos,B_FOLLOW_ALL_SIDES,0,true,true);
	
	// deplace la scroll bar du bas
	scrollHBar = scrollinfo->FindView("_HSB_");
	scrollHBar->ResizeBy(-70,0);
	scrollHBar->MoveBy(70,0);
	scrollHsize = (scrollHBar->Bounds()).Height()+1;
	
	listRect = scrollinfo->Bounds();
	_progress = new AddOnProgressView(BRect(2,listRect.bottom-scrollHsize,70,listRect.bottom-1));
	scrollinfo->AddChild(_progress);

	AddChild(scrollinfo);
	
	// place le focus sur la liste
	_listOfInfos->MakeFocus(true);
	
	// envoyer le pointer de la fenetre a la vue pour les deplacement
	BMessage	moveMsg(MOVE_WINDOW_PTR);
	
	moveMsg.AddPointer(WINDOW_RESULT_PTR,this);
	_motherMessenger.SendMessage(&moveMsg);
}
开发者ID:mmuman,项目名称:dontworry,代码行数:49,代码来源:AddOnListInfo.cpp

示例5: BMessage

// SavePanel class
SavePanel::SavePanel(const char* name,
					 BMessenger* target,
					 entry_ref* startDirectory,
					 uint32 nodeFlavors,
					 bool allowMultipleSelection,
					 BMessage* message,
					 BRefFilter* filter,
					 bool modal,
					 bool hideWhenDone)
	: BFilePanel(B_SAVE_PANEL, target, startDirectory,
				 nodeFlavors, allowMultipleSelection,
				 message, filter, modal, hideWhenDone),
	  BHandler(name),
	  fConfigWindow(NULL),
	  fFormatM(NULL),
	  fExportMode(EXPORT_MODE_ICON_RDEF)
{
	BWindow* window = Window();
	if (!window || !window->Lock())
		return;

	window->SetTitle(B_TRANSLATE("Save image"));

	// add this instance as BHandler to the window's looper
	window->AddHandler(this);
	
	// find a couple of important views and mess with their layout
	BView* background = Window()->ChildAt(0);
	BButton* cancel = dynamic_cast<BButton*>(background->FindView("cancel button"));
	BView* textview = background->FindView("text view");
	BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(background->FindView("HScrollBar"));

	if (!background || !cancel || !textview || !hscrollbar) {
		printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
		return;
	}

	_BuildMenu();

	BRect rect = textview->Frame();
	rect.top = cancel->Frame().top;
	font_height fh;
	be_plain_font->GetHeight(&fh);
	rect.bottom = rect.top + fh.ascent + fh.descent + 5.0;

	fFormatMF = new BMenuField(rect, "format popup", B_TRANSLATE("Format"),
								fFormatM, true,	
								B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
								B_WILL_DRAW | B_NAVIGABLE);
	fFormatMF->SetDivider(be_plain_font->StringWidth(
		B_TRANSLATE("Format")) + 7);
	fFormatMF->MenuBar()->ResizeToPreferred();
	fFormatMF->ResizeToPreferred();

	float height = fFormatMF->Bounds().Height() + 8.0;

	// find all the views that are in the way and
	// move up them up the height of the menu field
	BView *poseview = background->FindView("PoseView");
	if (poseview) poseview->ResizeBy(0, -height);
	BButton *insert = (BButton *)background->FindView("default button");
	if (hscrollbar) hscrollbar->MoveBy(0, -height);
	BScrollBar *vscrollbar = (BScrollBar *)background->FindView("VScrollBar");
	if (vscrollbar) vscrollbar->ResizeBy(0, -height);
	BView *countvw = (BView *)background->FindView("CountVw");
	if (countvw) countvw->MoveBy(0, -height);
	textview->MoveBy(0, -height);

#if HAIKU_TARGET_PLATFORM_DANO
	fFormatMF->MoveTo(textview->Frame().left, fFormatMF->Frame().top + 2);
#else
	fFormatMF->MoveTo(textview->Frame().left, fFormatMF->Frame().top);
#endif

	background->AddChild(fFormatMF);

	// Build the "Settings" button relative to the format menu
	rect = cancel->Frame();
	rect.OffsetTo(fFormatMF->Frame().right + 5.0, rect.top);
	fSettingsB = new BButton(rect, "settings", 
							 B_TRANSLATE("Settings"B_UTF8_ELLIPSIS),
							 new BMessage(MSG_SETTINGS),
							 B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
							 B_WILL_DRAW | B_NAVIGABLE);
	fSettingsB->ResizeToPreferred();
	background->AddChild(fSettingsB);
	fSettingsB->SetTarget(this);

	textview->ResizeTo(fSettingsB->Frame().right - fFormatMF->Frame().left,
					   textview->Frame().Height());

	// Make sure the smallest window won't draw the "Settings" button over anything else
	float minWindowWidth = textview->Bounds().Width()
							+ cancel->Bounds().Width()
							+ (insert ? insert->Bounds().Width() : 0.0)
							+ 90;
	Window()->SetSizeLimits(minWindowWidth, 10000, 250, 10000);
	if (Window()->Bounds().IntegerWidth() + 1 < minWindowWidth)
		Window()->ResizeTo(minWindowWidth, Window()->Bounds().Height());
//.........这里部分代码省略.........
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:101,代码来源:SavePanel.cpp

示例6: DynamicScrollView

BView *
DefaultMediaTheme::MakeViewFor(BParameterWeb *web, const BRect *hintRect)
{
	CALLED();

	if (web == NULL)
		return NULL;

	BRect rect;
	if (hintRect)
		rect = *hintRect;
		
	BRect bestRect;

	// do we have more than one attached parameter group?
	// if so, use a tabbed view with a tab for each group

	TabView *tabView = NULL;

	if (web->CountGroups() > 1)
		tabView = new TabView(rect, "web");

	rect.OffsetTo(B_ORIGIN);

	for (int32 i = 0; i < web->CountGroups(); i++) {
		BParameterGroup *group = web->GroupAt(i);
		if (group == NULL)
			continue;

		BView *groupView = MakeViewFor(*group, hintRect ? &rect : NULL);
		if (groupView == NULL)
			continue;

		if (GroupView *view = dynamic_cast<GroupView *>(groupView)) {
			// the top-level group views must not be larger than their hintRect,
			// but unlike their children, they should follow all sides when
			// their parent is resized
			if (hintRect != NULL)
				view->ResizeTo(rect.Width() - 10, rect.Height() - 10);
			view->SetResizingMode(B_FOLLOW_ALL);
		}

		if (tabView == NULL) {
			// if we don't need a container to put that view into,
			// we're done here (but the groupView may span over the
			// whole hintRect)
			if (groupView->Frame().LeftTop() == BPoint(5, 5)) {
				// remove insets, as they are not needed
				groupView->MoveBy(-5, -5);
				groupView->ResizeBy(10, 10);
			}

			return new DynamicScrollView(groupView->Name(), groupView);
		}
		
		DynamicScrollView *scrollView = new DynamicScrollView(groupView->Name(), groupView);		
		tabView->AddTab(scrollView);
		
		if (!hintRect) {			
			bestRect = bestRect | scrollView->Bounds();			
		}	
	}
	
	if (tabView != NULL) {		
		// this adjustment must be kept in sync with TabView::FrameResized
		bestRect.bottom += tabView->TabHeight();
		bestRect.InsetBy(-3.0,-3.0);	
		
		tabView->ResizeTo(bestRect.Width(), bestRect.Height());
		tabView->FrameResized(bestRect.Width(), bestRect.Height());
			//needed since we're not attached to a window yet
	}

	return tabView;
}
开发者ID:mmanley,项目名称:Antares,代码行数:75,代码来源:DefaultMediaTheme.cpp


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