檢視原始碼 wxPrinter (wx v2.4.3)

此類別代表 Windows 或 PostScript 印表機,並且是應用程式啟動列印的媒介。

列印也可以透過使用較底層的函式和類別來實現,但這個類別及其相關類別提供了更方便且通用的列印方法。

參見

wxWidgets 文件: wxPrinter

摘要

函式

建立預設的列印中止視窗,帶有一個取消按鈕。

銷毀物件

如果使用者已中止列印作業,則返回 true。

返回最後的錯誤。

返回與印表機物件相關聯的列印資料。

等同於 new([])

建構函式。

開始列印程序。

調用列印對話方塊。

預設的錯誤回報函式。

調用列印設定對話方塊。

型別

-type wxPrinter() :: wx:wx_object().

函式

連結到此函式

createAbortWindow(This, Parent, Printout)

檢視原始碼
-spec createAbortWindow(This, Parent, Printout) -> wxDialog:wxDialog()
                           when
                               This :: wxPrinter(),
                               Parent :: wxWindow:wxWindow(),
                               Printout :: wxPrintout:wxPrintout().

建立預設的列印中止視窗,帶有一個取消按鈕。

-spec destroy(This :: wxPrinter()) -> ok.

銷毀物件

-spec getAbort(This) -> boolean() when This :: wxPrinter().

如果使用者已中止列印作業,則返回 true。

-spec getLastError() -> wx:wx_enum().

返回最後的錯誤。

在呼叫 print/4printDialog/2wxPrintPreview:print/2 之後有效。

如果沒有發生錯誤,這些函式會將最後的錯誤設定為 wxPRINTER_NO_ERROR

返回值為以下其中之一

連結到此函式

getPrintDialogData(This)

檢視原始碼
-spec getPrintDialogData(This) -> wxPrintDialogData:wxPrintDialogData() when This :: wxPrinter().

返回與印表機物件相關聯的列印資料。

-spec new() -> wxPrinter().

等同於 new([])

-spec new([Option]) -> wxPrinter() when Option :: {data, wxPrintDialogData:wxPrintDialogData()}.

建構函式。

傳遞一個指向列印對話方塊資料區塊的可選指標,該指標將被複製到印表機物件的本機資料中。

參見

連結到此函式

print(This, Parent, Printout)

檢視原始碼
-spec print(This, Parent, Printout) -> boolean()
               when
                   This :: wxPrinter(),
                   Parent :: wxWindow:wxWindow(),
                   Printout :: wxPrintout:wxPrintout().

等同於 print(This, Parent, Printout, [])

-spec print(This, Parent, Printout, [Option]) -> boolean()
               when
                   This :: wxPrinter(),
                   Parent :: wxWindow:wxWindow(),
                   Printout :: wxPrintout:wxPrintout(),
                   Option :: {prompt, boolean()}.

開始列印程序。

提供一個父視窗、一個使用者定義的 wxPrintout 物件,該物件控制文件的列印,以及是否應先調用列印對話方塊。

如果初始化印表機裝置內容時出現問題(例如,未設定當前印表機)或使用者取消了列印,則 print/4 可能會返回 false。請呼叫 getLastError/0 以取得有關錯誤種類的詳細資訊。

連結到此函式

printDialog(This, Parent)

檢視原始碼
-spec printDialog(This, Parent) -> wxDC:wxDC() when This :: wxPrinter(), Parent :: wxWindow:wxWindow().

調用列印對話方塊。

如果成功(使用者未按「取消」且未發生錯誤),則會返回適當的裝置內容;否則返回 NULL;呼叫 getLastError/0 以取得有關錯誤種類的詳細資訊。

請注意:應用程式必須刪除此裝置內容,以避免記憶體洩漏。

連結到此函式

reportError(This, Parent, Printout, Message)

檢視原始碼
-spec reportError(This, Parent, Printout, Message) -> ok
                     when
                         This :: wxPrinter(),
                         Parent :: wxWindow:wxWindow(),
                         Printout :: wxPrintout:wxPrintout(),
                         Message :: unicode:chardata().

預設的錯誤回報函式。

-spec setup(This, Parent) -> boolean() when This :: wxPrinter(), Parent :: wxWindow:wxWindow().

調用列印設定對話方塊。

已過時

設定對話方塊已過時,但為了向後相容性而保留。