aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen/wx_extra
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/wx/api_gen/wx_extra
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/wx/api_gen/wx_extra')
-rw-r--r--lib/wx/api_gen/wx_extra/bugs.h36
-rw-r--r--lib/wx/api_gen/wx_extra/wxEvtHandler.c_src66
-rw-r--r--lib/wx/api_gen/wx_extra/wxEvtHandler.erl183
-rw-r--r--lib/wx/api_gen/wx_extra/wxListCtrl.c_src24
-rw-r--r--lib/wx/api_gen/wx_extra/wxListCtrl.erl39
-rw-r--r--lib/wx/api_gen/wx_extra/wxPrintout.c_src30
-rw-r--r--lib/wx/api_gen/wx_extra/wxPrintout.erl102
-rw-r--r--lib/wx/api_gen/wx_extra/wxXmlResource.c_src3
-rw-r--r--lib/wx/api_gen/wx_extra/wxXmlResource.erl43
-rw-r--r--lib/wx/api_gen/wx_extra/wxe_evth.h25
10 files changed, 551 insertions, 0 deletions
diff --git a/lib/wx/api_gen/wx_extra/bugs.h b/lib/wx/api_gen/wx_extra/bugs.h
new file mode 100644
index 0000000000..b8f3dfcb00
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/bugs.h
@@ -0,0 +1,36 @@
+
+// I have added this doxygen seems to get lost in some macros
+// in sashwin.h
+
+enum wxSashDragStatus
+ {
+ wxSASH_STATUS_OK,
+ wxSASH_STATUS_OUT_OF_RANGE
+ };
+
+// Macro needed in erlang
+class WXDLLIMPEXP_XRC wxXmlResource : public wxObject
+{
+ public:
+ wxObject xrcctrl(wxWindow *Window, wxString Name, wxString Type);
+};
+
+// The generater needs constructors
+class WXDLLIMPEXP_ADV wxGridCellBoolRenderer : public wxGridCellRenderer
+{
+ public:
+ wxGridCellBoolRenderer();
+};
+
+class WXDLLIMPEXP_ADV wxGridCellStringRenderer : public wxGridCellRenderer
+{
+ public:
+ wxGridCellStringRenderer();
+};
+
+class WXDLLIMPEXP_ADV wxGridCellNumberRenderer : public wxGridCellStringRenderer
+{
+ public:
+ wxGridCellNumberRenderer();
+};
+
diff --git a/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src b/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src
new file mode 100644
index 0000000000..4e492db045
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src
@@ -0,0 +1,66 @@
+case 98: { // wxeEvtListener::wxeEvtListener
+ wxeEvtListener *Result = new wxeEvtListener(Ecmd.port);
+ rt.addRef(getRef((void *)Result,memenv), "wxeEvtListener");
+ break;
+}
+case 99: { // wxeEvtListener::destroy
+ wxObject *This = (wxObject *) getPtr(bp,memenv);
+ rt.addAtom("ok");
+ delete This;
+ break;
+}
+
+case 100: { // wxEvtHandler::Connect
+ wxeEvtListener *Listener = (wxeEvtListener *) getPtr(bp,memenv); bp += 4;
+ wxEvtHandler *This = (wxEvtHandler *) getPtr(bp, memenv); bp += 4;
+ int * winid = (int *) bp; bp += 4;
+ int * lastId = (int *) bp; bp += 4;
+ int * skip = (int *) bp; bp += 4;
+ int * haveUserData = (int *) bp; bp += 4;
+ wxeErlTerm * userData = NULL;
+ int * fun_cb = (int *) bp; bp += 4;
+ int * eventTypeLen = (int *) bp; bp += 4;
+ int * class_nameLen = (int *) bp; bp += 4;
+
+ if(*haveUserData) {
+ userData = new wxeErlTerm(Ecmd.bin[0]);
+ }
+
+ int eventType = wxeEventTypeFromAtom(bp); bp += *eventTypeLen;
+ char *class_name = bp; bp+= *class_nameLen;
+ if(eventType > 0 ) {
+ wxeCallbackData * Evt_cb = new wxeCallbackData(Ecmd.caller,(void *) This,
+ class_name,*fun_cb,
+ *skip, userData);
+ This->Connect((int) *winid,(int) *lastId,eventType,
+ (wxObjectEventFunction)(wxEventFunction) &wxeEvtListener::forward,
+ Evt_cb, Listener);
+ rt.addAtom("ok");
+ } else {
+ rt.addAtom("badarg");
+ rt.addAtom("event_type");
+ rt.addTupleCount(2);
+ }
+ break;
+}
+case 101: { // wxEvtHandler::Disconnect
+ wxeEvtListener *Listener = (wxeEvtListener *) getPtr(bp,memenv); bp += 4;
+ wxEvtHandler *This = (wxEvtHandler *) getPtr(bp, memenv); bp += 4;
+ int * winid = (int *) bp; bp += 4;
+ int * lastId = (int *) bp; bp += 4;
+ int * eventTypeLen = (int *) bp; bp += 4;
+
+ int eventType = wxeEventTypeFromAtom(bp); bp += *eventTypeLen;
+ if(eventType > 0) {
+ bool Result = This->Disconnect((int) *winid,(int) *lastId,eventType,
+ (wxObjectEventFunction)(wxEventFunction)
+ &wxeEvtListener::forward,
+ NULL, Listener);
+ rt.addBool(Result);
+ } else {
+ rt.addAtom("badarg");
+ rt.addAtom("event_type");
+ rt.addTupleCount(2);
+ }
+ break;
+}
diff --git a/lib/wx/api_gen/wx_extra/wxEvtHandler.erl b/lib/wx/api_gen/wx_extra/wxEvtHandler.erl
new file mode 100644
index 0000000000..c6810eb32c
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxEvtHandler.erl
@@ -0,0 +1,183 @@
+%% This module is actually handwritten see ../api_gen/wx_extra/wxEvtHandler.erl
+%%
+%% @doc The Event handler.
+%%
+%% To get events from wxwidgets objects you subscribe to them by
+%% calling connect/[2-3]. Events are sent as messages, if no callback
+%% was supplied These messages will be {@link wx(). #wx{}} where
+%% EventRecord is a record that depends on the {@link
+%% wxEventType(). event type}. The records are defined in:
+%% wx/include/wx.hrl.
+%%
+%% If a callback was supplied to connect, the callback will be invoked
+%% (in another process) to handle the event. The callback should be of
+%% arity 2. fun(EventRecord::wx(), EventObject::wxObject()).
+%%
+%% Beware that the callback will be in executed in new process each time.
+%%
+%% <a href="http://www.wxwidgets.org/manuals/stable/wx_wxevthandler.html">
+%% The orginal documentation</a>.
+%%
+%% @headerfile "../../include/wx.hrl"
+%%
+%%@type wxEvtHandler(). An object reference
+
+-module(wxEvtHandler).
+-include("wxe.hrl").
+-include("../include/wx.hrl").
+
+%% API
+-export([connect/2, connect/3, disconnect/1, disconnect/2, disconnect/3]).
+
+%% internal exports
+-export([connect_impl/3, disconnect_impl/2, disconnect_impl/3,
+ new_evt_listener/0, destroy_evt_listener/1,
+ get_callback/1, replace_fun_with_id/2]).
+
+-record(evh, {et=null,id=?wxID_ANY,lastId=?wxID_ANY,skip=undefined,userdata=[],cb=0}).
+
+
+
+%% @spec (This::wxEvtHandler(), EventType::wxEventType()) -> ok
+%% @doc Equivalent to {@link connect/3. connect(This, EventType, [])}
+
+connect(This, EventType) ->
+ connect(This, EventType, []).
+
+%% @spec (This::wxEvtHandler(), EventType::wxEventType(), [Options]) -> ok
+%% @doc This function subscribes the to events of EventType,
+%% in the range id, lastId. The events will be received as messages
+%% if no callback is supplied.
+%%
+%% Options:
+%% {id, integer()}, The identifier (or first of the identifier range) to be
+%% associated with this event handler.
+%% Default ?wxID_ANY
+%% {lastId, integer()}, The second part of the identifier range.
+%% If used 'id' must be set as the starting identifier range.
+%% Default ?wxID_ANY
+%% {skip, boolean()}, If skip is true further event_handlers will be called.
+%% This is not used if the 'callback' option is used.
+%% Default false.
+%% {callback, function()} Use a callback fun(EventRecord::wx(), EventObject::wxObject())
+%% to process the event. Default not specfied i.e. a message will
+%% be delivered to the process calling this function.
+%% {userData, term()} An erlang term that will be sent with the event. Default: [].
+connect(This=#wx_ref{type=ThisT}, EventType, Options) ->
+ EvH = parse_opts(Options, #evh{et=EventType}),
+ ?CLASS(ThisT,wxEvtHandler),
+ case wxe_util:connect_cb(This, EvH) of
+ ok -> ok;
+ {badarg, event_type} ->
+ erlang:error({badarg,EventType})
+ end.
+
+parse_opts([{callback,Fun}|R], Opts) when is_function(Fun) ->
+ %% Check Fun Arity?
+ parse_opts(R, Opts#evh{cb=Fun});
+parse_opts([callback|R], Opts) ->
+ parse_opts(R, Opts#evh{cb=1});
+parse_opts([{userData, UserData}|R],Opts) ->
+ parse_opts(R, Opts#evh{userdata=UserData});
+parse_opts([{skip, Skip}|R],Opts) when is_boolean(Skip) ->
+ parse_opts(R, Opts#evh{skip=Skip});
+parse_opts([{id, Id}|R],Opts) when is_integer(Id) ->
+ parse_opts(R, Opts#evh{id=Id});
+parse_opts([{lastId, Id}|R],Opts) when is_integer(Id) ->
+ parse_opts(R, Opts#evh{lastId=Id});
+parse_opts([_BadArg|R], Opts) ->
+ parse_opts(R, Opts);
+parse_opts([], Opts = #evh{id=Id,lastId=Lid,skip=Skip, cb=CB}) ->
+ if
+ Skip =/= undefined andalso CB =/= 0 ->
+ erlang:error({badarg, {combined, skip, callback}});
+ Lid =/= ?wxID_ANY andalso Id =:= ?wxID_ANY ->
+ erlang:error({badarg, no_start_identifier_range});
+ Skip =:= undefined -> %% Default
+ Opts#evh{skip=false};
+ true ->
+ Opts
+ end.
+
+%% @spec (This::wxEvtHandler()) -> true | false
+%% @doc Equivalent to {@link disconnect/3. disconnect(This, null, [])}
+%% Can also have an optional callback Fun() as an additional last argument.
+
+disconnect(This=#wx_ref{type=ThisT,ref=_ThisRef}) ->
+ ?CLASS(ThisT,wxEvtHandler),
+ disconnect(This, null, []).
+
+%% @spec (This::wxEvtHandler(), EventType::wxEventType()) -> true | false
+%% @doc Equivalent to {@link disconnect/3. disconnect(This, EventType, [])}
+disconnect(This=#wx_ref{type=ThisT,ref=_ThisRef}, EventType) when is_atom(EventType) ->
+ ?CLASS(ThisT,wxEvtHandler),
+ disconnect(This, EventType, []).
+
+%% @spec (This::wxEvtHandler(), EventType::wxEventType(), Opts) -> true | false
+%% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxevthandler.html#wxevthandlerdisconnect">external documentation</a>
+%% This function unsubscribes the process or callback fun from the event handler.
+%% EventType may be the atom 'null' to match any eventtype.
+%% Notice that the options skip and userdata is not used to match the eventhandler.
+disconnect(This=#wx_ref{type=ThisT,ref=_ThisRef}, EventType, Opts) ->
+ ?CLASS(ThisT,wxEvtHandler),
+ EvH = parse_opts(Opts, #evh{et=EventType}),
+ case wxe_util:disconnect_cb(This, EvH) of
+ {badarg, event_type} ->
+ erlang:error({badarg,EventType});
+ Bool ->
+ Bool
+ end.
+
+
+%% @hidden
+connect_impl(#wx_ref{type=wxeEvtListener,ref=EvtList},
+ #wx_ref{type=ThisT,ref=ThisRef},
+ #evh{id=Winid, lastId=LastId, et=EventType,
+ skip=Skip, userdata=Userdata, cb=FunID})
+ when is_integer(FunID)->
+ EventTypeBin = list_to_binary([atom_to_list(EventType)|[0]]),
+ ThisTypeBin = list_to_binary([atom_to_list(ThisT)|[0]]),
+ UD = if Userdata =:= [] -> 0;
+ true ->
+ wxe_util:send_bin(term_to_binary(Userdata)),
+ 1
+ end,
+ wxe_util:call(100, <<EvtList:32/?UI,ThisRef:32/?UI,
+ Winid:32/?UI,LastId:32/?UI,
+ (wxe_util:from_bool(Skip)):32/?UI,
+ UD:32/?UI,
+ FunID:32/?UI,
+ (size(EventTypeBin)):32/?UI,
+ (size(ThisTypeBin)):32/?UI,
+ %% Note no alignment
+ EventTypeBin/binary,ThisTypeBin/binary>>).
+
+%% @hidden
+disconnect_impl(Listener, Object) ->
+ disconnect_impl(Listener, Object, #evh{}).
+%% @hidden
+disconnect_impl(#wx_ref{type=wxeEvtListener,ref=EvtList},
+ #wx_ref{type=_ThisT,ref=ThisRef},
+ #evh{id=Winid, lastId=LastId, et=EventType}) ->
+ EventTypeBin = list_to_binary([atom_to_list(EventType)|[0]]),
+ wxe_util:call(101, <<EvtList:32/?UI,
+ ThisRef:32/?UI,Winid:32/?UI,LastId:32/?UI,
+ (size(EventTypeBin)):32/?UI,
+ %% Note no alignment
+ EventTypeBin/binary>>).
+
+%% @hidden
+new_evt_listener() ->
+ wxe_util:call(98, <<>>).
+
+%% @hidden
+destroy_evt_listener(#wx_ref{type=wxeEvtListener,ref=EvtList}) ->
+ wxe_util:call(99, <<EvtList:32/?UI>>).
+
+%% @hidden
+get_callback(#evh{cb=Callback}) ->
+ Callback.
+
+%% @hidden
+replace_fun_with_id(Evh, Id) ->
+ Evh#evh{cb=Id}.
diff --git a/lib/wx/api_gen/wx_extra/wxListCtrl.c_src b/lib/wx/api_gen/wx_extra/wxListCtrl.c_src
new file mode 100644
index 0000000000..cd3074e481
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxListCtrl.c_src
@@ -0,0 +1,24 @@
+<<SortItems
+case ~s: { // wxListCtrl::SortItems taylormade
+ wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4;
+ int sortCallback=*(int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+
+ callbackInfo* cb = new callbackInfo();
+ cb->port = Ecmd.port;
+ cb->callbackID = sortCallback;
+ bool Result = This->SortItems(wxEListCtrlCompare, (long)cb);
+ delete cb;
+
+ /* Destroy the callback, see wxEPrintout::clear_cb */
+ wxeReturn cbrt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
+ // NOTE: Remove this later when changing from funs to gen_server
+ cbrt.addAtom("wx_delete_cb");
+ cbrt.addInt(sortCallback);
+ cbrt.addTupleCount(2);
+ cbrt.send();
+
+ rt.addBool(Result);
+ break;
+}
+SortItems>>
diff --git a/lib/wx/api_gen/wx_extra/wxListCtrl.erl b/lib/wx/api_gen/wx_extra/wxListCtrl.erl
new file mode 100644
index 0000000000..e6470182cb
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxListCtrl.erl
@@ -0,0 +1,39 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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%
+%%
+<<EXPORT:SortItems sortItems/2 SortItems:EXPORT>>
+
+<<SortItems
+%% @spec (This::wxListCtrl(), SortCallBack::function()) -> boolean()
+%% @doc Sort the items in the list control<br />
+%% <pre>SortCalBack(Item1,Item2) -> integer()</pre>
+%% <br /> SortCallBack receives the client data associated with two items
+%% to compare, and should return 0 if the items are equal, a negative
+%% value if the first item is less than the second one and a positive
+%% value if the first item is greater than the second one.
+%% <br /> NOTE: The callback may not call other processes.
+sortItems(#wx_ref{type=ThisT,ref=ThisRef}, SortCallBack)
+ when is_function(SortCallBack, 2) ->
+ ?CLASS(ThisT,wxListCtrl),
+ Sort = fun([Item1,Item2]) ->
+ Result = SortCallBack(Item1,Item2),
+ <<Result:32/?UI>>
+ end,
+ SortId = wxe_util:get_cbId(Sort),
+ wxe_util:call(~s, <<ThisRef:32/?UI,SortId:32/?UI>>).
+SortItems>>
diff --git a/lib/wx/api_gen/wx_extra/wxPrintout.c_src b/lib/wx/api_gen/wx_extra/wxPrintout.c_src
new file mode 100644
index 0000000000..c088a95e73
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxPrintout.c_src
@@ -0,0 +1,30 @@
+<<wxPrintout
+case ~s: { // wxPrintout::wxPrintout taylormade
+ int onPreparePrinting=0,onBeginPrinting=0,onEndPrinting=0,onBeginDocument=0,
+ onEndDocument=0,hasPage=0,getPageInfo=0;
+ int * titleLen = (int *) bp; bp += 4;
+ wxString title = wxString(bp, wxConvUTF8);
+ bp += *titleLen+((8-((4+ *titleLen) & 7)) & 7);
+ int onPrintPage=*(int *) bp; bp += 4;
+ while( * (int*) bp) {
+ switch (* (int*) bp) {
+ case 1: {bp += 4; onPreparePrinting = *(int *) bp; bp += 4;} break;
+ case 2: {bp += 4; onBeginPrinting = *(int *) bp; bp += 4;} break;
+ case 3: {bp += 4; onEndPrinting = *(int *) bp; bp += 4;} break;
+ case 4: {bp += 4; onBeginDocument = *(int *) bp; bp += 4;} break;
+ case 5: {bp += 4; onEndDocument = *(int *) bp; bp += 4;} break;
+ case 6: {bp += 4; hasPage = *(int *) bp; bp += 4;} break;
+ case 7: {bp += 4; getPageInfo = *(int *) bp; bp += 4;} break;
+ }
+ }
+ wxEPrintout *Result = new wxEPrintout(title,onPrintPage,
+ onPreparePrinting,
+ onBeginPrinting,onEndPrinting,
+ onBeginDocument,onEndDocument,
+ hasPage,getPageInfo, Ecmd.port);
+
+ rt.addRef(getRef((void *)Result,memenv), "wxPrintout");
+ break;
+}
+wxPrintout>>
+
diff --git a/lib/wx/api_gen/wx_extra/wxPrintout.erl b/lib/wx/api_gen/wx_extra/wxPrintout.erl
new file mode 100644
index 0000000000..be8f2e2fa5
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxPrintout.erl
@@ -0,0 +1,102 @@
+%%
+%% %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%
+%%
+<<EXPORT:wxPrintout new/2,new/3 wxPrintout:EXPORT>>
+
+<<wxPrintout
+%% @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.<br />
+%% <pre>OnPrintPage(This,Page) -> boolean() </pre>
+%% <pre>OnPreparePrinting(This) -> term() </pre>
+%% <pre>OnBeginPrinting(This) -> term() </pre>
+%% <pre>OnEndPrinting(This) -> term() </pre>
+%% <pre>OnBeginDocument(This,StartPage,EndPage) -> boolean() </pre>
+%% <pre>OnEndDocument(This) -> term() </pre>
+%% <pre>HasPage(This,Page)} -> boolean() </pre>
+%% <pre>GetPageInfo(This) -> {MinPage:.integer(), MaxPage::integer(), PageFrom::integer(), PageTo::integer()} </pre>
+%% The <b>This</b> argument is the wxPrintout object reference to this object
+%% <br /> 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),
+ <<Min:32/?UI,Max:32/?UI,PF:32/?UI,PT:32/?UI>>
+ 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(~s, << (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>>).
+
+wxPrintout>>
diff --git a/lib/wx/api_gen/wx_extra/wxXmlResource.c_src b/lib/wx/api_gen/wx_extra/wxXmlResource.c_src
new file mode 100644
index 0000000000..152e83fe32
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxXmlResource.c_src
@@ -0,0 +1,3 @@
+<<xrcctrl
+// XRCTRL macro implemented in erlang funcid ~s
+xrcctrl>> \ No newline at end of file
diff --git a/lib/wx/api_gen/wx_extra/wxXmlResource.erl b/lib/wx/api_gen/wx_extra/wxXmlResource.erl
new file mode 100644
index 0000000000..cd2bea6a1d
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxXmlResource.erl
@@ -0,0 +1,43 @@
+
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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%
+%%
+<<EXPORT:xrcctrl xrcctrl/3 xrcctrl:EXPORT>>
+
+<<xrcctrl
+%% @spec (Window::wxWindow:wxWindow(),Name::string(), Type::atom()) -> wx:wxObject()
+
+%% @doc Looks up a control with Name in a window created with XML
+%% resources. You can use it to set/get values from controls.
+%% The object is type casted to <b>Type</b>.
+%% Example: <br />
+%% Xrc = wxXmlResource:get(), <br />
+%% Dlg = wxDialog:new(), <br />
+%% true = wxXmlResource:loadDialog(Xrc, Dlg, Frame, "controls_dialog"), <br />
+%% LCtrl = xrcctrl(Dlg, "controls_listctrl", wxListCtrl), <br />
+%% wxListCtrl:insertColumn(LCtrl, 0, "Name", [{width, 200}]), <br />
+
+xrcctrl(Window = #wx_ref{}, Name, Type) when is_list(Name), is_atom(Type) ->
+ %% Func Id ~s
+ ID = wxXmlResource:getXRCID(Name),
+ Res = wxWindow:findWindow(Window,ID),
+ wx:typeCast(Res, Type).
+
+xrcctrl>>
+
+
diff --git a/lib/wx/api_gen/wx_extra/wxe_evth.h b/lib/wx/api_gen/wx_extra/wxe_evth.h
new file mode 100644
index 0000000000..9af603b9e2
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/wxe_evth.h
@@ -0,0 +1,25 @@
+
+// This add some extra functions, special code is in the compiler
+// this file is currently not used at all except to get the inherited
+// functions in the erlang modules.
+
+
+class wxeEvtHandler : public wxObject
+{
+ public:
+ // Dynamic association of a member function handler with the event handler,
+ // winid and event type
+ void Connect(int eventType,
+ int options = -1);
+
+ // Disconnect
+
+ // Convenience function: take just one id
+ void Disconnect(int eventType, int winid = -1);
+
+ // Even more convenient: without id (same as using id of wxID_ANY)
+ void Disconnect(int eventType);
+
+ void Disconnect();
+
+}