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


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

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


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

示例1: BOutlineListView

/*******************************************************
*   Setup the main view. Add in all the niffty components
*   we have made and get things rolling
*******************************************************/
PrefKeys::PrefKeys():BView("Prefs keys",0){
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// add the prefs list at the left
	list = new BOutlineListView("key list");
	BScrollView *sv = new BScrollView("scroll", list, B_WILL_DRAW, false, true, B_PLAIN_BORDER);
	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	sv->MakeFocus(false);

	BListItem *item = NULL;
	for (int32 i=0; i<KeyBind.CountBindings(); i++){
		if (KeyBind.GetMessage(KeyBind.GetID(i)) == SPLITTER){
			if (item)	list->Collapse(item);
			list->AddItem(item = new KeyItem(Language.get(KeyBind.GetID(i)), 0, 0, 0, 0, -1));
		}else{
			list->AddUnder(new KeyItem(Language.get(KeyBind.GetID(i)), KeyBind.GetKey(KeyBind.GetID(i)), KeyBind.GetMod(KeyBind.GetID(i)), KeyBind.GetKeyAlt(KeyBind.GetID(i)), KeyBind.GetModAlt(KeyBind.GetID(i)), i), item);
		}
	}
	if (item)	list->Collapse(item);
	m_index = -1;
	BLayoutBuilder::Group<>(this)
		.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
			.SetInsets(B_USE_WINDOW_SPACING)
			.Add(sv);
}
开发者ID:HaikuArchives,项目名称:BeAE,代码行数:29,代码来源:PrefKeys.cpp

示例2: BOutlineListView

/*******************************************************
*   Setup the main view. Add in all the niffty components
*   we have made and get things rolling
*******************************************************/
KeymapView::KeymapView()
	:
	BView(BRect(0,0,300,100), "Prefs keys", B_FOLLOW_ALL, B_WILL_DRAW)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// add the prefs list at the left
	list = new BOutlineListView("key list");

	BScrollView *sv = new BScrollView("scroll", list,
		B_FOLLOW_ALL_SIDES, false, true, B_PLAIN_BORDER);

	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	sv->MakeFocus(false);

	BObjectList<BListItem> items(false);

	for (int32 i=0; i<gKeyBind->CountKeys(); i++) {
		uint32 code = gKeyBind->GetCode(i);
		if (code == FABER_SPLITTER)
			continue;

		BListItem* item = items.ItemAt(items.CountItems()-1);

		if (code == FABER_ITEM_END || code == FABER_EOF) {
			//if (item != NULL) {
				list->Collapse(item);
				items.RemoveItemAt(items.CountItems()-1);
			//}

			continue;
		}

		if (code == FABER_ITEM_START) {

			BListItem* newItem = new KeyItem(gKeyBind->GetLabel(i), 0, 0, 0, 0, -1);
			if (items.CountItems() > 0) {
				list->AddUnder(newItem, item);
			} else {	
				list->AddItem(newItem);
			}
			items.AddItem(newItem);

		} else if (item != NULL) {
			list->AddUnder(new KeyItem(gKeyBind->GetLabel(i),
				gKeyBind->GetKey(code),
				gKeyBind->GetMod(code), gKeyBind->GetKeyAlt(code),
				gKeyBind->GetModAlt(code), i), item);
		}
	}

	m_index = -1;

	BLayoutBuilder::Group<>(this, B_VERTICAL, 1)
		.Add(sv, 0)
	.End();
}
开发者ID:ysei,项目名称:Faber,代码行数:61,代码来源:Keymap.cpp

示例3: BOutlineListView

//   Setup the main view. Add in all the niffty components
//   we have made and get things rolling
KeymapView::KeymapView()
	:
	BView(BRect(0,0,300,100), "Prefs keys", B_FOLLOW_ALL, B_WILL_DRAW)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// add the prefs list at the left
	fListView = new BOutlineListView("key list");

	BScrollView* scrollView = new BScrollView("scroll", fListView,
		B_FOLLOW_ALL_SIDES, false, true, B_PLAIN_BORDER);

	scrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	scrollView->MakeFocus(false);

	BObjectList<BListItem> items(false);

	for (int32 i=0; i < FaberShortcut::CountKeys(); i++) {
		KeyBind* bind = FaberShortcut::KeyBindAt(i);
		if (bind->itemType == FABER_SPLITTER)
			continue;

		BListItem* item = items.ItemAt(items.CountItems()-1);

		if (item != NULL && (bind->itemType == FABER_ITEM_END
			|| bind->itemType == FABER_EOF)) {
				fListView->Collapse(item);
				items.RemoveItemAt(items.CountItems()-1);
			continue;
		} 
		
		if (bind->itemType == FABER_ITEM_START) {
			BListItem* newItem = new KeyItem(bind->label, 0, 0, -1);

			if (items.CountItems() > 0)
				fListView->AddUnder(newItem, item);
			else	
				fListView->AddItem(newItem);

			items.AddItem(newItem);
		} else if (item != NULL) {
			fListView->AddUnder(new KeyItem(bind->label,
				bind->key,
				bind->mod, i), item);
		}
	}

	fIndex = -1;

	BLayoutBuilder::Group<>(this, B_VERTICAL, 1)
		.Add(scrollView, 0)
	.End();
}
开发者ID:Barrett17,项目名称:Faber,代码行数:55,代码来源:Keymap.cpp

示例4: BScrollView

BScrollView *
DTextView::MakeScrollView(const char *name, bool horizontal, bool vertical)
{
	if (Parent())
		RemoveSelf();
	
	BScrollView *sv = new BScrollView(name, this, ResizingMode(), 0,
										horizontal, vertical);
	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	
	return sv;
}
开发者ID:jscipione,项目名称:Paladin,代码行数:12,代码来源:DTextView.cpp

示例5: r

FreqWindow::FreqWindow(BPoint p) : BWindow(BRect(p.x,p.y,p.x,p.y),Language.get("FREQ_WINDOW"),B_FLOATING_WINDOW_LOOK,B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
	BRect r(0,0,180,180);
	ResizeTo(r.Width(), r.Height());
	MoveBy(-r.Width()/2, -r.Height()/2);

	view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	r.InsetBy(8,8);
	r.right = 70;

	r.top += 28;		// space for the textbox
	list = new BListView(r,"Freq list");
	BScrollView *sv = new BScrollView("scroll", list, B_FOLLOW_ALL_SIDES, B_WILL_DRAW, false, true, B_PLAIN_BORDER);
	sv->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	sv->MakeFocus(false);
	view->AddChild(sv);
	
	r.Set(4,8,85,28);
	text = new SpinControl(r, NULL, NULL, new BMessage(SET_TEXT), 4000, 96000, 44100, 500);
	view->AddChild(text);

	r = Bounds();
	r.left = r.right - 85;
	r.top = r.bottom - 32;
	r.bottom -=8;
	r.right -= 8;
	view->AddChild(new BButton(r, NULL, Language.get("OK"), new BMessage(SET)) );
	r.OffsetBy(0,-30);
	view->AddChild(new BButton(r, NULL, Language.get("CANCEL"), new BMessage(QUIT)) );

	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BStringItem *it;
	list->AddItem(it = new BStringItem("96000"));
	list->AddItem(it = new BStringItem("64000"));
	list->AddItem(it = new BStringItem("48000"));
	list->AddItem(it = new BStringItem("44100"));
	list->AddItem(it = new BStringItem("32000"));
	list->AddItem(it = new BStringItem("22050"));
	list->AddItem(it = new BStringItem("16000"));
	list->AddItem(it = new BStringItem("12500"));
	list->AddItem(it = new BStringItem("11025"));
	list->AddItem(it = new BStringItem("8000"));
	list->SetSelectionMessage(new BMessage(SELECT));
	list->SetInvocationMessage(new BMessage(SELECT));
	SetList();

	m_old = Pool.frequency;
	Run();
	Show();
}
开发者ID:spiraleyes,项目名称:BeAE,代码行数:52,代码来源:FreqWindow.cpp

示例6: btnAddRect

/*
 * BLSettingsBlockedView(BRect canvas);
 *
 */
BLSettingsBlockedView::BLSettingsBlockedView(BRect canvas, BLSettings* bls)
: BView(canvas, "blockedview", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), Settings(bls), FilePanel(NULL)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	float Padding = 5.0;
	float ButtonHeight = 25.0;
	
	/* Calculate list view position */
	BRect rectLVPos = BRect(canvas.left + Padding, canvas.top + Padding, canvas.right - (Padding + B_V_SCROLL_BAR_WIDTH + 3), canvas.bottom - (Padding + 3 + B_H_SCROLL_BAR_HEIGHT + 35));

	/* Create and add listview and scrollview*/
	ListView = new BListView(rectLVPos, "Blocked");
	BScrollView* scrollview = new BScrollView("scroll_blocked", ListView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_NO_BORDER, true, true);
	scrollview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(scrollview);	

	/* Calculate the size and position of the Add button */
	BRect btnAddRect(Bounds().right - (Padding + 60), Bounds().bottom - (Padding + ButtonHeight + 3), scrollview->Bounds().right, Bounds().bottom - (Padding + 3));
		
	/* Create and add the Add button */
	btnAdd = new BButton(btnAddRect, "BeLoginSettings_AddButton", "Add", new BMessage(BL_ADD_ITEM));
	btnAdd->MakeDefault(true);
	btnAdd->SetTarget(this);
	AddChild(btnAdd);

	/* Calculate the size and position of the Add button */
	BRect TextControlRect(ListView->Bounds().left , Bounds().bottom - (Padding + ButtonHeight), Bounds().right - (Padding*2 + btnAdd->Bounds().Width()) , ListView->Bounds().bottom - Padding);

	/* Create and add the password Textcontrol */
	txtSignature = new BTextControl(TextControlRect, "BeLoginView_signature", "", "", NULL);
	txtSignature->SetDivider(0.0);
	AddChild(txtSignature);	


	/* Add blocked to list */
	BLBlocked* blocked = Settings->GetBlocked(); 
	for(int i=0;i<blocked->CountItems();i++)
		ListView->AddItem(new BStringItem((blocked->ItemAt(i))->String()));

	/* Set up messaging */
	ListView->SetInvocationMessage(new BMessage(BL_REMOVE_ITEM));

	ListView->SetTarget(this);
	txtSignature->SetText("application/");
}
开发者ID:HaikuArchives,项目名称:BeLogin,代码行数:50,代码来源:BLSettingsBlockedView.cpp

示例7: messenger

ProjectSettingsWindow::ProjectSettingsWindow(BRect frame, Project* project)
	:
	BWindow(frame, TR("Project settings"), B_TITLED_WINDOW,
		B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
	fProject(project),
	fDirty(false)
{
	if (fProject == NULL)
		debugger("Bad project given to Project Settings window");

	fRefFilter = new TypedRefFilter(NULL, B_DIRECTORY_NODE);

	BMessenger messenger(this);
	entry_ref projectFolderRef;
	BEntry(fProject->GetPath().GetFolder()).GetRef(&projectFolderRef);
	fFilePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &projectFolderRef,
		B_DIRECTORY_NODE, true, new BMessage(M_ADD_PATH), fRefFilter);

	fAutolock = new BAutolock(fProject);

	AddCommonFilter(new EscapeCancelFilter());

	fTargetText = new AutoTextControl("targetname", TR("Target name:"),
		fProject->GetTargetName(), new BMessage(M_TARGET_NAME_CHANGED));

	BPopUpMenu* targetTypeMenu = new BPopUpMenu(TR("Target type"));
	targetTypeMenu->AddItem(new BMenuItem(TR("Application"),
		new BMessage(M_SET_TARGET_TYPE)));
	targetTypeMenu->AddItem(new BMenuItem(TR("Shared library"),
		new BMessage(M_SET_TARGET_TYPE)));
	targetTypeMenu->AddItem(new BMenuItem(TR("Static library"),
		new BMessage(M_SET_TARGET_TYPE)));
	targetTypeMenu->AddItem(new BMenuItem(TR("Device driver"),
		new BMessage(M_SET_TARGET_TYPE)));

	fTypeField = new BMenuField("type", TR("Target type:"), targetTypeMenu);
	SetToolTip(fTypeField, TR("The kind of program you want to build"));

	BMenuItem* item = targetTypeMenu->ItemAt(fProject->TargetType());
	if (item != NULL)
		item->SetMarked(true);

	fIncludeList = new IncludeList(fProject->GetPath().GetFolder());
	SetToolTip(fIncludeList,
		TR("The folders you want Paladin to search for header files"));

	BScrollView* includeScrollView = new BScrollView("includescrollview",
		fIncludeList, B_WILL_DRAW, true, true);
	includeScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	includeScrollView->SetExplicitMinSize(
		BSize(be_plain_font->StringWidth("M") * 34.0f,
			be_plain_font->StringWidth("M") * 12.0f));

	for (int32 i = 0; i < fProject->CountLocalIncludes(); i++) {
		fIncludeList->AddItem(new BStringItem(
			fProject->LocalIncludeAt(i).Relative().String()));
	}

	float buttonWidth = be_plain_font->StringWidth("+") * 2.0f + 3.0f;

	BButton* addButton = new BButton("addbutton", TR("+"),
		new BMessage(M_SHOW_ADD_PATH));
	addButton->SetExplicitSize(BSize(buttonWidth, buttonWidth));
	addButton->SetToolTip(TR("Add a file to the include path list"));

	BButton* removeButton = new BButton("removebutton", TR("−"),
		new BMessage(M_REMOVE_PATH));
	removeButton->SetExplicitSize(BSize(buttonWidth, buttonWidth));
	removeButton->SetToolTip(TR("Remove the selected path"));

	// general tab

	fGeneralView = new BView(TR("General"), B_WILL_DRAW);
	fGeneralView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BLayoutBuilder::Group<>(fGeneralView, B_VERTICAL, 0)
		.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
			.Add(fTargetText->CreateLabelLayoutItem(), 0, 0)
			.Add(fTargetText->CreateTextViewLayoutItem(), 1, 0)

			.Add(fTypeField->CreateLabelLayoutItem(), 0, 1)
			.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING, 1, 1)
				.Add(fTypeField->CreateMenuBarLayoutItem())
				.AddGlue()
				.End()
			.End()
		.AddStrut(B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL, 2.0f)
			.Add(new BStringView("include paths", TR("Include paths:")))
			.AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
				.Add(includeScrollView)
				.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
					.Add(addButton)
					.Add(removeButton)
					.AddGlue()
					.End()
				.End()
			.End()
		.SetInsets(B_USE_DEFAULT_SPACING)
		.End();
//.........这里部分代码省略.........
开发者ID:ModeenF,项目名称:Paladin,代码行数:101,代码来源:ProjectSettingsWindow.cpp

示例8: msgr

ProjectSettingsWindow::ProjectSettingsWindow(BRect frame, Project *proj)
	:	DWindow(frame,TR("Project Settings"),B_TITLED_WINDOW,
				B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_H_RESIZABLE),
		fProject(proj),
		fDirty(false)
	
{
	if (!fProject)
		debugger("Bad project given to Project Settings window");
	
	fRefFilter = new TypedRefFilter(NULL,B_DIRECTORY_NODE);
	
	BMessenger msgr(this);
	entry_ref projfolder_ref;
	BEntry(fProject->GetPath().GetFolder()).GetRef(&projfolder_ref);
	fFilePanel = new BFilePanel(B_OPEN_PANEL,&msgr,&projfolder_ref,B_DIRECTORY_NODE,
								true, new BMessage(M_ADD_PATH),fRefFilter);
	
	fAutolock = new BAutolock(fProject);
	
	AddCommonFilter(new EscapeCancelFilter());
	
	BView *top = GetBackgroundView();
	
	BRect r(Bounds());
	fTabView = new BTabView(r,"tabview");
	top->AddChild(fTabView);
	
	r.InsetBy(5,5);
	r.bottom -= fTabView->TabHeight();
	
	BRect bounds = r.OffsetToCopy(0,0);
	
	fGeneralView = new BView(r,TR("General"),B_FOLLOW_ALL,B_WILL_DRAW);
	fGeneralView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTabView->AddTab(fGeneralView);
	
	r.right -= 10.0;
	fTargetText = new AutoTextControl(r,"targetname",TR("Target Name:"),
										fProject->GetTargetName(),
										new BMessage(M_TARGET_NAME_CHANGED),
										B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	fGeneralView->AddChild(fTargetText);
	
	float pwidth, pheight;
	fTargetText->GetPreferredSize(&pwidth, &pheight);
	fTargetText->ResizeTo(r.Width(),pheight);
	r.bottom = r.top + pheight;
	fTargetText->SetDivider(fTargetText->StringWidth(TR("Target Name:")) + 5.0);
	
	r = fTargetText->Frame();
	r.OffsetBy(0,r.Height() + 10.0);
	
	BMenu *menu = new BMenu(TR("Target Type"));
	menu->AddItem(new BMenuItem(TR("Application"),new BMessage(M_SET_TARGET_TYPE)));
	menu->AddItem(new BMenuItem(TR("Shared Library"),new BMessage(M_SET_TARGET_TYPE)));
	menu->AddItem(new BMenuItem(TR("Static Library"),new BMessage(M_SET_TARGET_TYPE)));
	menu->AddItem(new BMenuItem(TR("Device Driver"),new BMessage(M_SET_TARGET_TYPE)));
	
	r.right = (bounds.right - 5.0) / 2.0;
	r.bottom = r.top + 25;
	fTypeField = new BMenuField(r,"type",TR("Target Type:"),menu);
	fGeneralView->AddChild(fTypeField);
	fTypeField->SetDivider(fTypeField->StringWidth(TR("Target Type:")) + 5.0);
	
	SetToolTip(fTypeField,TR("The kind of program you want to build"));
	
	menu->SetTargetForItems(this);
	menu->SetLabelFromMarked(true);
	
	BMenuItem *item = menu->ItemAt(fProject->TargetType());
	if (item)
		item->SetMarked(true);
	
	r.OffsetBy(0,r.Height() + 10.0);
	
	BStringView *label = new BStringView(r,"label",TR("Include Paths:"));
	label->ResizeToPreferred();
	fGeneralView->AddChild(label);
	
	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);
//.........这里部分代码省略.........
开发者ID:passick,项目名称:Paladin,代码行数:101,代码来源:ProjectSettingsWindow.cpp


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