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


C++ Printer::ConfigurePage方法代码示例

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


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

示例1: sender

status_t 
PrintServerApp::async_thread(void* data)
{
	AsyncThreadParams* p = (AsyncThreadParams*)data;

	Printer* printer = p->printer;
	BMessage* msg = p->AcquireMessage();
	{
		AutoReply sender(msg, 'stop');
		switch (msg->what) {
			// Handle showing the config dialog
			case PSRV_SHOW_PAGE_SETUP: {
			case PSRV_SHOW_PRINT_SETUP:
				if (printer) {
					if (p->app->fUseConfigWindow) {
						config_setup_kind kind = kJobSetup;
						if (msg->what == PSRV_SHOW_PAGE_SETUP)
							kind = kPageSetup;
						ConfigWindow* w = new ConfigWindow(kind, printer, msg,
							&sender);
						w->Go();
					} else {
						BMessage reply(*msg);
						status_t status = B_ERROR;
						if (msg->what == PSRV_SHOW_PAGE_SETUP)
							status = printer->ConfigurePage(reply);
						else
							status = printer->ConfigureJob(reply);

						if (status == B_OK)
							sender.SetReply(&reply);
					}
				} else {
					// If no default printer is set, give user
					// choice of aborting or setting up a printer
					int32 count = Printer::CountPrinters();
					BString alertText(
						B_TRANSLATE("There are no printers set up."));
					if (count > 0)
						alertText.SetTo(B_TRANSLATE(
							"There is no default printer set up."));

					alertText.Append(" ");
					alertText.Append(
						B_TRANSLATE("Would you like to set one up now?"));
					BAlert* alert = new BAlert("Info", alertText.String(),
						B_TRANSLATE("No"), B_TRANSLATE("Yes"));
					alert->SetShortcut(0, B_ESCAPE);
					if (alert->Go() == 1) {
						if (count == 0)
							run_add_printer_panel();
						else
							run_select_printer_panel();
					}
				}
			}	break;

			// Retrieve default configuration message from printer add-on
			case PSRV_GET_DEFAULT_SETTINGS: {
				if (printer) {
					BMessage reply;
					if (printer->GetDefaultSettings(reply) == B_OK) {
						sender.SetReply(&reply);
						break;
					}
				}
			}	break;

			// Create a new printer
			case PSRV_MAKE_PRINTER: {
				BString driverName;
				BString printerName;
				BString transportName;
				BString transportPath;
				if (msg->FindString("driver", &driverName) == B_OK
					&& msg->FindString("transport", &transportName) == B_OK
					&& msg->FindString("transport path", &transportPath) == B_OK
					&& msg->FindString("printer name", &printerName) == B_OK) {
					BString connection;
					if (msg->FindString("connection", &connection) != B_OK)
						connection = "Local";

					// then create the actual printer
					if (p->app->CreatePrinter(printerName.String(),
						driverName.String(), connection.String(),
						transportName.String(),
						transportPath.String()) == B_OK) {
						// If printer was created ok,
						// ask if it needs to be the default
						BString text(B_TRANSLATE("Would you like to make @ "
							"the default printer?"));
						text.ReplaceFirst("@", printerName.String());
						BAlert* alert = new BAlert("", text.String(),
							B_TRANSLATE("No"), B_TRANSLATE("Yes"));
						alert->SetShortcut(0, B_ESCAPE);
						if (alert->Go() == 1)
							p->app->SelectPrinter(printerName.String());
					}
				}
			}	break;
//.........这里部分代码省略.........
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:101,代码来源:PrintServerApp.R5.cpp


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