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


C++ BBox::Bounds方法代码示例

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


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

示例1: prefsRect

PrefsWindow::PrefsWindow(void)
  : BWindow (BRect (88.0, 108.0, 0.0, 0.0),
      S_PREFSWIN_TITLE,
      B_TITLED_WINDOW,
      B_ASYNCHRONOUS_CONTROLS)
{
  GeneralPrefsView *generalView = new GeneralPrefsView(BRect(0.0, 0.0, 0.0, 0.0),
     "view", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);

  ResizeTo(generalView->Bounds().Width(), generalView->Bounds().Height());

  BBox *box = new BBox (Bounds().InsetByCopy(-1,-1), "box", B_FOLLOW_ALL_SIDES);
  
  AddChild(box);

  box->AddChild(generalView);
  generalView->MoveTo ((box->Bounds().Width() - generalView->Bounds().Width()) / 2,
    (box->Bounds().Height() - generalView->Bounds().Height()) / 2);

  BRect prefsRect (vision_app->GetRect ("GenPrefWinRect"));
  if (prefsRect.Width() != 0.0 && prefsRect.Height() != 0.0)
  {
    ResizeTo (prefsRect.Width(), prefsRect.Height());
    MoveTo (prefsRect.left, prefsRect.top);
  }
}
开发者ID:xray7224,项目名称:Vision,代码行数:26,代码来源:PrefsWindow.cpp

示例2: OpenGroup

	void OpenGroup(const char* text)
	{
		if (text != NULL) {
			BBox* box = new BBox(GetControlBounds(), text);
			box->SetLabel(text);
			GetView()->AddChild(box);
			Push(box);
			box->ResizeTo(box->Bounds().Width(), kBoxHeight);
		}
	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:10,代码来源:PPDConfigView.cpp

示例3: ScreenSaverRunner

void
ModulesView::_OpenSaver()
{
	// create new screen saver preview & config

	BView* view = fPreviewView->AddPreview();
	fCurrentName = fSettings.ModuleName();
	fSaverRunner = new ScreenSaverRunner(view->Window(), view, fSettings);

#ifdef __HAIKU__
	BRect rect = fSettingsBox->InnerFrame().InsetByCopy(4, 4);
#else
	BRect rect = fSettingsBox->Bounds().InsetByCopy(4, 4);
	rect.top += 14;
#endif
	fSettingsView = new BView(rect, "SettingsView", B_FOLLOW_ALL, B_WILL_DRAW);

	fSettingsView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	fSettingsBox->AddChild(fSettingsView);

	BScreenSaver* saver = ScreenSaver();
	if (saver != NULL && fSettingsView != NULL) {
		saver->StartConfig(fSettingsView);
		if (saver->StartSaver(view, true) == B_OK) {
			fPreviewView->HideNoPreview();
			fSaverRunner->Run();
		} else
			fPreviewView->ShowNoPreview();
	} else {
		// Failed to load OR this is the "Blackness" screensaver. Show a black
		// preview (this is what will happen in both cases when screen_blanker
		// runs).
		fPreviewView->HideNoPreview();
	}

	if (fSettingsView->ChildAt(0) == NULL) {
		// There are no settings at all, we add the module name here to
		// let it look a bit better at least.
		BPrivate::BuildDefaultSettingsView(fSettingsView,
			fSettings.ModuleName()[0] ? fSettings.ModuleName()
				: B_TRANSLATE("Blackness"),
				saver != NULL || !fSettings.ModuleName()[0]
					? B_TRANSLATE("No options available")
					: B_TRANSLATE("Could not load screen saver"));
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:46,代码来源:ScreenSaverWindow.cpp

示例4: constructGeneralBox

BView* PrefsWindow::constructGeneralBox(BRect frame)
{
	BBox* generalBox = new BBox(frame);
	generalBox->SetLabel("General");
	
	float 	offset = 30.0f,
			bwidth = 80.0f,
			bheight = 30.0f,
			bspacing = 10.0f,
			cbheight = 14.0f,
			adjust = 5.0f
			;
			
	float controlX = (offset * 2.0f / 3.0f);
	BRect bubbleFrame = BRect(controlX, offset - adjust, offset + 150.0f, offset + cbheight - adjust);	
	
	ColourButton *bubbleColourButton = new ColourButton(bubbleFrame, GetPrefsMessage(K_BUBBLE_COLOUR), ColourConstants::K_BLACK, "Tooltips");
	generalBox->AddChild(bubbleColourButton);
		
	BRect recentDocsPathFrame(controlX, 50.0f, controlX + 150.0f, 70.0f);
	BCheckBox *showRecentDocsPath = new BCheckBox(recentDocsPathFrame, K_IS_RECENT_DOCS_SHOWN, "Show Path in Recent Docs", GetPrefsMessage(K_IS_RECENT_DOCS_SHOWN));
	generalBox->AddChild(showRecentDocsPath);
	
	BRect isActivationFrame(controlX, 80.0f, controlX + 190.0f, 100.0f);
	BCheckBox *isActivationOk = new BCheckBox(isActivationFrame, K_IS_ACTIVATION_OK, "Activate Window on Opening Docs", GetPrefsMessage(K_IS_ACTIVATION_OK));	
	generalBox->AddChild(isActivationOk);
	
	BRect recentDocsFrame(controlX, 110.0f, controlX + 150.0f, 120.0f);
	BTextControl *numRecentDocs = new BTextControl(recentDocsFrame, K_NUM_RECENT_DOCS, "Number of Recent Docs", "", GetPrefsMessage(K_NUM_RECENT_DOCS));
	numRecentDocs->SetDivider(120.0f);
	numRecentDocs->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
	generalBox->AddChild(numRecentDocs);
	
	BRect insertDateFrame(controlX, 140.0f, controlX + 200.0f, 150.0f);
	BTextControl *insertDateFlags = new BTextControl(insertDateFrame, K_DATE_FLAGS, "Insert Date Flags", "", GetPrefsMessage(K_DATE_FLAGS));
	generalBox->AddChild(insertDateFlags);	
	
	BRect generalRect = generalBox->Bounds();
	BRect generalbtnRect(generalRect.right - bspacing - bwidth, generalRect.bottom - bspacing - bheight, generalRect.right - bspacing, generalRect.bottom - bspacing);
	BButton *resetGeneralDefaults = new BButton(generalbtnRect,"fResetGeneralDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_GENERAL_DEFAULTS));
	generalBox->AddChild(resetGeneralDefaults);
	
	return generalBox;
}
开发者ID:HaikuArchives,项目名称:BeTeX,代码行数:44,代码来源:PrefsWindow.cpp

示例5: constructCommandBox


//.........这里部分代码省略.........
			globalTcOffset = 45.0f,		
			bitoffset = 45.0,
			secOffset = 170.0f
			;
				
	BRect textCtrlFrame(offset / 2.0f, offset, offset / 2.0f + 300.0f, offset + 20.0f);
	BStringView *textCtrlInfo = new BStringView(textCtrlFrame, "info", "The \'$\' represents the filename in filename.tex");
	commandBox->AddChild(textCtrlInfo);	
	
	BRect bitRect(offset / 2.0f, offset + globalTcOffset, offset / 2.0f + 31.0f, offset + 31.0f + globalTcOffset);
	BRect secCol(bitRect);	
	secCol.OffsetBy(secOffset, 0.0f);	
	secCol.OffsetBy(0.0f, bitoffset);	
	
	float	textCtrlWidth = 100.0f,
			textCtrlHeight = 20.0f,
			textCtrlCo = 6.0f
			;
			
	BRect bitctrlRect(offset / 2.0f + bitoffset, offset + textCtrlCo + globalTcOffset, offset / 2.0f + bitoffset + textCtrlWidth, textCtrlCo + offset + textCtrlHeight + globalTcOffset);		
	BRect secColCtrl(bitctrlRect);
	secColCtrl.OffsetBy(secOffset, 0.0f);
	secColCtrl.right += 50.0f;
	
	//tex to dvi
	BRect bitmapFrame(0.0f, 0.0f, 31.0f, 31.0f);	
	BBitmap	*texDviBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	texDviBitmap->SetBits(IconTexToDVI, 3072, 0, B_CMAP8);
	commandBox->AddChild(new BitmapView(bitRect, texDviBitmap));
	
	BTextControl *texDviCtrl = new BTextControl(bitctrlRect, K_LATEX_CMD, NULL, "", GetPrefsMessage(K_LATEX_CMD));
	commandBox->AddChild(texDviCtrl);
	bitctrlRect.OffsetBy(0.0f, bitoffset);
	
	//dvi to pdf
	bitRect.OffsetBy(0.0f, bitoffset);	
	BBitmap* dviPdfBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	dviPdfBitmap->SetBits(IconDVIToPDF, 3072, 0, B_CMAP8);
	commandBox->AddChild(new BitmapView(bitRect, dviPdfBitmap));
	
	BTextControl *dviPdfCtrl = new BTextControl(bitctrlRect, K_DVIPDF_CMD, NULL, "",  GetPrefsMessage(K_DVIPDF_CMD));
	commandBox->AddChild(dviPdfCtrl);
	bitctrlRect.OffsetBy(0.0f, bitoffset);
	
	//dvi to ps
	bitRect.OffsetBy(0.0f, bitoffset);	
	BBitmap* dviPsBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	dviPsBitmap->SetBits(IconDVIToPS, 3072, 0, B_CMAP8);
	commandBox->AddChild(new BitmapView(bitRect, dviPsBitmap));
	
	BTextControl *dviPsCtrl = new BTextControl(bitctrlRect, K_DVIPS_CMD, NULL, "",  GetPrefsMessage(K_DVIPS_CMD));
	commandBox->AddChild(dviPsCtrl);
	bitctrlRect.OffsetBy(0.0f, bitoffset);
	
	//ps to pdf
	bitRect.OffsetBy(0.0f, bitoffset);	
	BBitmap* psPdfBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	psPdfBitmap->SetBits(IconPSToPDF, 3072, 0, B_CMAP8);
	commandBox->AddChild(new BitmapView(bitRect, psPdfBitmap));
	
	BTextControl *psPdfCtrl = new BTextControl(bitctrlRect, K_PS2PDF_CMD, NULL, "",  GetPrefsMessage(K_PS2PDF_CMD));
	commandBox->AddChild(psPdfCtrl);
	bitctrlRect.OffsetBy(0.0f, bitoffset);
	
	//tex to pdf
	bitRect.OffsetBy(0.0f, bitoffset);			
	BBitmap* texPdfBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	texPdfBitmap->SetBits(IconTexToPDF,3072,0,B_CMAP8);
	commandBox->AddChild(new BitmapView(bitRect, texPdfBitmap));
	
	BTextControl *texPdfCtrl = new BTextControl(bitctrlRect, K_PDFLATEX_CMD, NULL, "",  GetPrefsMessage(K_PDFLATEX_CMD));
	commandBox->AddChild(texPdfCtrl);
	bitctrlRect.OffsetBy(0.0f, bitoffset);
	
	//tex to html
	bitRect.OffsetBy(0.0f, bitoffset);	
	BBitmap* texHtmlBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	texHtmlBitmap->SetBits(IconTexToHTML, 3072, 0, B_CMAP8);
	commandBox->AddChild(new BitmapView(bitRect, texHtmlBitmap));
	
	BTextControl *texHtmlCtrl = new BTextControl(bitctrlRect, K_LATEX2HTML_CMD, NULL, "",  GetPrefsMessage(K_LATEX2HTML_CMD));
	commandBox->AddChild(texHtmlCtrl);
	bitctrlRect.OffsetBy(0.0f, bitoffset);
	
	//ps
	bitRect.OffsetBy(0.0f, bitoffset);	
	BBitmap* postScriptBitmap = new BBitmap(bitmapFrame, B_CMAP8);
	postScriptBitmap->SetBits(IconPrevPS, 3072, 0, B_CMAP8);
	commandBox->AddChild(new BitmapView(secCol, postScriptBitmap));
	
	BTextControl *postScriptCtrl = new BTextControl(secColCtrl, K_POSTSCRIPT_CMD, NULL, "", GetPrefsMessage(K_POSTSCRIPT_CMD));
	commandBox->AddChild(postScriptCtrl);
		
	BRect comboxRect = commandBox->Bounds();
	BRect comboxbtnRect(comboxRect.right - bspacing - bwidth, comboxRect.bottom - bspacing - bheight, comboxRect.right - bspacing, comboxRect.bottom - bspacing);
	BButton *resetCommandDefaults = new BButton(comboxbtnRect,"resetCommandDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_COMMAND_DEFAULTS));
	commandBox->AddChild(resetCommandDefaults);
	
	return commandBox;
}
开发者ID:HaikuArchives,项目名称:BeTeX,代码行数:101,代码来源:PrefsWindow.cpp

示例6: BMessage

ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry)
	: BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
		"Application Type", B_TITLED_WINDOW,
		B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
	fChangedProperties(0)
{
	// add the menu

	BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
	AddChild(menuBar);

	BMenu* menu = new BMenu("File");
	fSaveMenuItem = new BMenuItem("Save", new BMessage(kMsgSave), 'S');
	fSaveMenuItem->SetEnabled(false);
	menu->AddItem(fSaveMenuItem);
	BMenuItem* item;
	menu->AddItem(item = new BMenuItem("Save into resource file" B_UTF8_ELLIPSIS,
		NULL));
	item->SetEnabled(false);

	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
		'W', B_COMMAND_KEY));
	menuBar->AddItem(menu);

	// Top view and signature

	BRect rect = Bounds();
	rect.top = menuBar->Bounds().Height() + 1.0f;
	BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(topView);

	rect = topView->Bounds().InsetByCopy(8.0f, 8.0f);
	fSignatureControl = new BTextControl(rect, "signature", "Signature:", NULL,
		new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT);
	fSignatureControl->SetModificationMessage(
		new BMessage(kMsgSignatureChanged));
	fSignatureControl->SetDivider(fSignatureControl->StringWidth(
		fSignatureControl->Label()) + 4.0f);
	float width, height;
	fSignatureControl->GetPreferredSize(&width, &height);
	fSignatureControl->ResizeTo(rect.Width(), height);
	topView->AddChild(fSignatureControl);

	// filter out invalid characters that can't be part of a MIME type name
	BTextView* textView = fSignatureControl->TextView();
	textView->SetMaxBytes(B_MIME_TYPE_LENGTH);
	const char* disallowedCharacters = "<>@,;:\"()[]?=";
	for (int32 i = 0; disallowedCharacters[i]; i++) {
		textView->DisallowChar(disallowedCharacters[i]);
	}

	// "Application Flags" group

	BFont font(be_bold_font);
	font_height fontHeight;
	font.GetHeight(&fontHeight);

	width = font.StringWidth("Icon") + 16.0f;
	if (width < B_LARGE_ICON + 16.0f)
		width = B_LARGE_ICON + 16.0f;

	rect.top = fSignatureControl->Frame().bottom + 4.0f;
	rect.bottom = rect.top + 100.0f;
	rect.right -= width + 8.0f;
	BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
	topView->AddChild(box);

	fFlagsCheckBox = new BCheckBox(rect, "flags", "Application flags",
		new BMessage(kMsgToggleAppFlags));
	fFlagsCheckBox->SetValue(B_CONTROL_ON);
	fFlagsCheckBox->ResizeToPreferred();
	box->SetLabel(fFlagsCheckBox);

	rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f;
	fSingleLaunchButton = new BRadioButton(rect, "single", "Single launch",
		new BMessage(kMsgAppFlagsChanged));
	fSingleLaunchButton->ResizeToPreferred();
	box->AddChild(fSingleLaunchButton);

	rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
	fMultipleLaunchButton = new BRadioButton(rect, "multiple",
		"Multiple launch", new BMessage(kMsgAppFlagsChanged));
	fMultipleLaunchButton->ResizeToPreferred();
	box->AddChild(fMultipleLaunchButton);

	rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
	fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
		"Exclusive launch", new BMessage(kMsgAppFlagsChanged));
	fExclusiveLaunchButton->ResizeToPreferred();
	box->AddChild(fExclusiveLaunchButton);

	rect.top = fSingleLaunchButton->Frame().top;
	rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
	fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only",
		new BMessage(kMsgAppFlagsChanged));
	fArgsOnlyCheckBox->ResizeToPreferred();
	box->AddChild(fArgsOnlyCheckBox);

//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:ApplicationTypeWindow.cpp

示例7: clipreg

NetworkWindow::NetworkWindow()
  : BWindow(BRect(0, 0, 435, 309),"Network",
			B_TITLED_WINDOW,B_NOT_ANCHORED_ON_ACTIVATE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE,
			B_CURRENT_WORKSPACE) 
{
	BScreen screen;
	
	BRect screenframe = screen.Frame(), bounds = Bounds(), workrect(0,0,1,1);
	float width,height;
	float screenx, screeny;
	
	screenx = ((screenframe.right + 1) / 2) - (bounds.right / 2) - 1;
	screeny = ((screenframe.bottom + 1) / 2) - (bounds.bottom / 2) - 1;
	MoveTo(screenx, screeny);
	
	fView = new BView(bounds,"View",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
	fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(fView);
	
	fRestart = new BButton(workrect,"Restart_Networking",
							"Restart Networking",new BMessage(kRestart_Networking_M),
							B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fRestart->GetPreferredSize(&width,&height);
	fRestart->ResizeTo(width,height);
	fRestart->MoveTo(10,bounds.bottom - 10 - height);
	
	// We fake the divider line by using a BBox. We have to call ConstrainClippingRegion
	// because otherwise we also see the corners drawn, which doesn't look nice
	BBox *vr = new BBox(BRect(width + 18, bounds.bottom - 11 - height, width + 19,
								bounds.bottom - 9),
						"vertical_rule", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fView->AddChild(vr);
	
	BRegion clipreg(vr->Bounds().InsetByCopy(0,2));
	vr->ConstrainClippingRegion(&clipreg);
	
	fRevert = new BButton(BRect(width + 25,bounds.bottom - 10 - height,width + 26,
								bounds.bottom - 10),
						"Revert","Revert", new BMessage(kRevert_M),
						B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fRevert->ResizeToPreferred();
	fRevert->SetEnabled(false);
	
	fSave = new BButton(workrect,"Save","Save",new BMessage(kSave_M),
						B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	fSave->GetPreferredSize(&width,&height);
	fSave->ResizeTo(width,height);
	fSave->MoveTo(bounds.right - 10 - width, bounds.bottom - 10 - height);
	fSave->MakeDefault(true);
	fSave->SetEnabled(false);
	
	BBox *hr = new BBox(BRect(0,bounds.bottom - height - 20,bounds.right,
								bounds.bottom - height - 19),
						"horizontal_rule",B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
	fView->AddChild(hr);
	
	workrect = Bounds();
	workrect.bottom = hr->Frame().top;
	workrect.top = 10;
	
	fTabView = new BTabView(workrect,"tab_view",B_WIDTH_FROM_WIDEST, B_FOLLOW_ALL);
	fTabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));	
	fView->AddChild(fTabView);
	bounds.bottom -= fTabView->TabHeight();

	fView->AddChild(fRestart);
	fView->AddChild(fRevert);	
	fView->AddChild(fSave);
	
	bounds = fTabView->Bounds();
	bounds.bottom -= fTabView->TabHeight();
	
	fIdentityView = new BView(bounds,"Identity",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
	fIdentityView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	
	fIdentity = new BTab();
	fTabView->AddTab(fIdentityView,fIdentity);
	
	// We can just pick a view to call StringWidth because we're not using anything
	// except the unaltered be_plain_font. Note that for each BTextControl pair we
	// just use the longer word of the two in order to save us some speed and code size
	float labelwidth = fTabView->StringWidth("Domain name: ");
	
	workrect.Set(10,20,11,21);
	fDomain = new BTextControl(workrect,"Domain_Name","Domain name:"," ",
							new BMessage(kSOMETHING_HAS_CHANGED_M));  
	
	// BTextControl::ResizeToPreferred() is a little strange for our purposes, so we
	// get the preferred size and ignore the width that we get.
	fDomain->GetPreferredSize(&width, &height);
	fDomain->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
	fDomain->SetDivider(labelwidth);
	
	workrect.left = 10;
	workrect.right = 11;
	workrect.top = height + 30;
	workrect.bottom = workrect.top + height;
	
	fHost = new BTextControl(workrect,"Host_Name","Host name:",NULL,
							new BMessage(kSOMETHING_HAS_CHANGED_M));   
//.........这里部分代码省略.........
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:101,代码来源:NetworkWindow.cpp

示例8: dummyFrame

MenuWindow::MenuWindow(const char* name)
	: BWindow(BRect(60,60,60,60), name, B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
	m_bUsingFullMenuBar = true;
	
	// menu bars
	BRect dummyFrame(0, 0, 0, 0);
	m_pFullMenuBar = new BMenuBar(dummyFrame, "Full Menu Bar");
	m_pHiddenMenuBar = new BMenuBar(dummyFrame, "Menu Bar w. Hidden User Menus");
	
	// File menu
	BMenu* pMenu = BuildFileMenu();
	if (pMenu) {
		m_pFullMenuBar->AddItem(pMenu);
	}
	pMenu = BuildFileMenu();
	if (pMenu) {
		m_pHiddenMenuBar->AddItem(pMenu);
	}
	
	// Test menu
	pMenu = m_testMenuBuilder.BuildTestMenu(B_MINI_ICON);
	if (pMenu) {
		m_pFullMenuBar->AddItem(pMenu);
	}
	pMenu = m_testMenuBuilder.BuildTestMenu(B_MINI_ICON);
	if (pMenu) {
		m_pHiddenMenuBar->AddItem(pMenu);
	}
	 
	// add child after menus are added so its initially
	// calculated app_server bounds take added menus into
	// account
	AddChild(m_pFullMenuBar);
	
	float menuHeight = m_pFullMenuBar->Bounds().Height();
	
	// Menu view
	m_pMenuView = new MenuView(B_FOLLOW_NONE); // don't follow window just yet!
	m_pMenuView->MoveBy(0, menuHeight + 1);
	AddChild(m_pMenuView);

	// Status view	
	BRect menuViewRect = m_pMenuView->Frame();
	float top = menuViewRect.bottom + 1;
	font_height plainHeight;
	be_plain_font->GetHeight(&plainHeight);
	
	// Simulate a vertical divider by making a BBox where only the top side
	// can be seen in the window.
	BRect boxFrame;
	boxFrame.Set(menuViewRect.left - 2, 
		top,
		menuViewRect.right + 2,
		top + plainHeight.ascent + plainHeight.descent + plainHeight.leading + 4);
	
	BBox* pStatusBox = new BBox(boxFrame);
	AddChild(pStatusBox);

	BRect statusFrame = pStatusBox->Bounds();
	statusFrame.InsetBy(2,2);	
	m_pStatusView = new BStringView(statusFrame, "Status View", STR_STATUS_DEFAULT,
		B_FOLLOW_ALL); // don't follow window just yet!
	m_pStatusView->SetViewColor(BKG_GREY);
	pStatusBox->AddChild(m_pStatusView);
	
	// Resize window dynamically to fit MenuView (and Status View)
	float windowWidth = m_pMenuView->Frame().right;
	float windowHeight = boxFrame.bottom - 4;
	ResizeTo(windowWidth, windowHeight);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:72,代码来源:MenuWindow.cpp

示例9: Bounds

DataView::DataView(BRect size)
	:
	BView(size, "DataView", B_FOLLOW_NONE, B_WILL_DRAW)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BRect r;
	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.bottom = 90;
	IconLabel* fileSystemLabel = new IconLabel(BRect(0, 0, 28 + be_bold_font->StringWidth(" Filesystem"), 19), " Filesystem", "datacd_16.png");
	fileSystemLabel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fileSystemLabel->SetDrawingMode(B_OP_ALPHA);
	BBox* fileSystemBox = new BBox(r, "fFileSystemBox", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	fileSystemBox->SetLabel(fileSystemLabel);
	AddChild(fileSystemBox);
	r = fileSystemBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.right = 220;
	r.bottom = 25;
	BRadioButton* ISO9660Radio = new BRadioButton(r, "ISO-9660", "ISO-9660", new BMessage(DATA_ISO9660));
	if (!strcmp(DATA_STRING, " ") && IMAGE_TYPE == 0)
		ISO9660Radio->SetValue(B_CONTROL_ON);
	fileSystemBox->AddChild(ISO9660Radio);


	r.bottom += 15;
	r.top += 15;
	BRadioButton* windowsRadio = new BRadioButton(r, "ISO-9660 with long filenames", "ISO-9660 with long filenames", new BMessage(DATA_WINDOWS));
	if (!strcmp(DATA_STRING, "-D -l") && IMAGE_TYPE == 0)
		windowsRadio->SetValue(B_CONTROL_ON);
	fileSystemBox->AddChild(windowsRadio);

	r.bottom += 15;
	r.top += 15;
	BRadioButton* jolietRadio = new BRadioButton(r, "fJolietRadio", "Windows (Joliet)", new BMessage(DATA_JOLIET));
	if (!strcmp(DATA_STRING, "-l -D -J") && IMAGE_TYPE == 0)
		jolietRadio->SetValue(B_CONTROL_ON);
	fileSystemBox->AddChild(jolietRadio);

	r.bottom += 15;
	r.top += 15;
	fBeOSRadio = new BRadioButton(r, "Haiku", "Haiku (bfs)", new BMessage(DATA_BFS));
	if (IMAGE_TYPE == 1)
		fBeOSRadio->SetValue(B_CONTROL_ON);

	fileSystemBox->AddChild(fBeOSRadio);


	r = fileSystemBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.bottom = 25;
	r.left = 230;
	BRadioButton* rockRadio = new BRadioButton(r, "RockRidge (UNIX Multiuser)", "RockRidge (UNIX Singeluser)", new BMessage(DATA_ROCK));
	if (!strcmp(DATA_STRING, "-l -L -r") && IMAGE_TYPE == 0)
		rockRadio->SetValue(B_CONTROL_ON);
	fileSystemBox->AddChild(rockRadio);

	r.bottom += 15;
	r.top += 15;
	BRadioButton* realRockRadio = new BRadioButton(r, "Real RockRidge (UNIX Multiuser)", "Real RockRidge (UNIX Multiuser)", new BMessage(DATA_REALROCK));
	if (!strcmp(DATA_STRING, "-l -L -R") && IMAGE_TYPE == 0)
		realRockRadio->SetValue(B_CONTROL_ON);
	fileSystemBox->AddChild(realRockRadio);

	r.bottom += 15;
	r.top += 15;
	BRadioButton* macRadio = new BRadioButton(r, "fMacRadio", "Mac (hfs)", new BMessage(DATA_HFS));
	if (!strcmp(DATA_STRING, "-hfs") && IMAGE_TYPE == 0)
		macRadio->SetValue(B_CONTROL_ON);
	fileSystemBox->AddChild(macRadio);

	r.bottom += 15;
	r.top += 15;
	BRadioButton* ownRadio = new BRadioButton(r, "own", "Own (choose mkisofs options)", new BMessage(DATA_HFS));
//	if(!strcmp(DATA_STRING,"-hfs"))
//		fMacRadio->SetValue(B_CONTROL_ON);
	ownRadio->SetEnabled(false);
	fileSystemBox->AddChild(ownRadio);

	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.top = 95;
	r.right = r.right - 160;

	IconLabel* bootLabel = new IconLabel(BRect(0, 0, 19 + 
	                       be_bold_font->StringWidth(" El Torito Bootable CD"), 19), " El Torito Bootable CD", "bootcd_16.png");
	bootLabel->SetDrawingMode(B_OP_ALPHA);                       
	bootLabel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BBox* bootBox = new BBox(r, "BootBox", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	bootBox->SetLabel(bootLabel);
	AddChild(bootBox);

	r = bootBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.bottom = r.top + 15;
	fBootableCDCheckBox = new BCheckBox(r, "fBootableCDCheckBox", "Enable BootableCD", new BMessage(BOOT_CHECKED));
	if (BOOTABLE)
//.........这里部分代码省略.........
开发者ID:mmadia,项目名称:burnitnow-svn_clone,代码行数:101,代码来源:DataView.cpp

示例10: BMessage

TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
	: SettingsView(rect, "WindowsSettingsView")
{
	rect.OffsetTo(B_ORIGIN);

	font_height fontHeight;
	be_bold_font->GetHeight(&fontHeight);

	rect.bottom = ceilf(fontHeight.ascent + fontHeight.descent) + 10;
	BBox *clockBox = new BBox(rect, "Clock");
	clockBox->SetLabel("Clock");
	AddChild(clockBox);

	rect.left = 8;
	rect.top = rect.bottom - 8;
	f24HrRadioButton = new BRadioButton(rect, "", "24 hour",
		new BMessage(kSettingsContentsModified));
	f24HrRadioButton->ResizeToPreferred();
	clockBox->AddChild(f24HrRadioButton);

	const float itemSpacing = f24HrRadioButton->Bounds().Height() + kItemExtraSpacing;
	rect.OffsetBy(0, itemSpacing);

	f12HrRadioButton = new BRadioButton(rect, "", "12 hour",
		new BMessage(kSettingsContentsModified));
	f12HrRadioButton->ResizeToPreferred();
	clockBox->AddChild(f12HrRadioButton);

	float width = max_c(f12HrRadioButton->Frame().right, f24HrRadioButton->Frame().right) + 8.0f;
	clockBox->ResizeTo(width, clockBox->Bounds().Height()
		+ 3 * f12HrRadioButton->Frame().Height());

	rect = clockBox->Frame();
	rect.OffsetBy(rect.Width() + 8, 0);
	BBox *dateFormatBox = new BBox(rect, "Date order");
	dateFormatBox->SetLabel("Date order");
	AddChild(dateFormatBox);

	rect = f24HrRadioButton->Frame();
	fYMDRadioButton = new BRadioButton(rect, "", "Year-month-day",
		new BMessage(kSettingsContentsModified));
	fYMDRadioButton->ResizeToPreferred();
	dateFormatBox->AddChild(fYMDRadioButton);

	rect.OffsetBy(0, itemSpacing);

	fDMYRadioButton = new BRadioButton(rect, "", "Day-month-year",
		new BMessage(kSettingsContentsModified));
	fDMYRadioButton->ResizeToPreferred();
	dateFormatBox->AddChild(fDMYRadioButton);

	rect.OffsetBy(0, itemSpacing);

	fMDYRadioButton = new BRadioButton(rect, "", "Month-day-year",
		new BMessage(kSettingsContentsModified));
	fMDYRadioButton->ResizeToPreferred();
	dateFormatBox->AddChild(fMDYRadioButton);

	dateFormatBox->ResizeTo(fYMDRadioButton->Bounds().Width() + 16,
		dateFormatBox->Bounds().Height());

	BPopUpMenu *menu = new BPopUpMenu("Separator");
	menu->AddItem(new BMenuItem("None", new BMessage(kSettingsContentsModified)));
	menu->AddItem(new BMenuItem("Space", new BMessage(kSettingsContentsModified)));
	menu->AddItem(new BMenuItem("-", new BMessage(kSettingsContentsModified)));
	menu->AddItem(new BMenuItem("/", new BMessage(kSettingsContentsModified)));
	menu->AddItem(new BMenuItem("\\", new BMessage(kSettingsContentsModified)));
	menu->AddItem(new BMenuItem(".", new BMessage(kSettingsContentsModified)));

	rect.left = 0;
	rect.top = clockBox->Frame().bottom + 8;
	rect.right = Bounds().Width() - 8;
	rect.bottom = rect.top + itemSpacing;
	fSeparatorMenuField = new BMenuField(rect, "Separator", "Separator:", menu);
	fSeparatorMenuField->SetDivider(fSeparatorMenuField->StringWidth(fSeparatorMenuField->Label()) + 8.0f);
	fSeparatorMenuField->SetAlignment(B_ALIGN_LEFT);
	fSeparatorMenuField->ResizeToPreferred();
	AddChild(fSeparatorMenuField);

	rect.OffsetBy(0, itemSpacing + 10);

	BStringView *exampleView = new BStringView(rect, "", "Examples:");
	exampleView->ResizeToPreferred();
	AddChild(exampleView);

	rect.OffsetBy(0, itemSpacing);

	fLongDateExampleView = new BStringView(rect, "", "");
	fLongDateExampleView->ResizeToPreferred();
	AddChild(fLongDateExampleView);

	rect.OffsetBy(0, itemSpacing);

	fShortDateExampleView = new BStringView(rect, "", "");
	fShortDateExampleView->ResizeToPreferred();
	AddChild(fShortDateExampleView);

	_UpdateExamples();
}
开发者ID:mariuz,项目名称:haiku,代码行数:99,代码来源:SettingsViews.cpp

示例11: r

void
CDPlayer::BuildGUI()
{
	fStopColor.red = 80;
	fStopColor.green = 164;
	fStopColor.blue = 80;
	fStopColor.alpha = 255;

	fPlayColor.red = 40;
	fPlayColor.green = 230;
	fPlayColor.blue = 40;
	fPlayColor.alpha = 255;

	BRect r(Bounds().InsetByCopy(10, 10));
	BBox *box = new BBox(r, "", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	AddChild(box);

	r = box->Bounds().InsetByCopy(10, 10);
	r.bottom = 25;

	float labelWidth, labelHeight;
	fCDTitle = new BStringView(r, "CDTitle", B_TRANSLATE("CD drive is empty"),
		B_FOLLOW_LEFT_RIGHT);
	fCDTitle->GetPreferredSize(&labelWidth, &labelHeight);
	fCDTitle->ResizeTo(r.Width(), labelHeight);
	box->AddChild(fCDTitle);

	r.bottom = r.top + labelHeight;
	r.OffsetBy(0, r.Height() + 5);

	fCurrentTrack = new BStringView(r, "TrackNumber",
		 "", B_FOLLOW_LEFT_RIGHT);
	box->AddChild(fCurrentTrack);

	r.OffsetBy(0, r.Height() + 5);
	r.right = r.left + (r.Width() / 2);
	fTrackTime = new BStringView(r, "TrackTime",
		 B_TRANSLATE("Track: 88:88 / 88:88"), B_FOLLOW_LEFT_RIGHT);
	fTrackTime->ResizeToPreferred();
	fTrackTime->SetText(B_TRANSLATE("Track: --:-- / --:--"));
	box->AddChild(fTrackTime);

	r.OffsetTo(fTrackTime->Frame().right + 5, r.top);
	fDiscTime = new BStringView(r, "DiscTime",
		B_TRANSLATE("Disc: 88:88 / 88:88"), B_FOLLOW_RIGHT);
	fDiscTime->ResizeToPreferred();
	fDiscTime->SetText(B_TRANSLATE("Disc: --:-- / --:--"));
	box->AddChild(fDiscTime);

	float maxWidth = max_c(fDiscTime->Frame().right, fCDTitle->Frame().right);

	box->ResizeTo(maxWidth + 5, fDiscTime->Frame().bottom + 10);

	fStop = new DrawButton(BRect(0, 0, 1, 1), "Stop",
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "stop_up"),
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "stop_down"),
		new BMessage(M_STOP), B_FOLLOW_BOTTOM, B_WILL_DRAW);
	fStop->ResizeToPreferred();
	fStop->MoveTo(10, box->Frame().bottom + 15);
	fStop->SetDisabled(BTranslationUtils::GetBitmap(B_PNG_FORMAT,
		"stop_disabled"));
	AddChild(fStop);
	float stopTop = fStop->Frame().top;


	fPlay = new TwoStateDrawButton(BRect(0, 0, 1, 1), "Play", 
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_up"),
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down"), 
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_up_on"),
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down"), 
		new BMessage(M_PLAY), B_FOLLOW_NONE, B_WILL_DRAW);

	fPlay->ResizeToPreferred();
	fPlay->MoveTo(fStop->Frame().right + 2, stopTop);
	AddChild(fPlay);

	fPrevTrack = new DrawButton(BRect(0, 0, 1, 1), "PrevTrack",
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "prev_up"),
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "prev_down"),
		new BMessage(M_PREV_TRACK), 0, B_WILL_DRAW);
	fPrevTrack->ResizeToPreferred();
	fPrevTrack->MoveTo(fPlay->Frame().right + 40, stopTop);
	AddChild(fPrevTrack);

	fNextTrack = new DrawButton(BRect(0, 0, 1, 1), "NextTrack",
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "next_up"),
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "next_down"),
		new BMessage(M_NEXT_TRACK), 0, B_WILL_DRAW);
	fNextTrack->ResizeToPreferred();
	fNextTrack->MoveTo(fPrevTrack->Frame().right + 1, stopTop);
	AddChild(fNextTrack);

	fRewind = new DoubleShotDrawButton(BRect(0, 0, 1, 1), "Rewind", 
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "rew_up"),
		BTranslationUtils::GetBitmap(B_PNG_FORMAT, "rew_down"),
		new BMessage(M_REWIND), 0, B_WILL_DRAW);
	fRewind->ResizeToPreferred();
	fRewind->MoveTo(fNextTrack->Frame().right + 40, stopTop);
	AddChild(fRewind);

//.........这里部分代码省略.........
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:101,代码来源:CDPlayer.cpp

示例12: constructToolbarBox

BView* PrefsWindow::constructToolbarBox(BRect frame)
{
	BBox* toolbarBox = new BBox(frame);
	toolbarBox->SetLabel("Toolbars");
	
	float	vertCbSpacing = 25.0f,
			offset = 30.0f,
			adjust = 5.0f,
			bwidth = 80.0f,
			bheight = 30.0f,
			bspacing = 10.0f
			;
	
	BRect checkboxRect = BRect((offset * 2.0f / 3.0f), offset - adjust,(offset * 2.0f/ 3.0f) + 150.0f, offset - adjust + vertCbSpacing - 5.0f);	
	
	BCheckBox *tbInvertCheck = new BCheckBox(checkboxRect, K_IS_TEXTBAR_INVERTED,"Invert Toolbar Colours", GetPrefsMessage(K_IS_TEXTBAR_INVERTED));
	bool isTexBarInverted = false;
	tbInvertCheck->SetValue(isTexBarInverted);
	toolbarBox->AddChild(tbInvertCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
		
	BCheckBox *tbGreekHiddenCheck = new BCheckBox(checkboxRect, K_IS_GREEK_HIDDEN,"Greek Letters", GetPrefsMessage(K_IS_GREEK_HIDDEN));
	bool isGreekHidden = false;
	tbGreekHiddenCheck->SetValue(isGreekHidden);
	toolbarBox->AddChild(tbGreekHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);	
	
	BCheckBox *tbBigHiddenCheck = new BCheckBox(checkboxRect, K_IS_BIG_HIDDEN,"Big Operators", GetPrefsMessage(K_IS_BIG_HIDDEN));
	bool isBigHidden = false;
	tbBigHiddenCheck->SetValue(isBigHidden);
	toolbarBox->AddChild(tbBigHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbBinaryHiddenCheck = new BCheckBox(checkboxRect, K_IS_BINARY_HIDDEN,"Binary Operators", GetPrefsMessage(K_IS_BINARY_HIDDEN));
	bool isBinaryHidden = false;
	tbBinaryHiddenCheck->SetValue(isBinaryHidden);
	toolbarBox->AddChild(tbBinaryHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbMiscHiddenCheck = new BCheckBox(checkboxRect, K_IS_MISC_HIDDEN,"Misc Symbols", GetPrefsMessage(K_IS_MISC_HIDDEN));
	bool isMiscHidden = false;
	tbMiscHiddenCheck->SetValue(isMiscHidden);
	toolbarBox->AddChild(tbMiscHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbBinRelHiddenCheck = new BCheckBox(checkboxRect, K_IS_BIN_REL_HIDDEN,"Binary Relations", GetPrefsMessage(K_IS_BIN_REL_HIDDEN));
	bool isBinHidden = false;
	tbBinRelHiddenCheck->SetValue(isBinHidden);
	toolbarBox->AddChild(tbBinRelHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbMMAHiddenCheck = new BCheckBox(checkboxRect, K_IS_MMA_HIDDEN,"Math Mode Accents", GetPrefsMessage(K_IS_MMA_HIDDEN));
	bool isMMAHidden = false;
	tbMMAHiddenCheck->SetValue(isMMAHidden);
	toolbarBox->AddChild(tbMMAHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbIntlHiddenCheck = new BCheckBox(checkboxRect, K_IS_INT_HIDDEN,"International", GetPrefsMessage(K_IS_INT_HIDDEN));
	bool isIntlHidden = false;
	tbIntlHiddenCheck->SetValue(isIntlHidden);
	toolbarBox->AddChild(tbIntlHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbTypeFaceHiddenCheck = new BCheckBox(checkboxRect, K_IS_TYPE_FACE_HIDDEN,"Type Faces", GetPrefsMessage(K_IS_TYPE_FACE_HIDDEN));
	bool isTypeFaceHidden = false;
	tbTypeFaceHiddenCheck->SetValue(isTypeFaceHidden);
	toolbarBox->AddChild(tbTypeFaceHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);
	
	BCheckBox *tbFunctionHiddenCheck = new BCheckBox(checkboxRect, K_IS_FUNCTION_HIDDEN,"Functions", GetPrefsMessage(K_IS_FUNCTION_HIDDEN));
	bool isFunctionHidden = false;
	tbFunctionHiddenCheck->SetValue(isFunctionHidden);
	toolbarBox->AddChild(tbFunctionHiddenCheck);
	checkboxRect.OffsetBy(0, vertCbSpacing);		

	BRect toolbarRect = toolbarBox->Bounds();
	BRect toolbarbtnRect(toolbarRect.right-bspacing-bwidth,toolbarRect.bottom-bspacing-bheight,toolbarRect.right-bspacing,toolbarRect.bottom-bspacing);
	BButton *resetToolbarDefaults = new BButton(toolbarbtnRect,"resetToolbarDefaults","Defaults", new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_TOOLBAR_DEFAULTS));
	toolbarBox->AddChild(resetToolbarDefaults);
	
	return toolbarBox;
}
开发者ID:HaikuArchives,项目名称:BeTeX,代码行数:82,代码来源:PrefsWindow.cpp

示例13: constructColourBox

BView* PrefsWindow::constructColourBox(BRect frame)
{
	BBox* colourBox = new BBox(frame);
	colourBox->SetLabel("TexView");

	float	offset = 30.0f,
			texViewWidth = 280.0f,
			texHeight = 200.0f,
			adjust = 5.0f,
			cbheight = 14.0f,
			cbspacing = 10.0f,
			bwidth = 80.0f,
			bheight = 30.0f,
			bspacing = 10.0f	
			;
			
	BRect bounds = colourBox->Bounds();
	
	float texViewX1 = bounds.right - texViewWidth - (offset * 2.0f / 3.0f);
	float texViewX2 = bounds.right - (offset * 2.0f / 3.0f) - B_V_SCROLL_BAR_WIDTH;
	BRect texViewRect(texViewX1, offset - adjust, texViewX2, offset + texHeight - adjust);	
	BRect texViewTextRect(texViewRect);
		
	/*TexView *texView = new TexView(texViewRect, texViewTextRect, prefs);
	BString sampleText = "Welcome to \\betex!\\\\\n%This is a Comment\n$Phe\\alpha r the Calculus$\n\\subsection{About \\betex}\n\\betex is \\textbf{cool}!\\\\\n``To Be Or Not To Be\'\'\n";
	texView->SetText(sampleText.String(),sampleText.Length());
	texView->MakeEditable(false);
	texView->MakeSelectable(false);
	
	BScrollView *texViewScroll = new BScrollView("textViewScroll", texView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE, false, true, B_FANCY_BORDER);
	texViewScroll->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	colourBox->AddChild(texViewScroll);	
	texView->SetTextRect(texView->Bounds());*/	
	
	//fg colour button
	BRect ccRect((offset*2/3),offset-adjust,offset+150,offset+cbheight-adjust);	
	rgb_color fgColour;
	ColourButton *fgColourButton = new ColourButton(ccRect, GetPrefsMessage(K_FG_COLOUR), fgColour," Text");
	colourBox->AddChild(fgColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color bgColour;
	ColourButton *bgColourButton = new ColourButton(ccRect, GetPrefsMessage(K_BG_COLOUR), bgColour, "Background");
	colourBox->AddChild(bgColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color genericCmdColour;
	ColourButton *genericCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_GEN_CMD_COLOUR), genericCmdColour, "Generic Commands");
	colourBox->AddChild(genericCmdColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color formatCmdColour;
	ColourButton *formatCmdColourButton  = new ColourButton(ccRect, GetPrefsMessage(K_FORMAT_CMD_COLOUR), formatCmdColour, "Formatting Commands");
	colourBox->AddChild(formatCmdColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color specialCmdColour;
	ColourButton *specialCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_SPECIAL_CMD_COLOUR), specialCmdColour, "Special Commands");
	colourBox->AddChild(specialCmdColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color mathModeColour;
	ColourButton *mathModeColourButton = new ColourButton(ccRect, GetPrefsMessage(K_MATH_MODE_COLOUR), mathModeColour, "Math Mode");
	colourBox->AddChild(mathModeColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color commaColour;
	ColourButton *commaColourButton = new ColourButton(ccRect, GetPrefsMessage(K_COMMA_COLOUR), commaColour, "Quotation Marks");
	colourBox->AddChild(commaColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color commentColour;
	ColourButton *commentColourButton = new ColourButton(ccRect,GetPrefsMessage(K_COMMENT_COLOUR),commentColour,"Comments");
	colourBox->AddChild(commentColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color puncSymbolColour;
	ColourButton *puncSymbolColourButton = new ColourButton(ccRect,GetPrefsMessage(K_PUNC_SYMBOL_COLOUR),puncSymbolColour,"Punctuation / Symbols");
	colourBox->AddChild(puncSymbolColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	//rgb_color htmlColour;
	//ColourButton *htmlColourButton = new ColourButton(ccRect,GetPrefsMessage(K_HTML_COLOUR), htmlColour,"Urls");
	//colourBox->AddChild(htmlColourButton);
	
	BRect cbRect = colourBox->Bounds();
	BRect cbbtnRect(cbRect.right - bspacing - bwidth, cbRect.bottom - bspacing - bheight, cbRect.right - bspacing, cbRect.bottom - bspacing);
	BButton *resetColourDefaults = new BButton(cbbtnRect,"fResetColorDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_COLOUR_DEFAULTS));
	colourBox->AddChild(resetColourDefaults);
	
	float	sliderWidth = 300.0f,
			vertOffset = 50.0f,
			minVal = 5.0f,
			maxVal = 30.0f
			;		
	BRect sliderFrame(ccRect.left, ccRect.top + vertOffset, ccRect.left + sliderWidth, ccRect.top + vertOffset + 100.0f);
	BSlider *fontSizeSlider = new BSlider(sliderFrame, K_FONT_SIZE, "Font Size", GetPrefsMessage(K_FONT_SIZE), minVal, maxVal);
	colourBox->AddChild(fontSizeSlider);
	
	fontSizeSlider->SetBarColor(ui_color(B_WINDOW_TAB_COLOR));
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:BeTeX,代码行数:101,代码来源:PrefsWindow.cpp

示例14: r

AddWindow::AddWindow() :
	BWindow(BRect(250,70,640,270),"AddWindow", B_MODAL_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_ASYNCHRONOUS_CONTROLS)
{

	
	BButton*		but;
	BButton*		but2;
	
	BFont font=*(be_plain_font);
	

	BRect r(Bounds());
	
	BBox *box = new BBox(r,"url_bbox", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW, B_FANCY_BORDER);
	box->SetBorder(B_PLAIN_BORDER);
	
	AddChild(box);
	BRect	rect(0, 0, 390, 165);
	
	BMessage templ;
	templ.AddString("name", "Add subscription");
	BMessage settings;
	settings.AddString("name", "rss_url");
	settings.AddString("description", "Feed URL");
	settings.AddInt32("type", B_STRING_TYPE);
	settings.AddBool("multi_line", true);
	templ.AddMessage("setting", &settings);
	BMessage values;

	text = new PBox(rect, templ, values, "rss_url");
	text->SetBorder(B_PLAIN_BORDER);
	
	box->AddChild(text);
	
	
	
	addrect = box->Bounds();
	addrect.InsetBy(25, 20);
	addrect.top = addrect.bottom - 12;
	addrect.left = addrect.right - font.StringWidth(_T("Cancel")) - 30;
	box->AddChild(but = new BButton(addrect,"",_T("Cancel"),new BMessage('can')));
	
	addrect.right = addrect.left - 15;
	addrect.left = addrect.right - font.StringWidth(_T("Add")) - 30;
	box->AddChild(but2 = new BButton(addrect,"",_T("Add"),new BMessage('sav')));


	//controlliamo se c'e' qualcosa nella clipboard?
	const char *clip_text = NULL;
	bool	addButton = false;
	int32 textLen;
	BString url;
	BMessage *clip = (BMessage *)NULL;
	if (be_clipboard->Lock() ){
		clip = be_clipboard->Data();
		
		if ( clip && ( clip->FindData("text/plain", B_MIME_TYPE,(const void **)&clip_text, &textLen) == B_OK )){
		url.SetTo(clip_text,textLen);
		
		if(url.FindFirst("http://") == 0)
			addButton = true;
		else
		if(url.FindFirst("pcast://") == 0)
			addButton = true;
		else
		if(url.FindFirst("feed://") == 0)
			addButton = true;
		}	
		be_clipboard->Unlock();
	} 
	
	if(addButton==true){
		addrect.right = addrect.left - 15;
		addrect.left = addrect.right - font.StringWidth(_T("Paste")) - 30;
		BMessage* msg=new BMessage('past');
		msg->AddString("url",url);
		BButton* clip_but;
		box->AddChild(clip_but = new BButton(addrect,"",_T("Paste"),msg));
	}
	
	MoveTo(BPAlert::AlertPosition(Bounds().Width(),Bounds().Height()));
	
	
	BTextView *textView = (BTextView*)FindView("rss_url");
	if (textView){
		textView->MakeFocus(true);
	}
}
开发者ID:Haikeek,项目名称:BePodder,代码行数:88,代码来源:AddWindow.cpp

示例15: IconLabel

AudioView::AudioView(BRect size)
	:
	BView(size, "AudioView", B_FOLLOW_NONE, B_WILL_DRAW)
{
	BRect r, r2;
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	IconLabel* advLabel = new IconLabel(BRect(0, 0, 19 + be_bold_font->StringWidth(" Audio Options (see help before change options)"), 19), 
							" Audio Options (see help before change options)", "audiocd_16.png");
	advLabel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	advLabel->SetDrawingMode(B_OP_ALPHA);
	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.bottom = 80;
	BBox* advOptionsBox = new BBox(r, "fAdvOptionsBox", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	advOptionsBox->SetLabel(advLabel);
	AddChild(advOptionsBox);


	r = advOptionsBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.right = 120;
	r.bottom = 25;
	fPadCheckBox = new BCheckBox(r, "pad", "Padding", new BMessage(AUDIO_PAD));
	if (!strncmp(PAD, "-pad", 4))
		fPadCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fPadCheckBox);

	r.bottom += 15;
	r.top += 15;
	r.right = 120;
	fNoFixCheckBox = new BCheckBox(r, "nofix", "No fixate", new BMessage(AUDIO_NOFIX));
	if (!strncmp(NOFIX, "-nofix", 6))
		fNoFixCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fNoFixCheckBox);

	r.bottom += 15;
	r.top += 15;
	fPreEmpCheckBox = new BCheckBox(r, "preemp", "Preemp", new BMessage(AUDIO_PREEMP));
	if (!strncmp(PREEMP, "-preemp", 7))
		fPreEmpCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fPreEmpCheckBox);

	r = advOptionsBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.left = 125;
	r.bottom = 25;

	fSwabCheckBox = new BCheckBox(r, "swab", "Swab", new BMessage(AUDIO_SWAB));
	if (!strncmp(SWAB, "-swab", 5))
		fSwabCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fSwabCheckBox);


	// Info box
	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.top = 85;
	BBox* infoBox = new BBox(r, "Info", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	infoBox->SetLabel("Audio Info");
	AddChild(infoBox);

	r = infoBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.right -= B_V_SCROLL_BAR_WIDTH;
	r2 = r;
	r2.InsetBy(2.0, 2.0);
	BTextView* infoTextView = new BTextView(r, "infoTextView", r2, B_FOLLOW_NONE, B_WILL_DRAW);
	infoTextView->MakeEditable(false);
	infoTextView->SetStylable(true);
	BScrollView* infoScrollView = new BScrollView("infoScrollView", infoTextView, B_FOLLOW_NONE, 0, false, true, B_FANCY_BORDER);
	infoBox->AddChild(infoScrollView);
	infoTextView->SetFontAndColor(be_fixed_font, B_FONT_ALL, &darkblue);
	infoTextView->Insert("Here will be some AudioInfo in the future like what codecs there are on the system.");
}
开发者ID:mmadia,项目名称:burnitnow-svn_clone,代码行数:82,代码来源:AudioView.cpp


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