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


C++ BAlert::Go方法代码示例

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


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

示例1: device

void
NetworkStatusView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case B_NETWORK_MONITOR:
			_Update();
			break;

		case kMsgShowConfiguration:
			_ShowConfiguration(message);
			break;

		case kMsgOpenNetworkPreferences:
			_OpenNetworksPreferences();
			break;

		case kMsgJoinNetwork:
		{
			const char* deviceName;
			const char* name;
			if (message->FindString("device", &deviceName) == B_OK
				&& message->FindString("name", &name) == B_OK) {
				BNetworkDevice device(deviceName);
				status_t status = device.JoinNetwork(name);
				if (status != B_OK) {
					BString text
						= B_TRANSLATE("Could not join wireless network:\n");
					text << strerror(status);
					BAlert* alert = new BAlert(name, text.String(),
						B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
						B_STOP_ALERT);
					alert->Go(NULL);
				}
			}
			break;
		}

		case B_ABOUT_REQUESTED:
			_AboutRequested();
			break;

		case B_QUIT_REQUESTED:
			_Quit();
			break;

		default:
			BView::MessageReceived(message);
	}
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:49,代码来源:NetworkStatusView.cpp

示例2: BAlert

bool
BootManagerController::_WriteBootMenu()
{
	BAlert* alert = new BAlert("confirm", B_TRANSLATE("About to write the "
			"boot menu to disk. Are you sure you want to continue?"),
		B_TRANSLATE_COMMENT("Write boot menu", "Button"),
		B_TRANSLATE_COMMENT("Back", "Button"), NULL, B_WIDTH_AS_USUAL,
		B_WARNING_ALERT);

	if (alert->Go() == 1)
		return false;

	fWriteBootMenuStatus = fBootMenu->Install(*fBootDrive, fSettings);
	return true;
}
开发者ID:DonCN,项目名称:haiku,代码行数:15,代码来源:BootManagerController.cpp

示例3: text

void
FolderShaper::AddTemplatesMessage	()
{
	BPath p;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &p) != B_OK);
	if (p.SetTo(p.Path(),"Kirilla/FolderShaper/Templates") != B_OK);

	BString text("Put your template folders in this folder (");
	text.Append(p.Path());
	text.Append("), then try again.");

	BAlert *box = new BAlert("FolderShaper", text.String(),
							 "I will", NULL, NULL, B_WIDTH_AS_USUAL, B_IDEA_ALERT);
	box->Go();
}
开发者ID:HaikuArchives,项目名称:FolderShaper,代码行数:15,代码来源:FSApp.cpp

示例4: theText

void
ServerAgent::DCCChatDialog(BString theNick, BString theIP, BString thePort)
{
  BString theText(theNick);
  theText << S_SERVER_DCC_CHAT_PROMPT;
  BAlert *myAlert = new BAlert("DCC request", theText.String(), "Accept",
    "Refuse");
  myAlert->SetFeel (B_FLOATING_APP_WINDOW_FEEL);
  BMessage *myMessage = new BMessage(M_CHAT_ACCEPT);
  myMessage->AddString("nick", theNick.String());
  myMessage->AddString("ip", theIP.String());
  myMessage->AddString("port", thePort.String());
  BInvoker *myInvoker = new BInvoker(myMessage, this);
  myAlert->Go(myInvoker);
}
开发者ID:xray7224,项目名称:Vision,代码行数:15,代码来源:DCCHandler.cpp

示例5: sizeof

void
error_alert(const char* message, status_t status, alert_type type)
{
	char warning[512];
	if (status != B_OK) {
		snprintf(warning, sizeof(warning), "%s:\n\t%s\n", message,
			strerror(status));
	}

	BAlert* alert = new BAlert(B_TRANSLATE("FileTypes request"),
		status == B_OK ? message : warning,
		B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, type);
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:15,代码来源:FileTypes.cpp

示例6: errorMessage

void
NetworkStatusView::_OpenNetworksPreferences()
{
	status_t status = be_roster->Launch("application/x-vnd.Haiku-Network");
	if (status != B_OK && status != B_ALREADY_RUNNING) {
		BString errorMessage(B_TRANSLATE("Launching the network preflet "
			"failed.\n\nError: "));
		errorMessage << strerror(status);
		BAlert* alert = new BAlert("launch error", errorMessage.String(),
			B_TRANSLATE("OK"));

		// asynchronous alert in order to not block replicant host application
		alert->Go(NULL);
	}
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:15,代码来源:NetworkStatusView.cpp

示例7: SetPrimaryKey

void ColumnProperties::SetPrimaryKey(bool key)
{
	fPrimaryKey = key;

	if (!fPrimaryKey && fAutoNumber)
	{
		BString msg("AutoNumber fields are required to be primary keys.");
		BAlert* alert = new BAlert("Title", msg.String(), "Ok");
		alert->SetShortcut(0, B_ESCAPE);
		alert->Go();

		fPrimaryKey = true;
	}

}
开发者ID:HaikuArchives,项目名称:BeAccessible,代码行数:15,代码来源:ColumnProperties.cpp

示例8: entry

void
SudokuWindow::_MessageDropped(BMessage* message)
{
	status_t status = B_MESSAGE_NOT_UNDERSTOOD;
	bool hasRef = false;

	entry_ref ref;
	if (message->FindRef("refs", &ref) != B_OK) {
		const void* data;
		ssize_t size;
		if (message->FindData("text/plain", B_MIME_TYPE, &data,
				&size) == B_OK) {
			status = fSudokuView->SetTo((const char*)data);
		} else
			return;
	} else {
		status = fSudokuView->SetTo(ref);
		if (status == B_OK)
			be_roster->AddToRecentDocuments(&ref, kSignature);

		BEntry entry(&ref);
		entry_ref parent;
		if (entry.GetParent(&entry) == B_OK
			&& entry.GetRef(&parent) == B_OK)
			fSavePanel->SetPanelDirectory(&parent);

		hasRef = true;
	}

	if (status < B_OK) {
		char buffer[1024];
		if (hasRef) {
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE("Could not open \"%s\":\n%s\n"), ref.name,
				strerror(status));
		} else {
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE("Could not set Sudoku:\n%s\n"),
				strerror(status));
		}

		BAlert* alert = new BAlert(B_TRANSLATE("Sudoku request"),
			buffer, B_TRANSLATE("OK"), NULL, NULL,
			B_WIDTH_AS_USUAL, B_STOP_ALERT);
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go();
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:48,代码来源:SudokuWindow.cpp

示例9: BClipboard

void
TermApp::ReadyToRun()
{
	// Prevent opeing window when option -h is given.
	if (sUsageRequested)
		return;

	// Install a SIGCHLD signal handler, so that we will be notified, when
	// a shell exits.
	struct sigaction action;
#ifdef __HAIKU__
	action.sa_handler = (__sighandler_t)_SigChildHandler;
#else
	action.sa_handler = (__signal_func_ptr)_SigChildHandler;
#endif
	sigemptyset(&action.sa_mask);
#ifdef SA_NODEFER
	action.sa_flags = SA_NODEFER;
#endif
	action.sa_userdata = this;
	if (sigaction(SIGCHLD, &action, NULL) < 0) {
		fprintf(stderr, "sigaction() failed: %s\n",
			strerror(errno));
		// continue anyway
	}

	// init the mouse copy'n'paste clipboard
	gMouseClipboard = new BClipboard(MOUSE_CLIPBOARD_NAME, true);

	status_t status = _MakeTermWindow();

	// failed spawn, print stdout and open alert panel
	// TODO: This alert does never show up.
	if (status < B_OK) {
		BAlert* alert = new BAlert("alert",
			B_TRANSLATE("Terminal couldn't start the shell. Sorry."),
			B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_LABEL,
			B_INFO_ALERT);
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go(NULL);
		PostMessage(B_QUIT_REQUESTED);
		return;
	}

	// using BScreen::Frame isn't enough
	if (fStartFullscreen)
		BMessenger(fTermWindow).SendMessage(FULLSCREEN);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:48,代码来源:TermApp.cpp

示例10: OnSave

// Save data
void AppWindow::OnSave(BMessage *msg) {
entry_ref ref;
BString name;
	msg->FindRef("directory", &ref);
	msg->FindString("name", &name);
	BDirectory dir(&ref);
	BFile file(&dir, name.String(), B_CREATE_FILE | B_WRITE_ONLY);
	if (file.InitCheck() == B_OK) {
		BMessage archive;
		view->graph->Archive(&archive);
		archive.Flatten(&file);
	} else {
		BAlert *a = new BAlert("Save Error", "Could not write file", "OK");
		a->Go();
	}
}
开发者ID:HaikuArchives,项目名称:PlottingTools,代码行数:17,代码来源:Application.cpp

示例11: Remove

void DeskbarPulseView::Remove() {
	// Remove ourselves from the deskbar by name
	BDeskbar *deskbar = new BDeskbar();
	status_t err = deskbar->RemoveItem("DeskbarPulseView");
	if (err != B_OK) {
		BString str;
		snprintf(str.LockBuffer(512), 512,
			B_TRANSLATE("Removing from Deskbar failed.\n%s"), strerror(err));
		str.UnlockBuffer();
		BAlert *alert = new BAlert(B_TRANSLATE("Info"), str.String(),
			B_TRANSLATE("OK"));
		alert->SetShortcut(0, B_ESCAPE);
		alert->Go(NULL);
	}
	delete deskbar;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:16,代码来源:DeskbarPulseView.cpp

示例12: beos_warn_user

/* exported function defined in beos/gui.h */
nserror beos_warn_user(const char *warning, const char *detail)
{
	LOG("warn_user: %s (%s)", warning, detail);
	BAlert *alert;
	BString text(warning);
	if (detail)
		text << ":\n" << detail;

	alert = new BAlert("NetSurf Warning", text.String(), "Debug", "Ok",
                           NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
	if (alert->Go() < 1) {
		debugger("warn_user");
        }
        
        return NSERROR_OK;
}
开发者ID:janrinze,项目名称:netsurf,代码行数:17,代码来源:gui.cpp

示例13: Value

status_t
CPUButton::Invoke(BMessage *message)
{
	if (!LastEnabledCPU(fCPU)) {
		_kern_set_cpu_enabled(fCPU, Value());
	} else {
		BAlert *alert = new BAlert(B_TRANSLATE("Info"),
			B_TRANSLATE("You can't disable the last active CPU."),
			B_TRANSLATE("OK"));
		alert->SetShortcut(0, B_ESCAPE);
		alert->Go(NULL);
		SetValue(!Value());
	}

	return B_OK;
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:16,代码来源:CPUButton.cpp

示例14: gui_message

void gui_message (const char *format,...)
{
    char msg[2048];
    va_list parms;
    BAlert *alert;

    va_start (parms,format);
    vsprintf (msg, format, parms);
    va_end (parms);

    write_log (msg);

    alert = new BAlert ("UAE Information", msg, "Okay", NULL, NULL,
			B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
    alert->Go();
}
开发者ID:Yamakuzure,项目名称:PUAE,代码行数:16,代码来源:gui.cpp

示例15: BAlert

void
GrepWindow::_OnTrimSelection()
{
	if (fSearchResults->CurrentSelection() < 0) {
		BString text;
		text << B_TRANSLATE("Please select the files you wish to keep searching.");
		text << "\n";
		text << B_TRANSLATE("The unselected files will be removed from the list.");
		text << "\n";
		BAlert* alert = new BAlert(NULL, text.String(), B_TRANSLATE("OK"), NULL, NULL,
			B_WIDTH_AS_USUAL, B_WARNING_ALERT);
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go(NULL);
		return;
	}

	BMessage message;
	BString path;

	for (int32 index = 0; ; index++) {
		BStringItem* item = dynamic_cast<BStringItem*>(
			fSearchResults->ItemAt(index));
		if (item == NULL)
			break;

		if (!item->IsSelected() || item->OutlineLevel() != 0)
			continue;

		if (path == item->Text())
			continue;

		path = item->Text();
		entry_ref ref;
		if (get_ref_for_path(path.String(), &ref) == B_OK)
			message.AddRef("refs", &ref);
	}

	fModel->fDirectory = entry_ref();
		// invalidated on purpose

	fModel->fSelectedFiles.MakeEmpty();
	fModel->fSelectedFiles = message;

	PostMessage(MSG_START_CANCEL);

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


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