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


C++ BScrollView::ScrollBar方法代码示例

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


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

示例1: font

TEnclosuresView::TEnclosuresView(BRect rect, BRect wind_rect)
	: BView(rect, "m_enclosures", B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
	fFocus(false)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BFont font(be_plain_font);
	font.SetSize(font.Size() * kPlainFontSizeScale);
	SetFont(&font);

	fOffset = 12;

	BRect r;
	r.left = ENCLOSE_TEXT_H + font.StringWidth(
		TR("Attachments: ")) + 5;
	r.top = ENCLOSE_FIELD_V;
	r.right = wind_rect.right - wind_rect.left - B_V_SCROLL_BAR_WIDTH - 9;
	r.bottom = Frame().Height() - 8;
	fList = new TListView(r, this);
	fList->SetInvocationMessage(new BMessage(LIST_INVOKED));

	BScrollView	*scroll = new BScrollView("", fList, B_FOLLOW_LEFT_RIGHT | 
			B_FOLLOW_TOP, 0, false, true);
	AddChild(scroll);
	scroll->ScrollBar(B_VERTICAL)->SetRange(0, 0);
}
开发者ID:mmanley,项目名称:Antares,代码行数:26,代码来源:Enclosures.cpp

示例2: Bounds

void 
TSignatureView::AttachedToWindow()
{
	BRect	rect = Bounds();
	float	name_text_length = StringWidth(kNameText);
	float	sig_text_length = StringWidth(kSigText);
	float	divide_length;

	if (name_text_length > sig_text_length)
		divide_length = name_text_length;
	else
		divide_length = sig_text_length;

	rect.InsetBy(8,0);
	rect.top+= 8;
	
	fName = new TNameControl(rect, kNameText, new BMessage(NAME_FIELD));
	AddChild(fName);

	fName->SetDivider(divide_length + 10);
	fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);

	rect.OffsetBy(0,fName->Bounds().Height()+5);
	rect.bottom = rect.top + kSigHeight;
	rect.left = fName->TextView()->Frame().left;

	BRect text = rect;
	text.OffsetTo(10,0);
	fTextView = new TSigTextView(rect, text);
	BScrollView *scroller = new BScrollView("SigScroller", fTextView, B_FOLLOW_ALL, 0, false, true);
	AddChild(scroller);
	scroller->ResizeBy(-1 * scroller->ScrollBar(B_VERTICAL)->Frame().Width() - 9, 0);
	scroller->MoveBy(7,0);

	/* back up a bit to make room for the label */

	rect = scroller->Frame();
	BStringView *stringView = new BStringView(rect, "SigLabel", kSigText);
	AddChild(stringView);

	float tWidth, tHeight;
	stringView->GetPreferredSize(&tWidth, &tHeight);

	/* the 5 is for the spacer in the TextView */

	rect.OffsetBy(-1 *(tWidth) - 5, 0);
	rect.right = rect.left + tWidth;
	rect.bottom = rect.top + tHeight;

	stringView->MoveTo(rect.LeftTop());
	stringView->ResizeTo(rect.Width(), rect.Height());

	/* Resize the View to the correct height */
	scroller->SetResizingMode(B_FOLLOW_NONE);
	ResizeTo(Frame().Width(), scroller->Frame().bottom + 8);
	scroller->SetResizingMode(B_FOLLOW_ALL);
}
开发者ID:HaikuArchives,项目名称:BeMailDaemon,代码行数:57,代码来源:Signature.cpp

示例3: BRect

BView *
Create_TEdit(BRect rct,int type)
{
	BView 		*bt;
	BScrollView	*sc;
	MyContainLv *bt1;
	bool	a = false,b = false;
	
	switch(type)
	{
		case	1:	a = false; b =true;		break;
		case	2:	a = true; b = false;	break;
		case	3:  a = b = true;			break; 
	}
	
	BRect kt = BRect(4,4,rct.IntegerWidth() - 4 - ((b) ? 14 : 0),rct.IntegerHeight() - 4 - ((a) ? 14 : 0));

	if	(bt = new BTextView(kt,"",BRect(5,5,kt.Width()-5,kt.Height()-5),B_FOLLOW_NONE,B_WILL_DRAW))
	{
		if (sc = new BScrollView("",bt,B_FOLLOW_ALL,0,a,b))
		{
			if	(a)
			{
				BScrollBar *xi;
				
				if (xi = sc->ScrollBar(B_HORIZONTAL))
				{
					xi->SetRange(0,0);
				}
			}

			if (bt1 = new MyContainLv(rct))
			{
				bt1->AddChild(sc);

				return(bt1);
			}
		}	
	}
	
	return(NULL);
}
开发者ID:HaikuArchives,项目名称:BeInterfaceCreator,代码行数:42,代码来源:gadget_tedit.cpp

示例4: BMessage


//.........这里部分代码省略.........
	fRemoveTypeButton = new BButton("remove type", B_TRANSLATE("Remove"),
		new BMessage(kMsgRemoveType));

	fTypeIconView = new IconView("type icon");
	BView* iconHolder = BGroupLayoutBuilder(B_HORIZONTAL).Add(fTypeIconView);
	fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));

	typeBox->AddChild(BGridLayoutBuilder(padding, padding)
		.Add(scrollView, 0, 0, 1, 4)
		.Add(fAddTypeButton, 1, 0, 1, 2)
		.Add(fRemoveTypeButton, 1, 2, 1, 2)
		.Add(iconHolder, 2, 1, 1, 2)
		.SetInsets(padding, padding, padding, padding)
		.SetColumnWeight(0, 3)
		.SetColumnWeight(1, 2)
		.SetColumnWeight(2, 1));
	iconHolder->SetExplicitAlignment(
		BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));

	// "Version Info" group

	BBox* versionBox = new BBox("versionBox");
	versionBox->SetLabel(B_TRANSLATE("Version info"));

	fMajorVersionControl = new BTextControl(B_TRANSLATE("Version:"),
		NULL, NULL);
	_MakeNumberTextControl(fMajorVersionControl);

	fMiddleVersionControl = new BTextControl(".", NULL, NULL);
	_MakeNumberTextControl(fMiddleVersionControl);

	fMinorVersionControl = new BTextControl(".", NULL, NULL);
	_MakeNumberTextControl(fMinorVersionControl);

	fVarietyMenu = new BPopUpMenu("variety", true, true);
	fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Development"), NULL));
	fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Alpha"), NULL));
	fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Beta"), NULL));
	fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Gamma"), NULL));
	item = new BMenuItem(B_TRANSLATE("Golden master"), NULL);
	fVarietyMenu->AddItem(item);
	item->SetMarked(true);
	fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"), NULL));

	BMenuField* varietyField = new BMenuField("", fVarietyMenu);
	fInternalVersionControl = new BTextControl("/", NULL, NULL);
	fShortDescriptionControl =
		new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL);

	// TODO: workaround for a GCC 4.1.0 bug? Or is that really what the standard says?
	version_info versionInfo;
	fShortDescriptionControl->TextView()->SetMaxBytes(
		sizeof(versionInfo.short_info));

	BStringView* longLabel = new BStringView(NULL,
		B_TRANSLATE("Long description:"));
	longLabel->SetExplicitAlignment(labelAlignment);
	fLongDescriptionView = new TabFilteringTextView("long desc");
	fLongDescriptionView->SetMaxBytes(sizeof(versionInfo.long_info));

	scrollView = new BScrollView("desc scrollview", fLongDescriptionView,
		B_FRAME_EVENTS | B_WILL_DRAW, false, true);

	// TODO: remove workaround (bug #5678)
	BSize minScrollSize = scrollView->ScrollBar(B_VERTICAL)->MinSize();
	minScrollSize.width += fLongDescriptionView->MinSize().width;
	scrollView->SetExplicitMinSize(minScrollSize);

	versionBox->AddChild(BGridLayoutBuilder(padding / 2, padding)
		.Add(fMajorVersionControl->CreateLabelLayoutItem(), 0, 0)
		.Add(fMajorVersionControl->CreateTextViewLayoutItem(), 1, 0)
		.Add(fMiddleVersionControl, 2, 0, 2)
		.Add(fMinorVersionControl, 4, 0, 2)
		.Add(varietyField, 6, 0, 3)
		.Add(fInternalVersionControl, 9, 0, 2)
		.Add(fShortDescriptionControl->CreateLabelLayoutItem(), 0, 1)
		.Add(fShortDescriptionControl->CreateTextViewLayoutItem(), 1, 1, 10)
		.Add(longLabel, 0, 2)
		.Add(scrollView, 1, 2, 10, 3)
		.SetInsets(padding, padding, padding, padding)
		.SetRowWeight(3, 3));

	// put it all together
	SetLayout(new BGroupLayout(B_VERTICAL));
	AddChild(menuBar);
	AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
		.Add(fSignatureControl)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
			.Add(flagsBox, 3)
			.Add(iconBox, 1))
		.Add(typeBox)
		.Add(versionBox)
		.SetInsets(padding, padding, padding, padding));

	SetKeyMenuBar(menuBar);

	fSignatureControl->MakeFocus(true);
	BMimeType::StartWatching(this);
	_SetTo(entry);
}
开发者ID:mariuz,项目名称:haiku,代码行数:101,代码来源:ApplicationTypeWindow.cpp

示例5: Bounds

void
PBox::AttachedToWindow(){
	
	//calc font height (for nice control size)	
	font_height fontHeight;
	be_bold_font->GetHeight(&fontHeight);
	fFontHeight = fontHeight.descent + fontHeight.leading + fontHeight.ascent;


	BRect frame = Bounds();
	frame.InsetBy(5,5);
	
	BRect temp = frame;
	temp.bottom = temp.top + 40;	
	
	SettingsTextView *testo1=new SettingsTextView(temp,"testo",_T("Settings"));
	AddChild(testo1);
	frame.top +=40;
	//BSeparator *sep=new BSeparator(frame,"sep","cippa");
	//sep->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	//AddChild(sep);

	//frame.InsetBy(kEdgeOffset, kEdgeOffset);
	//frame.top += fFontHeight; //some space

#if SCROLLBAR
	frame.right -= B_V_SCROLL_BAR_WIDTH + 2;
#endif
	
			BView *view = new BView(frame, "", B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
						
#if B_BEOS_VERSION > B_BEOS_VERSION_5
			view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
			view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
			view->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
#else
			view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
			view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
			view->SetHighColor(0, 0, 0, 0);
#endif

	
			float settings_height = BuildGUI(fTemplate, fData, view);
					

			view->ResizeTo( view->Bounds().Width(), settings_height);
#if	SCROLLBAR			


			BScrollView * scroller = new BScrollView(
				"scroller", view, B_FOLLOW_ALL,
				0, false, true
			);
			float scroll_height = scroller->Bounds().Height();
			float diff = settings_height - scroll_height;
			if ( diff < 0 ) diff = 0;
			
			scroller->ScrollBar(B_VERTICAL)->SetRange(0, diff);

			view = scroller;
#endif
			fPrefView = view;

			AddChild(fPrefView);
			
			testo1->SetText(fTemplate.FindString("name"));
}
开发者ID:Haikeek,项目名称:BePodder,代码行数:67,代码来源:PBox.cpp

示例6: shellParameters

void
TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
{
	int argc = 0;
	const char* const* argv = NULL;
	if (args != NULL)
		args->GetShellArguments(argc, argv);
	ShellParameters shellParameters(argc, argv, currentDirectory);

	try {
		TermView* view = new TermView(
			PrefHandler::Default()->getInt32(PREF_ROWS),
			PrefHandler::Default()->getInt32(PREF_COLS),
			shellParameters,
			PrefHandler::Default()->getInt32(PREF_HISTORY_SIZE));
		view->SetListener(this);

		TermViewContainerView* containerView = new TermViewContainerView(view);
		BScrollView* scrollView = new TermScrollView("scrollView",
			containerView, view, fSessions.IsEmpty());
		if (!fFullScreen)
			scrollView->ScrollBar(B_VERTICAL)
				->ResizeBy(0, -(B_H_SCROLL_BAR_HEIGHT - 1));

		if (fSessions.IsEmpty())
			fTabView->SetScrollView(scrollView);

		Session* session = new Session(_NewSessionID(), _NewSessionIndex(),
			containerView);
		fSessions.AddItem(session);

		BFont font;
		_GetPreferredFont(font);
		view->SetTermFont(&font);

		int width, height;
		view->GetFontSize(&width, &height);

		float minimumHeight = -1;
		if (fMenuBar != NULL)
			minimumHeight += fMenuBar->Bounds().Height() + 1;

		if (fTabView != NULL && fTabView->CountTabs() > 0)
			minimumHeight += fTabView->TabHeight() + 1;

		SetSizeLimits(MIN_COLS * width - 1, MAX_COLS * width - 1,
			minimumHeight + MIN_ROWS * height - 1,
			minimumHeight + MAX_ROWS * height - 1);
			// TODO: The size limit computation is apparently broken, since
			// the terminal can be resized smaller than MIN_ROWS/MIN_COLS!

		// If it's the first time we're called, setup the window
		if (fTabView != NULL && fTabView->CountTabs() == 0) {
			float viewWidth, viewHeight;
			containerView->GetPreferredSize(&viewWidth, &viewHeight);

			// Resize Window
			ResizeTo(viewWidth + B_V_SCROLL_BAR_WIDTH,
				viewHeight + fMenuBar->Bounds().Height() + 1);
				// NOTE: Width is one pixel too small, since the scroll view
				// is one pixel wider than its parent.
		}

		BTab* tab = new BTab;
		fTabView->AddTab(scrollView, tab);
		view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL));
		view->SetMouseClipboard(gMouseClipboard);

		const BCharacterSet* charset
			= BCharacterSetRoster::FindCharacterSetByName(
				PrefHandler::Default()->getString(PREF_TEXT_ENCODING));
		if (charset != NULL)
			view->SetEncoding(charset->GetConversionID());

		_SetTermColors(containerView);

		int32 tabIndex = fTabView->CountTabs() - 1;
		fTabView->Select(tabIndex);

		_UpdateSessionTitle(tabIndex);
	} catch (...) {
		// most probably out of memory. That's bad.
		// TODO: Should cleanup, I guess

		// Quit the application if we don't have a shell already
		if (fTabView->CountTabs() == 0) {
			fprintf(stderr, "Terminal couldn't open a shell\n");
			PostMessage(B_QUIT_REQUESTED);
		}
	}
}
开发者ID:DonCN,项目名称:haiku,代码行数:91,代码来源:TermWindow.cpp

示例7: r

int32
LibraryWindow::ScanThread(void *data)
{
	LibraryWindow *win = (LibraryWindow *)data;

	float maxwidth;
	BRect r(5,5,105,20);
	
	BView *systemheader = win->AddHeader(r.LeftTop(),TR("System Libraries:"));
	
	win->Lock();
	r = systemheader->Frame();
	win->Unlock();
	maxwidth = r.right;
	
	r.OffsetBy(0,r.Height() + 10);
	
	DPath sysPath = GetSystemPath(B_USER_DEVELOP_DIRECTORY);
	sysPath << "lib/x86";
	BRect out = win->ScanFolder(r.LeftTop(),sysPath.GetFullPath(),&maxwidth);
	if (out != BRect(0,0,-1,-1))
	{
		r = out;
		r.OffsetBy(0,10);
	}
	
	if (gPlatform == PLATFORM_HAIKU || gPlatform == PLATFORM_HAIKU_GCC4)
	{
		BView *commonheader = win->AddHeader(r.LeftTop(),TR("Common Libraries:"));
		win->Lock();
		r = commonheader->Frame();
		win->Unlock();
		maxwidth = MAX(r.right,maxwidth);
		
		r.OffsetBy(0,r.Height() + 10);
		
		out = win->ScanFolder(r.LeftTop(),GetSystemPath(B_USER_LIB_DIRECTORY).GetFullPath(),
							&maxwidth);
		if (out != BRect(0,0,-1,-1))
		{
			r = out;
			r.OffsetBy(0,10);
		}
	}
	
	BView *userheader = win->AddHeader(r.LeftTop(),TR("User Libraries:"));
	win->Lock();
	r = userheader->Frame();
	win->Unlock();
	maxwidth = MAX(r.right,maxwidth);
	
	r.OffsetBy(0,r.Height() + 10);
	
	out = win->ScanFolder(r.LeftTop(),GetSystemPath(B_USER_LIB_DIRECTORY).GetFullPath(),
						&maxwidth);
	if (out.IsValid())
	{
		r = out;
		r.OffsetBy(0,10);
	}
	
	win->Lock();
	BView *top = win->GetBackgroundView();
	BScrollView *scrollView = (BScrollView*)top->FindView("scrollView");
	
	BScrollBar *vbar = scrollView->ScrollBar(B_VERTICAL);
	vbar->SetRange(0, r.bottom - scrollView->Bounds().Height());
	vbar->SetSteps(r.Height() * 2.0,r.Height() * 8.0);
	gSettings.Lock();
	BRect savedframe;
	if (gSettings.FindRect("libwin_frame",&savedframe) == B_OK)
		win->ResizeTo(savedframe.Width(),savedframe.Height());
	gSettings.Unlock();
	
	BStringView *label = (BStringView*)top->FindView("label");
	label->SetText(TR("Choose the system libraries for your project."));
	float minw = label->Frame().right + 10;
	win->SetSizeLimits(minw,30000,200,30000);
	if (win->Bounds().Width() < minw)
		win->ResizeTo(minw,win->Bounds().Height());
	win->fScanThread = -1;
	win->Unlock();
	
	return 0;
}
开发者ID:passick,项目名称:Paladin,代码行数:85,代码来源:LibWindow.cpp

示例8: BMessage

ErrorWindow::ErrorWindow(BRect frame, ProjectWindow* parent, ErrorList* list)
	:
	BWindow(frame, B_TRANSLATE("Errors and warnings"), B_DOCUMENT_WINDOW,
		B_ASYNCHRONOUS_CONTROLS),
	fParent(parent),
	fErrorCount(0),
	fWarningCount(0)
{
	SetSizeLimits(400, 30000, 250, 30000);
	MoveTo(100,100);
	AddShortcut('M', B_COMMAND_KEY, new BMessage(M_MAKE_PROJECT));
	AddShortcut('R', B_COMMAND_KEY, new BMessage(M_RUN_PROJECT));
	AddShortcut('R', B_COMMAND_KEY | B_SHIFT_KEY,
		new BMessage(M_RUN_IN_TERMINAL));
	AddShortcut('R', B_COMMAND_KEY | B_CONTROL_KEY,
		new BMessage(M_RUN_IN_DEBUGGER));
	AddShortcut('R', B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY,
		new BMessage(M_RUN_WITH_ARGS));
	AddShortcut('-', B_COMMAND_KEY, new BMessage(M_FORCE_REBUILD));
	AddShortcut('I', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	if (list != NULL)
		fErrors = *list;

	if (parent != NULL) {
		BString text = B_TRANSLATE("Errors and warnings: ");
		text << fParent->GetProject()->GetName();
		SetTitle(text.String());
	} else
		debugger("BUG: Invalid project for error window");

	BString startingLabel(B_TRANSLATE("Errors"));
	startingLabel << " (10000)";

	fErrorBox = new BCheckBox("errorbox", startingLabel.String(),
		new BMessage(M_TOGGLE_ERRORS));
	fErrorBox->SetLabel(B_TRANSLATE("Errors"));
	fErrorBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	startingLabel = B_TRANSLATE("Warnings");
	startingLabel << " (10000)";

	fWarningBox = new BCheckBox("warningbox", startingLabel.String(),
		new BMessage(M_TOGGLE_WARNINGS));
	fWarningBox->SetLabel("Warnings");
	fWarningBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	fCopyButton = new BButton("copy", B_TRANSLATE("Copy to clipboard"),
		new BMessage(M_COPY_ERRORS));

	fErrorList = new DListView("errorlist", B_SINGLE_SELECTION_LIST,
		B_WILL_DRAW | B_NAVIGABLE);
	BScrollView* errorScrollView = fErrorList->MakeScrollView("scroller", true, true);
	errorScrollView->ScrollBar(B_HORIZONTAL)->SetSteps(25, 75);

	BPopUpMenu* contextMenu = new BPopUpMenu("context_menu", false, false);
	contextMenu->AddItem(new BMenuItem(B_TRANSLATE("Copy list to clipboard"),
		new BMessage(M_COPY_ERRORS)));
	contextMenu->SetTargetForItems(this);
	fErrorList->SetContextMenu(contextMenu);

	BView* header = BLayoutBuilder::Group<>(B_HORIZONTAL)
		.Add(fErrorBox)
		.Add(fWarningBox)
		.Add(fCopyButton)
		.AddGlue()
		.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, 0)
		.View();
	header->SetName("header");
	header->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.Add(header)
		.Add(errorScrollView)
		.SetInsets(-1.0f)
		.End();

	if (list != NULL)
		RefreshList();

	BRect newframe;
	BNode node(fParent->GetProject()->GetPath().GetFullPath());
	if (node.ReadAttr("error_frame", B_RECT_TYPE, 0, &newframe, sizeof(newframe))) {
		if (newframe.left < 100)
			newframe.left = 100;
		if (newframe.top < 100)
			newframe.top = 100;
		MoveTo(newframe.left, newframe.top);
		ResizeTo(newframe.Width(), newframe.Height());
	}

	fErrorBox->SetValue(B_CONTROL_ON);
	fWarningBox->SetValue(B_CONTROL_ON);

	fErrorList->SetInvocationMessage(new BMessage(M_JUMP_TO_MSG));
	fErrorList->MakeFocus(true);
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:100,代码来源:ErrorWindow.cpp

示例9: msgr


//.........这里部分代码省略.........
	
	r = label->Frame();
	r.OffsetBy(0,r.Height() + 5.0);
	
	// We create a button now so that the list expands to fill the entire window
	// while leaving space for the two buttons at the bottom. Note that we do not
	// actually add the button to the window until later to preserve proper
	// keyboard navigation order
	BButton *add = new BButton(BRect(0,0,1,1),"addbutton",TR("Add…"),
								new BMessage(M_SHOW_ADD_PATH),
								B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	add->ResizeToPreferred();
	add->MoveTo(5,fGeneralView->Bounds().bottom - 10.0 - add->Frame().Height());
	
	r.right = bounds.right - 10.0 - B_V_SCROLL_BAR_WIDTH;
	r.bottom = add->Frame().top - 10.0 - B_H_SCROLL_BAR_HEIGHT;
	fIncludeList = new IncludeList(r,fProject->GetPath().GetFolder());
	BScrollView *scrollView = new BScrollView("scrollview",fIncludeList,
											B_FOLLOW_ALL,0, true, true);
	scrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fGeneralView->AddChild(scrollView);
	
	float width = 0.0;
	for (int32 i = 0; i < fProject->CountLocalIncludes(); i++)
	{
		BStringItem *item = new BStringItem(fProject->LocalIncludeAt(i).Relative().String());
		float strwidth = fIncludeList->StringWidth(item->Text());
		width = MAX(width, strwidth);
		fIncludeList->AddItem(item);
	}
	
	if (width > fIncludeList->Bounds().Width())
	{
		BScrollBar *hbar = scrollView->ScrollBar(B_HORIZONTAL);
		hbar->SetRange(0.0, width - fIncludeList->Bounds().Width());
	}
	
	SetToolTip(fIncludeList,TR("The folders you want Paladin to search for header files"));
	
	fGeneralView->AddChild(add);
	
	BButton *remove = new BButton(BRect(0,0,1,1),"removebutton",TR("Remove"),
								new BMessage(M_REMOVE_PATH), 
								B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	remove->ResizeToPreferred();
	remove->MoveTo(add->Frame().right + 10.0, add->Frame().top);
	fGeneralView->AddChild(remove);
	
	r = bounds;
	fBuildView = new BView(bounds.OffsetByCopy(5,5),TR("Build"),B_FOLLOW_ALL,B_WILL_DRAW);
	fBuildView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTabView->AddTab(fBuildView);
	
	menu = new BMenu(TR("Optimization"));
	menu->AddItem(new BMenuItem(TR("None"),new BMessage(M_SET_OP_VALUE)));
	menu->AddItem(new BMenuItem(TR("Some"),new BMessage(M_SET_OP_VALUE)));
	menu->AddItem(new BMenuItem(TR("More"),new BMessage(M_SET_OP_VALUE)));
	menu->AddItem(new BMenuItem(TR("Full"),new BMessage(M_SET_OP_VALUE)));
	
	r.right = (bounds.right - 5.0) / 2.0;
	r.bottom = r.top + 25;
	fOpField = new BMenuField(r,"optimize",TR("Optimize"),menu);
	fBuildView->AddChild(fOpField);
	fOpField->SetDivider(fOpField->StringWidth(TR("Optimize")) + 5.0);
	
	SetToolTip(fOpField,TR("Compiler optimization level. Disabled when debugging info is checked."));
开发者ID:passick,项目名称:Paladin,代码行数:67,代码来源:ProjectSettingsWindow.cpp


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