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


C++ BMenuField::SetDivider方法代码示例

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


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

示例1: AddCat

void SplitWindow::AddCat()
{
	ResizeBy(0, 25);
	uint16 xpos = 20;
	uint16 width = 150;
	BTextControl* tc = new BTextControl(BRect(xpos - 5, ypos + 10, 
		xpos + width, ypos + 10), "CatField", "", "", 0);
	xpos += width;
	tc->SetDivider(0);
	catTexts.push_back(tc);
	v->AddChild(tc);
	BPopUpMenu* pu = new BPopUpMenu("", true, false);
	BMenuField* mf = new BMenuField(BRect(xpos + 2, ypos + 9, 
		xpos + 2, ypos + 9), "CatMenu", "", pu);
	mf->SetDivider(0);
	v->AddChild(mf);
	xpos += 30;
	tc = new BTextControl(BRect(xpos - 5, ypos + 10, 
		xpos + 75, ypos + 10), "AmountField", "", "", 0);
	tc->SetDivider(0);
	tc->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
	tc->SetModificationMessage(new BMessage(AmountModifiedMSG));
	amtTexts.push_back(tc);
	v->AddChild(tc);
	ypos += 25;

	for (cas::iterator ci = catS->begin(); ci != catS->end(); ci++)
	{
		if ((*ci)->IsRoot())
		{
			pu->AddItem(MakeCatMenu(*ci));
		}
	}
	catnum++;
}
开发者ID:HaikuArchives,项目名称:Finance,代码行数:35,代码来源:SplitWindow.cpp

示例2: BStringView

quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*> CheckView::MakeField(uint16 width,
	string name, uint16* xpos, uint16* ypos)
{
	BStringView* sv = new BStringView(BRect((*xpos), (*ypos), 
		(*xpos) + width, (*ypos) + 10),
		(name + "Text").c_str(), name.c_str());
	BFont font;
	sv->GetFont(&font);
	font.SetSize(10);
	sv->SetFont(&font);
	AddChild(sv);
	BTextControl* tc = new BTextControl(BRect((*xpos) - 5, (*ypos) + 10, 
		(*xpos) + width, (*ypos) + 10), (name + "Field").c_str(), 
		"", "", 0);
	(*xpos) += width;
	tc->SetDivider(0);
	AddChild(tc);
	BPopUpMenu* pu = new BPopUpMenu("", true, false);
	BMenuField* mf = new BMenuField(BRect((*xpos) + 2, (*ypos) + 9, 
		(*xpos) + 2, (*ypos) + 9), (name + "Menu").c_str(), "", pu);
	mf->SetDivider(0);
	AddChild(mf);
	(*xpos) += 30;
	
	return quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*>(tc, pu, mf, sv);
}
开发者ID:puckipedia,项目名称:Finance,代码行数:26,代码来源:CheckView_M-R.cpp

示例3: defined

SMTPConfigView::SMTPConfigView(MailAddonSettings& settings,
	BMailAccountSettings& accountSettings)
	:
	BMailProtocolConfigView(B_MAIL_PROTOCOL_HAS_AUTH_METHODS
		| B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD
		| B_MAIL_PROTOCOL_HAS_HOSTNAME
#ifdef USE_SSL
		| B_MAIL_PROTOCOL_HAS_FLAVORS
#endif
		)
{
#if defined(USE_SSL) || defined(B_COLLECTING_CATKEYS)
	static const char* kUnencryptedStr = B_TRANSLATE_MARK("Unencrypted");
	static const char* kSSLStr = B_TRANSLATE_MARK("SSL");
	static const char* kSTARTTLSStr = B_TRANSLATE_MARK("STARTTLS");
#endif

#ifdef USE_SSL
	AddFlavor(B_TRANSLATE_NOCOLLECT(kUnencryptedStr));
	AddFlavor(B_TRANSLATE(kSSLStr));
	AddFlavor(B_TRANSLATE(kSTARTTLSStr));
#endif

	AddAuthMethod(B_TRANSLATE("None"), false);
	AddAuthMethod(B_TRANSLATE("ESMTP"));
	AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);

	BTextControl *control = (BTextControl *)(FindView("host"));
	control->SetLabel(B_TRANSLATE("SMTP server:"));

	// Reset the dividers after changing one
	float widestLabel = 0;
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			widestLabel = MAX(widestLabel,text->StringWidth(text->Label()) + 5);
	}
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			text->SetDivider(widestLabel);
	}

	BMenuField *field = (BMenuField *)(FindView("auth_method"));
	field->SetDivider(widestLabel);

	SetTo(settings);

	fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), "path",
		false, BPrivate::default_mail_out_directory().Path());
	fFileView->SetTo(&settings.Settings(), NULL);
	AddChild(fFileView);
	float w, h;
	BMailProtocolConfigView::GetPreferredSize(&w, &h);
	fFileView->MoveBy(0, h - 10);
	GetPreferredSize(&w, &h);
	ResizeTo(w, h);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:56,代码来源:ConfigView.cpp

示例4: BMessage

void
HWindow::_InitGUI()
{
	fEventList = new HEventList();
	fEventList->SetType(BMediaFiles::B_SOUNDS);
	fEventList->SetSelectionMode(B_SINGLE_SELECTION_LIST);

	BMenu* menu = new BMenu("file");
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
		new BMessage(M_NONE_MESSAGE)));
	menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
		new BMessage(M_OTHER_MESSAGE)));

	BString label(B_TRANSLATE("Sound file:"));
	BMenuField* menuField = new BMenuField("filemenu", label, menu);
	menuField->SetDivider(menuField->StringWidth(label) + 10);

	BSize buttonsSize(be_plain_font->Size() * 2.5, be_plain_font->Size() * 2.5);

	BButton* stopbutton = new BButton("stop", "\xE2\x96\xA0",
		new BMessage(M_STOP_MESSAGE));
	stopbutton->SetEnabled(false);
	stopbutton->SetExplicitSize(buttonsSize);

	// We need at least one view to trigger B_PULSE_NEEDED events which we will
	// intercept in DispatchMessage to trigger the buttons enabling or disabling.
	stopbutton->SetFlags(stopbutton->Flags() | B_PULSE_NEEDED);

	BButton* playbutton = new BButton("play", "\xE2\x96\xB6",
		new BMessage(M_PLAY_MESSAGE));
	playbutton->SetEnabled(false);
	playbutton->SetExplicitSize(buttonsSize);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.SetInsets(B_USE_WINDOW_SPACING)
		.Add(fEventList)
		.AddGroup(B_HORIZONTAL)
			.Add(menuField)
			.AddGroup(B_HORIZONTAL, 0)
				.Add(playbutton)
				.Add(stopbutton)
			.End()
		.End();

	// setup file menu
	_SetupMenuField();
	BMenuItem* noneItem = menu->FindItem(B_TRANSLATE("<none>"));
	if (noneItem != NULL)
		noneItem->SetMarked(true);

	_UpdateZoomLimits();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:55,代码来源:HWindow.cpp

示例5: BMessage

BooleanEditor::BooleanEditor(BRect rect, DataEditor &editor)
	: TypeEditorView(rect, B_TRANSLATE("Boolean editor"), B_FOLLOW_NONE, 0, editor)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BPopUpMenu *menu = new BPopUpMenu("bool");
	BMessage *message;
	menu->AddItem(fFalseMenuItem = new BMenuItem("false",
		new BMessage(kMsgValueChanged)));
	menu->AddItem(fTrueMenuItem = new BMenuItem("true",
		message = new BMessage(kMsgValueChanged)));
	message->AddInt8("value", 1);

	BMenuField *menuField = new BMenuField(rect.InsetByCopy(5, 5),
		B_EMPTY_STRING, B_TRANSLATE("Boolean value:"), menu, B_FOLLOW_LEFT_RIGHT);
	menuField->SetDivider(StringWidth(menuField->Label()) + 8);
	menuField->ResizeToPreferred();
	ResizeTo(menuField->Bounds().Width() + 10,
		menuField->Bounds().Height() + 10);

	_UpdateMenuField();

	AddChild(menuField);
}
开发者ID:DonCN,项目名称:haiku,代码行数:24,代码来源:TypeEditors.cpp

示例6: BMessage

void
HWindow::InitGUI()
{
	fEventList = new HEventList();
	fEventList->SetType(BMediaFiles::B_SOUNDS);
	fEventList->SetSelectionMode(B_SINGLE_SELECTION_LIST);

	BGroupView* view = new BGroupView();
	BBox* box = new BBox("", B_WILL_DRAW | B_FRAME_EVENTS
		| B_NAVIGABLE_JUMP | B_PULSE_NEEDED);

	BMenu* menu = new BMenu("file");
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
		new BMessage(M_NONE_MESSAGE)));
	menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
		new BMessage(M_OTHER_MESSAGE)));

	BString label(B_TRANSLATE("Sound file:"));
	BMenuField* menuField = new BMenuField("filemenu", label, menu);
	menuField->SetDivider(menuField->StringWidth(label) + 10);

	BButton* stopbutton = new BButton("stop", B_TRANSLATE("Stop"),
		new BMessage(M_STOP_MESSAGE));
	stopbutton->SetEnabled(false);

	BButton* playbutton = new BButton("play", B_TRANSLATE("Play"),
		new BMessage(M_PLAY_MESSAGE));
	playbutton->SetEnabled(false);

	const float kInset = be_control_look->DefaultItemSpacing();
	view->SetLayout(new BGroupLayout(B_HORIZONTAL));
	view->AddChild(BGroupLayoutBuilder(B_VERTICAL, kInset)
		.AddGroup(B_HORIZONTAL)
			.Add(menuField)
			.AddGlue()
		.End()
		.AddGroup(B_HORIZONTAL, kInset)
			.AddGlue()
			.Add(playbutton)
			.Add(stopbutton)
		.End()
		.SetInsets(kInset, kInset, kInset, kInset)
	);

	box->AddChild(view);

	SetLayout(new BGroupLayout(B_HORIZONTAL));
	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.AddGroup(B_VERTICAL, kInset)
			.Add(fEventList)
			.Add(box)
		.End()
		.SetInsets(kInset, kInset, kInset, kInset)
	);

	// setup file menu
	SetupMenuField();
	BMenuItem* noneItem = menu->FindItem(B_TRANSLATE("<none>"));
	if (noneItem != NULL)
		noneItem->SetMarked(true);
}
开发者ID:royalharsh,项目名称:haiku,代码行数:64,代码来源:HWindow.cpp

示例7: Bounds

TPrefsWindow::TPrefsWindow(BRect rect, BFont *font, int32 *level,
							bool *wrap, char **sig)
			  :BWindow(rect, "BeMail Preferences", B_TITLED_WINDOW,
									B_NOT_CLOSABLE |
			  						B_NOT_RESIZABLE |
			  						B_NOT_ZOOMABLE)
{
	BBox		*box;
	BFont		menu_font;
	BMenuField	*menu;
	BRect		r;

	fNewFont = font;
	fFont = *fNewFont;
	fNewLevel = level;
	fLevel = *fNewLevel;
	fNewWrap = wrap;
	fWrap = *fNewWrap;
	fNewSignature = sig;
	fSignature = (char *)malloc(strlen(*fNewSignature) + 1);
	strcpy(fSignature, *fNewSignature);

	r = Bounds();
	r.InsetBy(-1, -1);
	box = new BBox(r);
	AddChild(box);

	r.Set(OK_BUTTON_X1, OK_BUTTON_Y1, OK_BUTTON_X2, OK_BUTTON_Y2);
	fOK = new BButton(r, "ok", OK_BUTTON_TEXT, new BMessage(P_OK));
	fOK->MakeDefault(true);
	fOK->SetEnabled(false);
	box->AddChild(fOK);

	r.Set(CANCEL_BUTTON_X1, CANCEL_BUTTON_Y1, CANCEL_BUTTON_X2, CANCEL_BUTTON_Y2);
	fCancel = new BButton(r, "cancel", CANCEL_BUTTON_TEXT, new BMessage(P_CANCEL));
	box->AddChild(fCancel);

	r.Set(REVERT_BUTTON_X1, REVERT_BUTTON_Y1, REVERT_BUTTON_X2, REVERT_BUTTON_Y2);
	fRevert = new BButton(r, "revert", REVERT_BUTTON_TEXT, new BMessage(P_REVERT));
	fRevert->SetEnabled(false);
	box->AddChild(fRevert);

	r.Set(FONT_X1, FONT_Y1, FONT_X2, FONT_Y2);
	fFontMenu = BuildFontMenu(font);
	menu = new BMenuField(r, "font", FONT_TEXT, fFontMenu,
				B_FOLLOW_ALL,
				B_WILL_DRAW |
				B_NAVIGABLE |
				B_NAVIGABLE_JUMP);
	menu->GetFont(&menu_font);
	menu->SetDivider(menu_font.StringWidth(WRAP_TEXT) + 7);
	menu->SetAlignment(B_ALIGN_RIGHT);
	box->AddChild(menu);

	r.Set(SIZE_X1, SIZE_Y1, SIZE_X2, SIZE_Y2);
	fSizeMenu = BuildSizeMenu(font);
	menu = new BMenuField(r, "size", SIZE_TEXT, fSizeMenu,
				B_FOLLOW_ALL,
				B_WILL_DRAW |
				B_NAVIGABLE |
				B_NAVIGABLE_JUMP);
	menu->SetDivider(menu_font.StringWidth(WRAP_TEXT) + 7);
	menu->SetAlignment(B_ALIGN_RIGHT);
	box->AddChild(menu);

	r.Set(LEVEL_X1, LEVEL_Y1, LEVEL_X2, LEVEL_Y2);
	fLevelMenu = BuildLevelMenu(*level);
	menu = new BMenuField(r, "level", LEVEL_TEXT, fLevelMenu,
				B_FOLLOW_ALL,
				B_WILL_DRAW |
				B_NAVIGABLE |
				B_NAVIGABLE_JUMP);
	menu->SetDivider(menu_font.StringWidth(WRAP_TEXT) + 7);
	menu->SetAlignment(B_ALIGN_RIGHT);
	box->AddChild(menu);

	r.Set(WRAP_X1, WRAP_Y1, WRAP_X2, WRAP_Y2);
	fWrapMenu = BuildWrapMenu(*wrap);
	menu = new BMenuField(r, "wrap", WRAP_TEXT, fWrapMenu,
				B_FOLLOW_ALL,
				B_WILL_DRAW |
				B_NAVIGABLE |
				B_NAVIGABLE_JUMP);
	menu->SetDivider(menu_font.StringWidth(WRAP_TEXT) + 7);
	menu->SetAlignment(B_ALIGN_RIGHT);
	box->AddChild(menu);

	r.Set(SIG_X1, SIG_Y1, SIG_X2, SIG_Y2);
	fSignatureMenu = BuildSignatureMenu(*sig);
	menu = new BMenuField(r, "sig", SIGNATURE_TEXT, fSignatureMenu,
				B_FOLLOW_ALL,
				B_WILL_DRAW |
				B_NAVIGABLE |
				B_NAVIGABLE_JUMP);
	menu->SetDivider(menu_font.StringWidth(WRAP_TEXT) + 7);
	menu->SetAlignment(B_ALIGN_RIGHT);
	box->AddChild(menu);
	Show();
}
开发者ID:ErisBlastar,项目名称:wordservices,代码行数:99,代码来源:Prefs.cpp

示例8: name


//.........这里部分代码省略.........
	msg->AddInt32("charset", B_MAIL_US_ASCII_CONVERSION);
	fEncodingMenu->AddItem(item = new BMenuItem("US-ASCII", msg));
	if (fCharacterSetUserSees == B_MAIL_US_ASCII_CONVERSION && !markedCharSet) {
		item->SetMarked(true);
		markedCharSet = true;
	}

	if (!resending && fIncoming) {
		// reading a message, display the Automatic item
		fEncodingMenu->AddSeparatorItem();
		msg = new BMessage(kMsgEncoding);
		msg->AddInt32("charset", B_MAIL_NULL_CONVERSION);
		fEncodingMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Automatic"), msg));
		if (!markedCharSet)
			item->SetMarked(true);
	}

	// First line of the header, From for reading e-mails (includes the
	// character set choice at the right), To when composing (nothing else in
	// the row).

	BRect r;
	char string[20];
	if (fIncoming && !resending) {
		// Set up the character set pop-up menu on the right of "To" box.
		r.Set (windowRect.Width() - widestCharacterSet -
			StringWidth (B_TRANSLATE("Decoding:")) - 2 * SEPARATOR_MARGIN,
				y - 2, windowRect.Width() - SEPARATOR_MARGIN,
				y + menuFieldHeight);
		field = new BMenuField (r, "decoding", B_TRANSLATE("Decoding:"),
			fEncodingMenu, true /* fixedSize */,
			B_FOLLOW_TOP | B_FOLLOW_RIGHT,
			B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
		field->SetDivider(field->StringWidth(B_TRANSLATE("Decoding:")) + 5);
		AddChild(field);
		r.Set(SEPARATOR_MARGIN, y,
			  field->Frame().left - SEPARATOR_MARGIN, y + menuFieldHeight);
		sprintf(string, B_TRANSLATE("From:"));
	} else {
		r.Set(x - 12, y, windowRect.Width() - SEPARATOR_MARGIN,
			y + menuFieldHeight);
		string[0] = 0;
	}

	y += controlHeight;
	fTo = new TTextControl(r, string, new BMessage(TO_FIELD), fIncoming,
		resending, B_FOLLOW_LEFT_RIGHT);
	fTo->SetFilter(mail_to_filter);

	if (!fIncoming || resending) {
		fTo->SetChoiceList(&fEmailList);
		fTo->SetAutoComplete(true);
	} else {
		fTo->SetDivider(x - 12 - SEPARATOR_MARGIN);
		fTo->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
	}

	AddChild(fTo);
	msg = new BMessage(FIELD_CHANGED);
	msg->AddInt32("bitmask", FIELD_TO);
	fTo->SetModificationMessage(msg);

	if (!fIncoming || resending) {
		r.right = r.left - 5;
		r.left = r.right - ceilf(be_plain_font->StringWidth(
			B_TRANSLATE("To:")) + 25);
开发者ID:sahil9912,项目名称:haiku,代码行数:67,代码来源:Header.cpp

示例9: createViews

/**
 *	@brief	Creates child views.
 */
void BePreferencesDlg::createViews()
{
    BeDialogControlHelper dch(getDialogLayout());
    NativeStringLoader* nsl = CoveredCalcApp::GetInstance();

    rgb_color viewColor = { 216, 216, 216, 255 };
    rgb_color highColor = { 0, 0, 0, 255 };

    // dialog title
    SetTitle(nsl->LoadNativeString(NSID_PREFERENCES_TITLE));

    // BaseView
    BView* baseView = new BView(Bounds(), PREFERENCES_DIALOG_VIEW_BASE_VIEW,
                                B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
    AddChild(baseView);

    baseView->SetViewColor(viewColor);

    // LangBox
    MBCString itemnameLangBox = ALITERAL("IDC_GROUP_LANGUAGE");
    BBox* langBox = new BBox(dch.GetItemRect(itemnameLangBox, ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_LANG_BOX);
    baseView->AddChild(langBox);

    langBox->SetLabel(nsl->LoadNativeString(NSID_PREFERENCES_GROUP_LANGUAGE));

    // LangPopup
    langMenu = new BMenu("");
    langMenu->SetLabelFromMarked(true);
    BMenuField* langPopup = new BMenuField(dch.GetItemRect(ALITERAL("IDC_CMB_LANGUAGE"), itemnameLangBox), PREFERENCES_DIALOG_VIEW_LANG_POPUP,
                                           nsl->LoadNativeString(NSID_PREFERENCES_LANGUAGE), langMenu);
    langBox->AddChild(langPopup);

    langPopup->SetDivider(dch.GetItemPos(true, ALITERAL("IDC_CMB_LANGUAGE.divider"), ALITERAL("IDC_CMB_LANGUAGE.left")));
    langPopup->SetAlignment(B_ALIGN_LEFT);
    uicLanguageListBox.Init(langPopup, ID_NULL);

    // LangNotice
    BRect frameRect = dch.GetItemRect(ALITERAL("IDC_STATIC_LANGUAGE_MESSAGE"), itemnameLangBox);
    BRect textRect = frameRect;
    textRect.OffsetTo(0, 0);
    BTextView* langNotice = new BTextView(frameRect, PREFERENCES_DIALOG_VIEW_LANG_NOTICE,
                                          textRect, B_FOLLOW_LEFT | B_FOLLOW_TOP);
    langBox->AddChild(langNotice);

    const char* text = nsl->LoadNativeString(NSID_PREFERENCES_LANGUAGE_MESSAGE);
    langNotice->SetText(text);
    langNotice->SetFontAndColor(0, strlen(text), be_plain_font, B_FONT_ALL, &highColor);
    langNotice->SetViewColor(viewColor);
    langNotice->MakeEditable(false);

    // KeyMappingBox
    MBCString itemnameKeyMappingBox = ALITERAL("IDC_GROUP_KEYMAP");
    BBox* keyMappingBox = new BBox(dch.GetItemRect(itemnameKeyMappingBox, ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_KEYMAPPING_BOX);
    baseView->AddChild(keyMappingBox);

    keyMappingBox->SetLabel(nsl->LoadNativeString(NSID_PREFERENCES_GROUP_KEYMAP));

    // KeyMappingPopup
    BMenu* keyMappingMenu = new BMenu("");
    keyMappingMenu->SetLabelFromMarked(true);
    BMenuField* keyMappingPopup = new BMenuField(dch.GetItemRect(ALITERAL("IDC_CMB_KEYMAPPINGS"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_KEYMAPPING_POPUP,
            nsl->LoadNativeString(NSID_PREFERENCES_KEYMAP), keyMappingMenu);
    keyMappingBox->AddChild(keyMappingPopup);

    keyMappingPopup->SetDivider(dch.GetItemPos(true, ALITERAL("IDC_CMB_KEYMAPPINGS.divider"), ALITERAL("IDC_CMB_KEYMAPPINGS.left")));
    keyMappingPopup->SetAlignment(B_ALIGN_LEFT);
    uicKeyMapListBox.Init(keyMappingPopup, ID_PREF_KEYMAP_SELECTED);

    // EditKeyMappingButton
    BButton* editKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_EDIT_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_EDIT_KEYMAPPING_BUTTON,
                                            nsl->LoadNativeString(NSID_PREFERENCES_EDIT_KEYMAP), new BMessage(ID_PREF_EDIT_KEYMAP));
    keyMappingBox->AddChild(editKeymapButton);
    uicEditKeyMapButton.Init(editKeymapButton);

    // DuplicateKeyMappingButton
    BButton* dupKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_DUPLICATE_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_DUPLICATE_KEYMAPPING_BUTTON,
                                           nsl->LoadNativeString(NSID_PREFERENCES_DUPLICATE_KEYMAP), new BMessage(ID_PREF_DUPLICATE_KEYMAP));
    keyMappingBox->AddChild(dupKeymapButton);
    uicDuplicateKeyMapButton.Init(dupKeymapButton);

    // DeleteKeyMappingButton
    BButton* delKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_DELETE_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_DELETE_KEYMAPPING_BUTTON,
                                           nsl->LoadNativeString(NSID_PREFERENCES_DELETE_KEYMAP), new BMessage(ID_PREF_DELETE_KEYMAP));
    keyMappingBox->AddChild(delKeymapButton);
    uicDeleteKeyMapButton.Init(delKeymapButton);

    // CancelButton
    BButton* cancelButton = new BButton(dch.GetItemRect(ALITERAL("IDCANCEL"), ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_CANCEL,
                                        nsl->LoadNativeString(NSID_PREFERENCES_CANCEL), new BMessage(ID_DIALOG_CANCEL));
    baseView->AddChild(cancelButton);

    // OKButton
    BButton* okButton = new BButton(dch.GetItemRect(ALITERAL("IDOK"), ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_OK,
                                    nsl->LoadNativeString(NSID_PREFERENCES_OK), new BMessage(ID_DIALOG_OK));
    baseView->AddChild(okButton);

    SetDefaultButton(okButton);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:101,代码来源:BePreferencesDlg.cpp

示例10: rect

void
ControlView::AttachedToWindow()
{
    BRect rect(Bounds());
    rect.InsetBySelf(10, 0);
    rect.bottom = rect.top + 18;
    rect.OffsetBy(0, 11);

    float offsetX = 0;
    float offsetY = 0;

    fTextControl = new BTextControl(rect, "TextInput", B_TRANSLATE("Text:"),
                                    B_TRANSLATE("Haiku, Inc."), NULL);
    fTextControl->SetDivider(29.0);
    fTextControl->SetModificationMessage(new BMessage(TEXT_CHANGED_MSG));
    AddChild(fTextControl);

    rect.OffsetBy(0.0, 27.0);
    _AddFontMenu(rect);

    rect.OffsetBy(0.0, 29.0);
    fFontsizeSlider = new BSlider(rect, "Fontsize", B_TRANSLATE("Size: 50"),
                                  NULL, 4, 360);
    fFontsizeSlider->SetModificationMessage(new BMessage(FONTSIZE_MSG));
    fFontsizeSlider->SetValue(50);
    AddChild(fFontsizeSlider);

    // Get the preferred size for the sliders
    fFontsizeSlider->GetPreferredSize(&offsetY, &offsetX);
    offsetX += 1;

    rect.OffsetBy(0.0, offsetX);
    fShearSlider = new BSlider(rect, "Shear", B_TRANSLATE("Shear: 90"), NULL,
                               45, 135);
    fShearSlider->SetModificationMessage(new BMessage(FONTSHEAR_MSG));
    fShearSlider->SetValue(90);
    AddChild(fShearSlider);

    rect.OffsetBy(0.0, offsetX);
    fRotationSlider = new BSlider(rect, "Rotation", B_TRANSLATE("Rotation: 0"),
                                  NULL, 0, 360);
    fRotationSlider->SetModificationMessage( new BMessage(ROTATION_MSG));
    fRotationSlider->SetValue(0);
    AddChild(fRotationSlider);

    rect.OffsetBy(0.0, offsetX);
    fSpacingSlider = new BSlider(rect, "Spacing", B_TRANSLATE("Spacing: 0"),
                                 NULL, -5, 50);
    fSpacingSlider->SetModificationMessage(new BMessage(SPACING_MSG));
    fSpacingSlider->SetValue(0);
    AddChild(fSpacingSlider);

    rect.OffsetBy(0.0, offsetX);
    fOutlineSlider = new BSlider(rect, "Outline", B_TRANSLATE("Outline:"),
                                 NULL, 0, 20);
    fOutlineSlider->SetModificationMessage(new BMessage(OUTLINE_MSG));
    AddChild(fOutlineSlider);

    rect.OffsetBy(0.0, offsetX);
    fAliasingCheckBox = new BCheckBox(rect, "Aliasing",
                                      B_TRANSLATE("Antialiased text"), new BMessage(ALIASING_MSG));
    fAliasingCheckBox->SetValue(B_CONTROL_ON);
    AddChild(fAliasingCheckBox);

    rect.OffsetBy(0.0, offsetX);
    fDrawingModeMenu = new BMenu("drawingmodemenu");

    BMessage* drawingMsg = NULL;
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_COPY);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_COPY", drawingMsg));
    fDrawingModeMenu->ItemAt(0)->SetMarked(true);
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_OVER);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_OVER", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_ERASE);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_ERASE", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_INVERT);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_INVERT", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_ADD);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_ADD", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_SUBTRACT);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_SUBTRACT", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_BLEND);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_BLEND", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_MIN);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_MIN", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_MAX);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_MAX", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
    drawingMsg->AddInt32("_mode", B_OP_SELECT);
    fDrawingModeMenu->AddItem(new BMenuItem("B_OP_SELECT", drawingMsg));
    drawingMsg = new BMessage(DRAWINGMODE_CHANGED_MSG);
//.........这里部分代码省略.........
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:101,代码来源:ControlView.cpp

示例11: MarginView

void
PageSetupView::AttachedToWindow()
{
	BMenuItem  *item = NULL;
	BMenuField *menuField;
	BButton    *button;
	bool       marked;
	int        count;

	/* margin */
	MarginUnit units = fJobData->getMarginUnit();
	BRect paper = fJobData->getPaperRect();
	BRect margin = fJobData->getPrintableRect();

	// re-calculate the margin from the printable rect in points
	margin.top -= paper.top;
	margin.left -= paper.left;
	margin.right = paper.right - margin.right;
	margin.bottom = paper.bottom - margin.bottom;

	fMarginView = new MarginView(MARGIN_RECT,
		paper.IntegerWidth(),
		paper.IntegerHeight(),
			margin, units);
	AddChild(fMarginView);

	/* paper selection */

	marked = false;
	fPaper = new BPopUpMenu("");
	fPaper->SetRadioMode(true);
	count = fPrinterCap->countCap(PrinterCap::kPaper);
	PaperCap **paper_cap = (PaperCap **)fPrinterCap->enumCap(PrinterCap::kPaper);
	while (count--) {
		BMessage *msg = new BMessage(kMsgPaperChanged);
		msg->AddPointer("paperCap", *paper_cap);
		item = new BMenuItem((*paper_cap)->label.c_str(), msg);
		fPaper->AddItem(item);
		item->SetTarget(this);
		if ((*paper_cap)->paper == fJobData->getPaper()) {
			item->SetMarked(true);
			marked = true;
		}
		paper_cap++;
	}
	if (!marked)
		item->SetMarked(true);
	menuField = new BMenuField(PAPER_RECT, "", PAPER_TEXT, fPaper);
	AddChild(menuField);
	float width = StringWidth(PAPER_TEXT) + 7;
	menuField->SetDivider(width);

	/* orientaion */
	fOrientation = new BPopUpMenu("orientation");
	fOrientation->SetRadioMode(true);

	menuField = new BMenuField(ORIENTATION_RECT, "orientation", ORIENTATION_TEXT, fOrientation);
	menuField->SetDivider(width);

	count = fPrinterCap->countCap(PrinterCap::kOrientation);
	if (count == 0) {
		AddOrientationItem(PORTRAIT_TEXT, JobData::kPortrait);
		AddOrientationItem(LANDSCAPE_TEXT, JobData::kLandscape);
	} else {
		OrientationCap **orientation_cap = (OrientationCap **)fPrinterCap->enumCap(PrinterCap::kOrientation);
		while (count--) {
			AddOrientationItem((*orientation_cap)->label.c_str(),
				(*orientation_cap)->orientation);
			orientation_cap++;
		}
	}

	AddChild(menuField);

	/* resolution */

	marked = false;
	fResolution = new BPopUpMenu("");
	fResolution->SetRadioMode(true);
	count = fPrinterCap->countCap(PrinterCap::kResolution);
	ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
	while (count--) {
		item = new BMenuItem((*resolution_cap)->label.c_str(), NULL);
		fResolution->AddItem(item);
		item->SetTarget(this);
		if (((*resolution_cap)->xres == fJobData->getXres()) && ((*resolution_cap)->yres == fJobData->getYres())) {
			item->SetMarked(true);
			marked = true;
		}
		resolution_cap++;
	}
	if (!marked)
		item->SetMarked(true);
	menuField = new BMenuField(RESOLUTION_RECT, "", RES_TEXT, fResolution);
	AddChild(menuField);
	menuField->SetDivider(width);

	/* scale */
	BString scale;
	scale << (int)fJobData->getScaling();
//.........这里部分代码省略.........
开发者ID:mariuz,项目名称:haiku,代码行数:101,代码来源:PageSetupDlg.cpp

示例12: node

/***********************************************************
 * InitGUI
 ***********************************************************/
void
HAddressView::InitGUI()
{
	float divider = StringWidth(_("Subject:")) + 20;
	divider = max_c(divider , StringWidth(_("From:"))+20);
	divider = max_c(divider , StringWidth(_("To:"))+20);
	divider = max_c(divider , StringWidth(_("Bcc:"))+20);
	
	BRect rect = Bounds();
	rect.top += 5;
	rect.left += 20 + divider;
	rect.right = Bounds().right - 5;
	rect.bottom = rect.top + 25;
	
	BTextControl *ctrl;
	ResourceUtils rutils;
	const char* name[] = {"to","subject","from","cc","bcc"};
	
	for(int32 i = 0;i < 5;i++)
	{
		ctrl = new BTextControl(BRect(rect.left,rect.top
								,(i == 1)?rect.right+divider:rect.right
								,rect.bottom)
								,name[i],"","",NULL
								,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_WILL_DRAW|B_NAVIGABLE);
		
		if(i == 1)
		{
			ctrl->SetLabel(_("Subject:"));
			ctrl->SetDivider(divider);
			ctrl->MoveBy(-divider,0);
		}else{
			ctrl->SetDivider(0);
		}
		BMessage *msg = new BMessage(M_MODIFIED);
		msg->AddPointer("pointer",ctrl);
		ctrl->SetModificationMessage(msg);
		ctrl->SetEnabled(!fReadOnly);
		AddChild(ctrl);
	
		rect.OffsetBy(0,25);
		switch(i)
		{
		case 0:
			fTo = ctrl;
			break;
		case 1:
			fSubject = ctrl;
			break;
		case 2:
			fFrom = ctrl;
			fFrom->SetEnabled(false);
			fFrom->SetFlags(fFrom->Flags() & ~B_NAVIGABLE);
			break;
		case 3:
			fCc = ctrl;
			break;
		case 4:
			fBcc = ctrl;
			break;
		}
	}
	//
	BRect menuRect= Bounds();
	menuRect.top += 5;
	menuRect.left += 22;
	menuRect.bottom = menuRect.top + 25;
	menuRect.right = menuRect.left + 16;
	
	BMenu *toMenu = new BMenu(_("To:"));
	BMenu *ccMenu = new BMenu(_("Cc:"));
	BMenu *bccMenu = new BMenu(_("Bcc:"));
	BQuery query;
	BVolume volume;
	BVolumeRoster().GetBootVolume(&volume);
	query.SetVolume(&volume);
	query.SetPredicate("((META:email=*)&&(BEOS:TYPE=application/x-person))");

	if(!fReadOnly && query.Fetch() == B_OK)
	{
		BString addr[4],name,group,nick;
		entry_ref ref;
		BList peopleList;
	
	
		while(query.GetNextRef(&ref) == B_OK)
		{
			BNode node(&ref);
			if(node.InitCheck() != B_OK)
				continue;
			
			ReadNodeAttrString(&node,"META:name",&name);		
			ReadNodeAttrString(&node,"META:email",&addr[0]);
			ReadNodeAttrString(&node,"META:email2",&addr[1]);
			ReadNodeAttrString(&node,"META:email3",&addr[2]);
			ReadNodeAttrString(&node,"META:email4",&addr[3]);
			ReadNodeAttrString(&node,"META:group",&group);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:101,代码来源:HAddressView.cpp

示例13: r

/**
 * _ConstructGUI()
 *
 * Creates the GUI for the View. MUST be called AFTER the View is attached to
 *	the Window, or will crash and/or create strange behaviour
 *
 * @param none
 * @return void
 */
void
MarginView::_ConstructGUI()
{
	BString str;
	// Create text fields
	BRect r(Frame().Width() - be_plain_font->StringWidth("Top#") - kWidth,
			kOffsetY, Frame().Width() - kOffsetX, kWidth);

	// top
	str << fMargins.top/fUnitValue;
	fTop = new BTextControl( r, "top", "Top:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fTop->SetModificationMessage(new BMessage(TOP_MARGIN_CHANGED));
	fTop->SetDivider(be_plain_font->StringWidth("Top#"));
	fTop->SetTarget(this);
	_AllowOnlyNumbers(fTop, kNumCount);
	AddChild(fTop);




	//left
	r.OffsetBy(0, kOffsetY);
	r.left = Frame().Width() - be_plain_font->StringWidth("Left#") - kWidth;
    str = "";
	str << fMargins.left/fUnitValue;
	fLeft = new BTextControl( r, "left", "Left:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fLeft->SetModificationMessage(new BMessage(LEFT_MARGIN_CHANGED));
	fLeft->SetDivider(be_plain_font->StringWidth("Left#"));
	fLeft->SetTarget(this);
	_AllowOnlyNumbers(fLeft, kNumCount);
	AddChild(fLeft);




	//bottom
	r.OffsetBy(0, kOffsetY);
	r.left = Frame().Width() - be_plain_font->StringWidth("Bottom#") - kWidth;
    str = "";
	str << fMargins.bottom/fUnitValue;
	fBottom = new BTextControl( r, "bottom", "Bottom:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fBottom->SetModificationMessage(new BMessage(BOTTOM_MARGIN_CHANGED));
	fBottom->SetDivider(be_plain_font->StringWidth("Bottom#"));
	fBottom->SetTarget(this);

	_AllowOnlyNumbers(fBottom, kNumCount);
	AddChild(fBottom);




	//right
	r.OffsetBy(0, kOffsetY);
	r.left = Frame().Width() - be_plain_font->StringWidth("Right#") - kWidth;
    str = "";
	str << fMargins.right/fUnitValue;
	fRight = new BTextControl( r, "right", "Right:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fRight->SetModificationMessage(new BMessage(RIGHT_MARGIN_CHANGED));
	fRight->SetDivider(be_plain_font->StringWidth("Right#"));
	fRight->SetTarget(this);
	_AllowOnlyNumbers(fRight, kNumCount);
	AddChild(fRight);



// Create Units popup
	r.OffsetBy(-kOffsetX, kOffsetY);
	r.right += kOffsetY;

	BPopUpMenu *menu = new BPopUpMenu("units");
	BMenuField *mf = new BMenuField(r, "units", "Units", menu,
			B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
	mf->ResizeToPreferred();
	mf->SetDivider(be_plain_font->StringWidth("Units#"));

	BMenuItem *item;
	// Construct menu items
	for (int32 i = 0; kUnitNames[i] != NULL; i++) {
		BMessage *msg = new BMessage(MARGIN_UNIT_CHANGED);
		msg->AddInt32("marginUnit", kUnitMsg[i]);
		menu->AddItem(item = new BMenuItem(kUnitNames[i], msg));
		item->SetTarget(this);
		if (fMarginUnit == kUnitMsg[i])
//.........这里部分代码省略.........
开发者ID:mariuz,项目名称:haiku,代码行数:101,代码来源:MarginView.cpp

示例14: IconLabel

CDRWView::CDRWView(BRect size)
	:
	BView(size, "CDRWView", B_FOLLOW_NONE, B_WILL_DRAW)
{
	BRect r;
	char temp_char[100];
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	// CDRW BOX
	IconLabel* CDRWLabel = new IconLabel(BRect(0, 0, 19 + be_bold_font->StringWidth(""), 19), "", "cd_16.png");
	CDRWLabel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	CDRWLabel->SetDrawingMode(B_OP_ALPHA);
	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.bottom = r.top + 160;
	BBox* CDRWBox = new BBox(r, "CDRWBox", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	CDRWBox->SetLabel(CDRWLabel);
	AddChild(CDRWBox);

	// BlankMenu (CDRWBOX)
	r = CDRWBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 25;
	fBlankMenu = new BMenu("Select");
	fBlankMenu->SetLabelFromMarked(true);
	BMenuField* blankMenuField = new BMenuField(r, "blank", "Blank:", fBlankMenu);
	blankMenuField->SetDivider(be_plain_font->StringWidth("Blank:  "));
	CDRWBox->AddChild(blankMenuField);

	fBlankMenu->AddItem(new BMenuItem("Full", new BMessage(BLANK_FULL)));
	fBlankMenu->AddItem(new BMenuItem("Fast", new BMessage(BLANK_FAST)));
	fBlankMenu->AddItem(new BMenuItem("Session", new BMessage(BLANK_SESSION)));
	fBlankMenu->AddItem(new BMenuItem("Track", new BMessage(BLANK_TRACK)));
	fBlankMenu->AddItem(new BMenuItem("Track tail", new BMessage(BLANK_TRACK_TAIL)));
	fBlankMenu->AddItem(new BMenuItem("Unreserve", new BMessage(BLANK_UNRES)));
	fBlankMenu->AddItem(new BMenuItem("Unclose", new BMessage(BLANK_UNCLOSE)));

	r = CDRWBox->Bounds();
	r.left = 150;
	r.right = 278;
	r.top = 60;
	r.bottom = 128;
	IconLabel* BGLabel1 = new IconLabel(r, "", "cdrw_64.png");  //cdrw_64.png
	BGLabel1->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BGLabel1->SetDrawingMode(B_OP_BLEND);
	CDRWBox->AddChild(BGLabel1);
	IconLabel* BGLabel2 = new IconLabel(r, "", "erase_64.png"); //erase_64.png
	BGLabel2->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BGLabel2->SetDrawingMode(B_OP_BLEND);
	CDRWBox->AddChild(BGLabel2);


	// BlankSpeed
	r = CDRWBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 15;
	r.left = 155;
	r.right = 270;
	sprintf(temp_char,"Blank Speed [%dx]", BLANK_SPD);
	fBlankSpeedSlider = new BSlider(r, "BlankSpeed", temp_char, new BMessage(BLANK_SPEED_CHANGE), 0, 5, B_BLOCK_THUMB, B_FOLLOW_NONE);
	fBlankSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fBlankSpeedSlider->SetHashMarkCount(6);
	fBlankSpeedSlider->SetValue((int32)(BLANK_SPD / 2) - 1);
	CDRWBox->AddChild(fBlankSpeedSlider);

	// BlankButton
	r = CDRWBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.bottom = r.top + 50;
	r.left = 330;
	r.right = 415;
	fBlankButton = new BButton(r, "BlankButton", "Blank!", new BMessage(BLANK_IT_NOW));
	CDRWBox->AddChild(fBlankButton);
}
开发者ID:mmadia,项目名称:burnitnow-svn_clone,代码行数:74,代码来源:CDRWView.cpp

示例15: PostInit

void CPrefsDialog::PostInit()
{
	BAutolock lock(this);

	strcpy(fNewFontFamily, gPrefs->GetPrefString("defdoc font family", NULL));
	fNewFontSize = gPrefs->GetPrefDouble("defdoc font size", 0.0);
	strcpy(fNewBFontFamily, gPrefs->GetPrefString("border font family", NULL));
	fNewBFontSize = gPrefs->GetPrefDouble("border font size", 0.0);

	CellStyle cs;
	font_style style;

	fOwner->GetCellView()->GetContainer()->GetDefaultCellStyle(cs);
	try {
		gFontSizeTable.GetFontInfo(cs.fFont, &fDocFontFamily, &style, &fDocFontSize);
		gFontSizeTable.GetFontInfo(fOwner->GetCellView()->BorderFontID(),
			&fDocBFontFamily, &style, &fDocBFontSize);
	}
	catch (CErr& e) {
		e.DoError();
	}

	BMenuField *mf = dynamic_cast<BMenuField*>(FindView("docfont"));
	fDocFont = mf->Menu();
	if (fDocFont) 
	{
		for (long i = 0; i < count_font_families(); i++)
		{
			font_family ff;
			get_font_family(i, &ff);
			fDocFont->AddItem(new BMenuItem(ff, new BMessage(msg_Changed)));
		}
		fDocFont->SetRadioMode(TRUE);
	}

	mf = dynamic_cast<BMenuField*>(FindView("borderfont"));
	fBorderFont = mf->Menu();
	for (long i = 0; i < count_font_families(); i++)
	{
		font_family ff;
		get_font_family(i, &ff);
		fBorderFont->AddItem(new BMenuItem(ff, new BMessage(msg_Changed)));
	}
	fBorderFont->SetRadioMode(TRUE);

	mf = dynamic_cast<BMenuField*>(FindView("dateorder"));
	fDMY = mf->Menu();
	fDMY->AddItem(new BMenuItem("dmy", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("dym", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("mdy", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("myd", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("ydm", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("ymd", new BMessage(msg_Changed)));

	mf = dynamic_cast<BMenuField*>(FindView("neworcur"));
	if (mf)
	{
		fNewOrCur = mf->Menu();
		fNewOrCur->AddItem(new BMenuItem("New Documents", new BMessage(msg_ChangeTarget)));
		if (fOwner)
		{
			char s[32];
			fDocFont->FindItem(fDocFontFamily)->SetMarked(true);
			ftoa(fDocFontSize, s);
			SetText("docsize", s);
			fBorderFont->FindItem(fDocBFontFamily)->SetMarked(true);
			ftoa(fDocBFontSize, s);
			SetText("bordersize", s);

			fNewOrCur->AddItem(new BMenuItem(fOwner->Title(), new BMessage(msg_ChangeTarget)));
			fNewOrCur->ItemAt(1)->SetMarked(true);
		}
		else
			fNewOrCur->ItemAt(0)->SetMarked(true);
		mf->SetDivider(be_plain_font->StringWidth(mf->Label()) + 4);
	}

	BBox *b;
	BView *v;
	v = FindView("prgrid");
	b = dynamic_cast<BBox*>(v->Parent());
	if (b)
	{
		char t[256];
		sprintf(t, b->Label(), fOwner->Title());
		b->SetLabel(t);
	}
	
	fAutoRecalc = fOwner->GetCellView()->DoesAutoRecalc();
	fDisplayZero = fOwner->GetCellView()->DoesDisplayZero();
	fPrGrid = fOwner->GetCellView()->PrintsGrid();
	fPrBorders = fOwner->GetCellView()->PrintsBorders();
	fShGrid = fOwner->GetCellView()->ShowsGrid();
	fShBorders = fOwner->GetCellView()->ShowsBorders();

	CancelClicked();

	Show();
} /* CPrefsDialog::PostInit */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:99,代码来源:PrefsDialog.cpp


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