%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%% This file is generated DO NOT EDIT
%% @doc See external documentation: wxPrintout.
%% @type wxPrintout(). An object reference, The representation is internal
%% and can be changed without notice. It can't be used for comparsion
%% stored on disc or distributed for use on other nodes.
-module(wxPrintout).
-include("wxe.hrl").
-export([ new/2,new/3 ,destroy/1,fitThisSizeToPage/2,fitThisSizeToPageMargins/3,
fitThisSizeToPaper/2,getDC/1,getLogicalPageMarginsRect/2,getLogicalPageRect/1,
getLogicalPaperRect/1,getPPIPrinter/1,getPPIScreen/1,getPageSizeMM/1,
getPageSizePixels/1,getPaperRectPixels/1,getTitle/1,isPreview/1,mapScreenSizeToDevice/1,
mapScreenSizeToPage/1,mapScreenSizeToPageMargins/2,mapScreenSizeToPaper/1,
offsetLogicalOrigin/3,setLogicalOrigin/3]).
%% inherited exports
-export([parent_class/1]).
%% @hidden
parent_class(_Class) -> erlang:error({badtype, ?MODULE}).
%% @spec (Title::string(), OnPrintPage::function()) -> wxPrintout:wxPrintout()
%% @doc @equiv new(Title, OnPrintPage, [])
new(Title, OnPrintPage) ->
new(Title, OnPrintPage, []).
%% @spec (Title::string(), OnPrintPage::function(), [Option]) -> wxPrintout:wxPrintout()
%% Option = {onPreparePrinting, OnPreparePrinting::function()} |
%% {onBeginPrinting, OnBeginPrinting::function()} |
%% {onEndPrinting, OnEndPrinting::function()} |
%% {onBeginDocument, OnBeginDocument::function()} |
%% {onEndDocument, OnEndDocument::function()} |
%% {hasPage, HasPage::function()} |
%% {getPageInfo, GetPageInfo::function()}
%% @doc Creates a wxPrintout object with a callback fun and optionally other callback funs.
%%
OnPrintPage(This,Page) -> boolean()
%% OnPreparePrinting(This) -> term()
%% OnBeginPrinting(This) -> term()
%% OnEndPrinting(This) -> term()
%% OnBeginDocument(This,StartPage,EndPage) -> boolean()
%% OnEndDocument(This) -> term()
%% HasPage(This,Page)} -> boolean()
%% GetPageInfo(This) -> {MinPage:.integer(), MaxPage::integer(), PageFrom::integer(), PageTo::integer()}
%% The This argument is the wxPrintout object reference to this object
%%
NOTE: The callbacks may not call other processes.
new(Title, OnPrintPage, Opts) when is_list(Title), is_function(OnPrintPage), is_list(Opts) ->
OnPrint = fun([This,Page]) ->
Bool = OnPrintPage(This,Page),
<<(wxe_util:from_bool(Bool)):32/?UI>>
end,
OnPrintPageId = wxe_util:get_cbId(OnPrint),
MOpts = fun({onPreparePrinting, F},Acc) when is_function(F) ->
Fun = fun([This]) ->
F(This),
<<>>
end,
[<<1:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc];
({onBeginPrinting, F},Acc) when is_function(F) ->
Fun = fun([This]) ->
F(This),
<<>>
end,
[<<2:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc];
({onEndPrinting, F},Acc) when is_function(F) ->
Fun = fun([This]) ->
F(This),
<<>>
end,
[<<3:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc];
({onBeginDocument, F},Acc) when is_function(F) ->
Fun = fun([This,S,E]) ->
BegD = F(This,S,E),
<<(wxe_util:from_bool(BegD)):32/?UI>>
end,
[<<4:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc];
({onEndDocument, F},Acc) when is_function(F) ->
Fun = fun([This]) ->
F(This),
<<>>
end,
[<<5:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc];
({hasPage, F},Acc) when is_function(F) ->
Fun = fun([This,Page]) ->
HasP = F(This,Page),
<<(wxe_util:from_bool(HasP)):32/?UI>>
end,
[<<6:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc];
({getPageInfo, F},Acc) when is_function(F) ->
Fun = fun([This]) ->
{Min,Max,PF,PT} = F(This),
<>
end,
[<<7:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc]
end,
BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Opts)),
Title_UC = unicode:characters_to_binary([Title,0]),
wxe_util:call(?wxPrintout_new, << (byte_size(Title_UC)):32/?UI,Title_UC/binary,
0:(((8- ((4+byte_size(Title_UC)) band 16#7)) band 16#7))/unit:8,
OnPrintPageId:32/?UI,
BinOpt/binary>>).
%% @spec (This::wxPrintout()) -> wxDC:wxDC()
%% @doc See external documentation.
getDC(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetDC,
<>).
%% @spec (This::wxPrintout()) -> {W::integer(),H::integer()}
%% @doc See external documentation.
getPageSizeMM(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetPageSizeMM,
<>).
%% @spec (This::wxPrintout()) -> {W::integer(),H::integer()}
%% @doc See external documentation.
getPageSizePixels(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetPageSizePixels,
<>).
%% @spec (This::wxPrintout()) -> {X::integer(),Y::integer(),W::integer(),H::integer()}
%% @doc See external documentation.
getPaperRectPixels(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetPaperRectPixels,
<>).
%% @spec (This::wxPrintout()) -> {X::integer(),Y::integer()}
%% @doc See external documentation.
getPPIPrinter(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetPPIPrinter,
<>).
%% @spec (This::wxPrintout()) -> {X::integer(),Y::integer()}
%% @doc See external documentation.
getPPIScreen(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetPPIScreen,
<>).
%% @spec (This::wxPrintout()) -> string()
%% @doc See external documentation.
getTitle(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetTitle,
<>).
%% @spec (This::wxPrintout()) -> bool()
%% @doc See external documentation.
isPreview(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_IsPreview,
<>).
%% @spec (This::wxPrintout(), ImageSize::{W::integer(),H::integer()}) -> ok
%% @doc See external documentation.
fitThisSizeToPaper(#wx_ref{type=ThisT,ref=ThisRef},{ImageSizeW,ImageSizeH})
when is_integer(ImageSizeW),is_integer(ImageSizeH) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_FitThisSizeToPaper,
<>).
%% @spec (This::wxPrintout(), ImageSize::{W::integer(),H::integer()}) -> ok
%% @doc See external documentation.
fitThisSizeToPage(#wx_ref{type=ThisT,ref=ThisRef},{ImageSizeW,ImageSizeH})
when is_integer(ImageSizeW),is_integer(ImageSizeH) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_FitThisSizeToPage,
<>).
%% @spec (This::wxPrintout(), ImageSize::{W::integer(),H::integer()}, PageSetupData::wxPageSetupDialogData:wxPageSetupDialogData()) -> ok
%% @doc See external documentation.
fitThisSizeToPageMargins(#wx_ref{type=ThisT,ref=ThisRef},{ImageSizeW,ImageSizeH},#wx_ref{type=PageSetupDataT,ref=PageSetupDataRef})
when is_integer(ImageSizeW),is_integer(ImageSizeH) ->
?CLASS(ThisT,wxPrintout),
?CLASS(PageSetupDataT,wxPageSetupDialogData),
wxe_util:cast(?wxPrintout_FitThisSizeToPageMargins,
<>).
%% @spec (This::wxPrintout()) -> ok
%% @doc See external documentation.
mapScreenSizeToPaper(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_MapScreenSizeToPaper,
<>).
%% @spec (This::wxPrintout()) -> ok
%% @doc See external documentation.
mapScreenSizeToPage(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_MapScreenSizeToPage,
<>).
%% @spec (This::wxPrintout(), PageSetupData::wxPageSetupDialogData:wxPageSetupDialogData()) -> ok
%% @doc See external documentation.
mapScreenSizeToPageMargins(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=PageSetupDataT,ref=PageSetupDataRef}) ->
?CLASS(ThisT,wxPrintout),
?CLASS(PageSetupDataT,wxPageSetupDialogData),
wxe_util:cast(?wxPrintout_MapScreenSizeToPageMargins,
<>).
%% @spec (This::wxPrintout()) -> ok
%% @doc See external documentation.
mapScreenSizeToDevice(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_MapScreenSizeToDevice,
<>).
%% @spec (This::wxPrintout()) -> {X::integer(),Y::integer(),W::integer(),H::integer()}
%% @doc See external documentation.
getLogicalPaperRect(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetLogicalPaperRect,
<>).
%% @spec (This::wxPrintout()) -> {X::integer(),Y::integer(),W::integer(),H::integer()}
%% @doc See external documentation.
getLogicalPageRect(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxPrintout),
wxe_util:call(?wxPrintout_GetLogicalPageRect,
<>).
%% @spec (This::wxPrintout(), PageSetupData::wxPageSetupDialogData:wxPageSetupDialogData()) -> {X::integer(),Y::integer(),W::integer(),H::integer()}
%% @doc See external documentation.
getLogicalPageMarginsRect(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=PageSetupDataT,ref=PageSetupDataRef}) ->
?CLASS(ThisT,wxPrintout),
?CLASS(PageSetupDataT,wxPageSetupDialogData),
wxe_util:call(?wxPrintout_GetLogicalPageMarginsRect,
<>).
%% @spec (This::wxPrintout(), X::integer(), Y::integer()) -> ok
%% @doc See external documentation.
setLogicalOrigin(#wx_ref{type=ThisT,ref=ThisRef},X,Y)
when is_integer(X),is_integer(Y) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_SetLogicalOrigin,
<>).
%% @spec (This::wxPrintout(), Xoff::integer(), Yoff::integer()) -> ok
%% @doc See external documentation.
offsetLogicalOrigin(#wx_ref{type=ThisT,ref=ThisRef},Xoff,Yoff)
when is_integer(Xoff),is_integer(Yoff) ->
?CLASS(ThisT,wxPrintout),
wxe_util:cast(?wxPrintout_OffsetLogicalOrigin,
<>).
%% @spec (This::wxPrintout()) -> ok
%% @doc Destroys this object, do not use object again
destroy(Obj=#wx_ref{type=Type}) ->
?CLASS(Type,wxPrintout),
wxe_util:destroy(?DESTROY_OBJECT,Obj),
ok.