您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ B_TRANSLATE函数代码示例

51自学网 2021-06-01 19:54:27
  C++
这篇教程C++ B_TRANSLATE函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中B_TRANSLATE函数的典型用法代码示例。如果您正苦于以下问题:C++ B_TRANSLATE函数的具体用法?C++ B_TRANSLATE怎么用?C++ B_TRANSLATE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: BPopUpMenu

voidPadView::DisplayMenu(BPoint where, LaunchButton* button) const{	MainWindow* window = dynamic_cast<MainWindow*>(Window());	if (window == NULL)		return;	LaunchButton* nearestButton = button;	if (!nearestButton) {		// find the nearest button		for (int32 i = 0; (nearestButton = ButtonAt(i)); i++) {			if (nearestButton->Frame().top > where.y)				break;		}	}	BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE("launch popup"), false, false);	// add button	BMessage* message = new BMessage(MSG_ADD_SLOT);	message->AddPointer("be:source", (void*)nearestButton);	BMenuItem* item = new BMenuItem(B_TRANSLATE("Add button here"), message);	item->SetTarget(window);	menu->AddItem(item);	// button options	if (button) {		// clear button		message = new BMessage(MSG_CLEAR_SLOT);		message->AddPointer("be:source", (void*)button);		item = new BMenuItem(B_TRANSLATE("Clear button"), message);		item->SetTarget(window);		menu->AddItem(item);		// remove button		message = new BMessage(MSG_REMOVE_SLOT);		message->AddPointer("be:source", (void*)button);		item = new BMenuItem(B_TRANSLATE("Remove button"), message);		item->SetTarget(window);		menu->AddItem(item);		// set button description		if (button->Ref()) {			message = new BMessage(MSG_SET_DESCRIPTION);			message->AddPointer("be:source", (void*)button);			item = new BMenuItem(B_TRANSLATE("Set description"B_UTF8_ELLIPSIS),				message);			item->SetTarget(window);			menu->AddItem(item);		}	}	menu->AddSeparatorItem();	// window settings	BMenu* settingsM = new BMenu(B_TRANSLATE("Settings"));	settingsM->SetFont(be_plain_font);	const char* toggleLayoutLabel;	if (fButtonLayout->Orientation() == B_HORIZONTAL)		toggleLayoutLabel = B_TRANSLATE("Vertical layout");	else		toggleLayoutLabel = B_TRANSLATE("Horizontal layout");	item = new BMenuItem(toggleLayoutLabel, new BMessage(MSG_TOGGLE_LAYOUT));	item->SetTarget(this);	settingsM->AddItem(item);	BMenu* iconSizeM = new BMenu(B_TRANSLATE("Icon size"));	for (uint32 i = 0; i < sizeof(kIconSizes) / sizeof(uint32); i++) {		uint32 iconSize = kIconSizes[i];		message = new BMessage(MSG_SET_ICON_SIZE);		message->AddInt32("size", iconSize);		BString label;		label << iconSize << " x " << iconSize;		item = new BMenuItem(label.String(), message);		item->SetTarget(this);		item->SetMarked(IconSize() == iconSize);		iconSizeM->AddItem(item);	}	settingsM->AddItem(iconSizeM);	item = new BMenuItem(B_TRANSLATE("Ignore double-click"),		new BMessage(MSG_SET_IGNORE_DOUBLECLICK));	item->SetTarget(this);	item->SetMarked(IgnoreDoubleClick());	settingsM->AddItem(item);	uint32 what = window->Look() == B_BORDERED_WINDOW_LOOK ? MSG_SHOW_BORDER : MSG_HIDE_BORDER;	item = new BMenuItem(B_TRANSLATE("Show window border"), new BMessage(what));	item->SetTarget(window);	item->SetMarked(what == MSG_HIDE_BORDER);	settingsM->AddItem(item);	item = new BMenuItem(B_TRANSLATE("Auto-raise"), new BMessage(MSG_TOGGLE_AUTORAISE));	item->SetTarget(window);	item->SetMarked(window->AutoRaise());	settingsM->AddItem(item);	item = new BMenuItem(B_TRANSLATE("Show on all workspaces"), new BMessage(MSG_SHOW_ON_ALL_WORKSPACES));	item->SetTarget(window);	item->SetMarked(window->ShowOnAllWorkspaces());	settingsM->AddItem(item);	menu->AddItem(settingsM);	menu->AddSeparatorItem();//.........这里部分代码省略.........
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:101,


示例2: BWindow

ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,	const BEntry& entry)	:	BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),		B_TRANSLATE("Application type"), B_TITLED_WINDOW,		B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |			B_FRAME_EVENTS | B_AUTO_UPDATE_SIZE_LIMITS),	fChangedProperties(0){	float padding = be_control_look->DefaultItemSpacing();	BAlignment labelAlignment = be_control_look->DefaultLabelAlignment();	BMenuBar* menuBar = new BMenuBar((char*)NULL);	menuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));	BMenu* menu = new BMenu(B_TRANSLATE("File"));	fSaveMenuItem = new BMenuItem(B_TRANSLATE("Save"),		new BMessage(kMsgSave), 'S');	fSaveMenuItem->SetEnabled(false);	menu->AddItem(fSaveMenuItem);	BMenuItem* item;	menu->AddItem(item = new BMenuItem(		B_TRANSLATE("Save into resource file" B_UTF8_ELLIPSIS), NULL));	item->SetEnabled(false);	menu->AddSeparatorItem();	menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),		new BMessage(B_QUIT_REQUESTED), 'W', B_COMMAND_KEY));	menuBar->AddItem(menu);	// Signature	fSignatureControl = new BTextControl(B_TRANSLATE("Signature:"), NULL,		new BMessage(kMsgSignatureChanged));	fSignatureControl->SetModificationMessage(		new BMessage(kMsgSignatureChanged));	// 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	BBox* flagsBox = new BBox("flagsBox");	fFlagsCheckBox = new BCheckBox("flags", B_TRANSLATE("Application flags"),		new BMessage(kMsgToggleAppFlags));	fFlagsCheckBox->SetValue(B_CONTROL_ON);	fSingleLaunchButton = new BRadioButton("single",		B_TRANSLATE("Single launch"), new BMessage(kMsgAppFlagsChanged));	fMultipleLaunchButton = new BRadioButton("multiple",		B_TRANSLATE("Multiple launch"), new BMessage(kMsgAppFlagsChanged));	fExclusiveLaunchButton = new BRadioButton("exclusive",		B_TRANSLATE("Exclusive launch"), new BMessage(kMsgAppFlagsChanged));	fArgsOnlyCheckBox = new BCheckBox("args only", B_TRANSLATE("Args only"),		new BMessage(kMsgAppFlagsChanged));	fBackgroundAppCheckBox = new BCheckBox("background",		B_TRANSLATE("Background app"), new BMessage(kMsgAppFlagsChanged));	BLayoutBuilder::Grid<>(flagsBox, 0, 0)		.SetInsets(padding, padding * 2, padding, padding)		.Add(fSingleLaunchButton, 0, 0).Add(fArgsOnlyCheckBox, 1, 0)		.Add(fMultipleLaunchButton, 0, 1).Add(fBackgroundAppCheckBox, 1, 1)		.Add(fExclusiveLaunchButton, 0, 2);	flagsBox->SetLabel(fFlagsCheckBox);	// "Icon" group	BBox* iconBox = new BBox("IconBox");	iconBox->SetLabel(B_TRANSLATE("Icon"));	fIconView = new IconView("icon");	fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));	BLayoutBuilder::Group<>(iconBox, B_HORIZONTAL)		.SetInsets(padding, padding * 2, padding, padding)		.Add(fIconView);	// "Supported Types" group	BBox* typeBox = new BBox("typesBox");	typeBox->SetLabel(B_TRANSLATE("Supported types"));	fTypeListView = new SupportedTypeListView("Suppported Types",		B_SINGLE_SELECTION_LIST);	fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));	BScrollView* scrollView = new BScrollView("type scrollview", fTypeListView,		B_FRAME_EVENTS | B_WILL_DRAW, false, true);	fAddTypeButton = new BButton("add type",		B_TRANSLATE("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType));//.........这里部分代码省略.........
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:101,


示例3: switch

voidMediaWindow::MessageReceived(BMessage* message){	switch(message->what)	{		case ML_INIT_MEDIA:			InitMedia(false);			break;		case ML_RESTART_MEDIA_SERVER:		{			thread_id thread = spawn_thread(&MediaWindow::RestartMediaServices,				"restart_thread", B_NORMAL_PRIORITY, this);			if (thread < B_OK)				fprintf(stderr, "couldn't create restart thread/n");			else				resume_thread(thread);			break;		}		case B_MEDIA_WEB_CHANGED:		case ML_SELECTED_NODE:		{			PRINT_OBJECT(*message);			MediaListItem* item = static_cast<MediaListItem*>(					fListView->ItemAt(fListView->CurrentSelection()));			if (!item)				break;			fCurrentNode.SetTo(NULL);			_ClearParamView();			item->AlterWindow(this);			break;		}		case B_SOME_APP_LAUNCHED:			{				PRINT_OBJECT(*message);				if (!fAlert)					break;				BString mimeSig;				if (message->FindString("be:signature", &mimeSig) == B_OK					&& (mimeSig == "application/x-vnd.Be.addon-host"						|| mimeSig == "application/x-vnd.Be.media-server")) {					fAlert->Lock();					fAlert->TextView()->SetText(						B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));					fAlert->Unlock();				}			}			break;		case B_SOME_APP_QUIT:			{				PRINT_OBJECT(*message);				BString mimeSig;				if (message->FindString("be:signature", &mimeSig) == B_OK) {					if (mimeSig == "application/x-vnd.Be.addon-host"						|| mimeSig == "application/x-vnd.Be.media-server") {						BMediaRoster* roster = BMediaRoster::CurrentRoster();						if (roster && roster->Lock())							roster->Quit();					}				}			}			break;		default:			BWindow::MessageReceived(message);			break;	}}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:70,


示例4: switch

// Handling of user interface and other eventsvoid MainWindow::MessageReceived(BMessage *message){	switch(message->what){		case SELECTION_CHANGED:			BRow *row;			row = teamView->RowAt(message->FindInt32("index"));			if(row != NULL && message->FindInt32("buttons") == B_SECONDARY_MOUSE_BUTTON){				BPoint point;				uint32 state;				teamView->GetMouse(&point,&state);				BPoint p2 = teamView->ConvertToScreen(point);				p2.x -= 5.0;				p2.y -= 5.0;				//if(fItemMenu->FindMarked())				//	fItemMenu->FindMarked()->SetMarked(false);				teamView->SelectionMessage()->ReplaceInt32("buttons",0);				teamView->ActionMenu()->Go(p2, true, true, true);				//fItemMenu->Go(p2, true, true, true);			}			SetButtonState();			break;		case IE_MAINWINDOW_MAINMENU_ACTION_KILL:		case IE_MAINWINDOW_MAINKILL:			DoKill();		 	UpdateTeams();		 	SetButtonState();			break;		case IE_MAINWINDOW_MAINMENU_ACTION_SUSPEND:		case IE_MAINWINDOW_MAINSUSPEND:			DoSuspend();			UpdateTeams();			SetButtonState();			break;		case IE_MAINWINDOW_MAINMENU_ACTION_RESUME:		case IE_MAINWINDOW_MAINRESUME:			DoResume();			UpdateTeams();			SetButtonState();			break;		case SET_PRIORITY: {			int32 priority = message->FindInt32("priority");			DoPriority(priority);			UpdateTeams();			SetButtonState();			break;		}		case IE_MAINWINDOW_MAINPRIORITYVALUE:			// takes priority from text field			DoPriority();			UpdateTeams();			SetButtonState();			break;		case IE_MAINWINDOW_MAINUPDATE:			UpdateTeams();			SetButtonState();			break;		case B_ABOUT_REQUESTED:    // "About…" is selected from menu…		{			BAboutWindow* fAboutWin = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Slayer"), slayer_signature);			fAboutWin->AddDescription(B_TRANSLATE("A thread manager for Haiku"));			fAboutWin->SetVersion(SLAYER_VERSION);			fAboutWin->AddCopyright(1999, "Arto Jalkanen");			const char* authors[] = {				"Arto Jalkanen ([email
C++ B_TRANSLATE_COMMENT函数代码示例
C++ B_NR_ITEMS函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。