トップ 一覧 検索 ヘルプ ログイン

印刷の概要の変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
クラス: wxPrintout, wxPrinter, wxPrintPreview, wxPrinterDC, wxPrintDialog, wxPrintData, wxPrintDialogData, wxPageSetupDialog, wxPageSetupDialogData

'このページを印刷'、'ドキュメントの中にこのページが存在するか?'などといった、特別な要求に応じることができるメンバ関数を備えたクラスを提供するために、印刷フレームワークは、アプリケーションを使用する。この方法は、プレビューページを回転させる、印刷ダイアログボックスを呼ぶ、印刷デバイスコンテキストを作成する、などを監視するための義務をwxWidgetsに与える。:アプリケーションは、デバイスコンテキストへの情報の描写のみに集中することができる。

The document/view framework creates a default wxPrintout object for every view, calling wxView::OnDraw to achieve a prepackaged print/preview facility.
ドキュメント/ビューフレームワークは、デフォルトでビューごとにwxPrintoutオブジェクトを作成し、あらかじめ組み込まれた印刷/プレビュー機能を構築するために、wxView::OnDrawを呼ぶ。

A document's printing ability is represented in an application by a derived wxPrintout class. This class prints a page on request, and can be passed to the Print function of a wxPrinter object to actually print the document, or can be passed to a wxPrintPreview object to initiate previewing. The following code (from the printing sample) shows how easy it is to initiate printing, previewing and the print setup dialog, once the wxPrintout functionality has been defined. Notice the use of MyPrintout for both printing and previewing. All the preview user interface functionality is taken care of by wxWidgets. For details on how MyPrintout is defined, please look at the printout sample code.
ドキュメントの印刷能力は、アプリケーションの中で、wxPrintoutクラスの派生により表現される。このクラスは、要求に応じてページを印刷したり、実際にドキュメントを印刷するためにwxPrinterオブジェクトのPrint関数に渡されたり、プレビューの初期化のためにwxPrintPreviewオブジェクトに渡される。以下のコード(印刷サンプルより抜粋)は、一旦wxPrintout機能が定義されてしまえば、印刷、プレビュー、印刷設定ダイアログの初期化がいかに簡単かということを示している。注目すべきは、印刷とプレビューの両方で、MyPrintoutが使用されるということである。全てのプレビューユーザインタフェース機能は、wxWidgetsにより管理されている。MyPrintoutがどのように定義されているかは、印刷サンプルのコードを参照のこと。

 case WXPRINT_PRINT:
 {
   wxPrinter printer;
   MyPrintout printout("My printout");
   printer.Print(this, &printout, true);
   break;
 }
 case WXPRINT_PREVIEW:
 {
   // Pass two printout objects: for preview, and possible printing.
   // プレビューと印刷のために、2つのprintoutオブジェクトを渡す。
   wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout);
   wxPreviewFrame *frame = new wxPreviewFrame(
                                   preview, this, "Demo Print Preview", 
                                   wxPoint(100, 100), wxSize(600, 650));
   frame->Centre(wxBOTH);
   frame->Initialize();
   frame->Show(true);
   break;
 }