本文整理汇总了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;
//.........这里部分代码省略.........