diff options
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r-- | lib/wx/api_gen/Makefile | 27 | ||||
-rw-r--r-- | lib/wx/api_gen/gen_util.erl | 67 | ||||
-rw-r--r-- | lib/wx/api_gen/gl_gen.erl | 35 | ||||
-rw-r--r-- | lib/wx/api_gen/gl_gen_c.erl | 23 | ||||
-rw-r--r-- | lib/wx/api_gen/gl_gen_erl.erl | 37 | ||||
-rw-r--r-- | lib/wx/api_gen/gl_scan_doc.erl | 21 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_doxygen.conf | 4 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/added_func.h | 41 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/bugs.h | 10 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxEvtHandler.c_src | 48 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxEvtHandler.erl | 58 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxListCtrl.c_src | 23 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxListCtrl.erl | 21 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxPrintout.erl | 23 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxTreeCtrl.c_src | 21 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/wxXmlResource.erl | 23 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 74 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen.hrl | 21 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 280 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_erl.erl | 95 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 235 |
21 files changed, 734 insertions, 453 deletions
diff --git a/lib/wx/api_gen/Makefile b/lib/wx/api_gen/Makefile index 8adb485ba9..e3580de2d5 100644 --- a/lib/wx/api_gen/Makefile +++ b/lib/wx/api_gen/Makefile @@ -1,18 +1,19 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2008-2012. All Rights Reserved. +# Copyright Ericsson AB 2008-2016. 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. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% # @@ -48,7 +49,7 @@ opt: $(WX) $(GL) $(WX): wxxml_generated $(COMPILER_T) wxapi.conf $(wildcard wx_extra/wx*.c_src) $(wildcard wx_extra/wx*.erl) erl -noshell -run wx_gen code && touch wx_code_generated -wxxml_generated: wx_doxygen.conf wx_extra/bugs.h wx_extra/wxe_evth.h +wxxml_generated: wx_doxygen.conf wx_extra/bugs.h wx_extra/wxe_evth.h wx_extra/added_func.h sed -e 's|@WXGTK_DIR@|$(WXGTK_DIR)|g' wx_doxygen.conf > wx_doxygen doxygen wx_doxygen && touch wxxml_generated @@ -60,7 +61,7 @@ $(GL): glxml_generated $(GL_COMP_T) glapi.conf erl -noshell -run gl_gen code && touch gl_code_generated %.beam: %.erl wx_gen.hrl gl_gen.hrl - $(ERLC) -W $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) $< -o$(EBIN) + $(ERLC) -W $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # TODO split cleans into separate targets? complete_clean: diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl index 2ba1c6e16f..cd42ad2d96 100644 --- a/lib/wx/api_gen/gen_util.erl +++ b/lib/wx/api_gen/gen_util.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -222,41 +223,45 @@ halt(Reason) -> erl_copyright() -> StartYear = start_year(get(current_class)), + {CurrentYear,_,_} = erlang:date(), w("%%~n",[]), w("%% %CopyrightBegin%~n",[]), w("%%~n",[]), - w("%% Copyright Ericsson AB ~p-2013. All Rights Reserved.~n", - [StartYear]), + w("%% Copyright Ericsson AB ~p-~p. All Rights Reserved.~n", + [StartYear, CurrentYear]), + w("%%~n",[]), + w("%% Licensed under the Apache License, Version 2.0 (the \"License\");~n",[]), + w("%% you may not use this file except in compliance with the License.~n",[]), + w("%% You may obtain a copy of the License at~n",[]), w("%%~n",[]), - w("%% The contents of this file are subject to the Erlang Public License,~n",[]), - w("%% Version 1.1, (the \"License\"); you may not use this file except in~n",[]), - w("%% compliance with the License. You should have received a copy of the~n",[]), - w("%% Erlang Public License along with this software. If not, it can be~n",[]), - w("%% retrieved online at http://www.erlang.org/.~n",[]), + w("%% http://www.apache.org/licenses/LICENSE-2.0~n",[]), w("%%~n",[]), - w("%% Software distributed under the License is distributed on an \"AS IS\"~n",[]), - w("%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See~n",[]), - w("%% the License for the specific language governing rights and limitations~n",[]), - w("%% under the License.~n",[]), + w("%% Unless required by applicable law or agreed to in writing, software~n",[]), + w("%% distributed under the License is distributed on an \"AS IS\" BASIS,~n",[]), + w("%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.~n",[]), + w("%% See the License for the specific language governing permissions and~n",[]), + w("%% limitations under the License.~n",[]), w("%%~n",[]), w("%% %CopyrightEnd%~n",[]). c_copyright() -> + {CurrentYear,_,_} = erlang:date(), w("/*~n",[]), w(" * %CopyrightBegin%~n",[]), w(" *~n",[]), - w(" * Copyright Ericsson AB 2008-2013. All Rights Reserved.~n",[]), + w(" * Copyright Ericsson AB 2008-~p. All Rights Reserved.~n",[CurrentYear]), + w(" *~n",[]), + w(" * Licensed under the Apache License, Version 2.0 (the \"License\");~n",[]), + w(" * you may not use this file except in compliance with the License.~n",[]), + w(" * You may obtain a copy of the License at~n",[]), w(" *~n",[]), - w(" * The contents of this file are subject to the Erlang Public License,~n",[]), - w(" * Version 1.1, (the \"License\"); you may not use this file except in~n",[]), - w(" * compliance with the License. You should have received a copy of the~n",[]), - w(" * Erlang Public License along with this software. If not, it can be~n",[]), - w(" * retrieved online at http://www.erlang.org/.~n",[]), + w(" * http://www.apache.org/licenses/LICENSE-2.0~n",[]), w(" *~n",[]), - w(" * Software distributed under the License is distributed on an \"AS IS\"~n",[]), - w(" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See~n",[]), - w(" * the License for the specific language governing rights and limitations~n",[]), - w(" * under the License.~n",[]), + w(" * Unless required by applicable law or agreed to in writing, software~n",[]), + w(" * distributed under the License is distributed on an \"AS IS\" BASIS,~n",[]), + w(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.~n",[]), + w(" * See the License for the specific language governing permissions and~n",[]), + w(" * limitations under the License.~n",[]), w(" *~n",[]), w(" * %CopyrightEnd% ~n",[]), w("*/~n",[]). diff --git a/lib/wx/api_gen/gl_gen.erl b/lib/wx/api_gen/gl_gen.erl index ea967c958f..54635bdd2e 100644 --- a/lib/wx/api_gen/gl_gen.erl +++ b/lib/wx/api_gen/gl_gen.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -190,8 +191,9 @@ parse_define([#xmlElement{name=initializer,content=Contents}|_R],Def,_Os) -> try case Val0 of "0x" ++ Val1 -> - _ = http_util:hexlist_to_integer(Val1), - Def#def{val=Val1, type=hex}; + Val2 = strip_type_cast(Val1), + _ = list_to_integer(Val2, 16), + Def#def{val=Val2, type=hex}; _ -> Val = list_to_integer(Val0), Def#def{val=Val, type=int} @@ -213,6 +215,15 @@ extract_def2([#xmlElement{content=Cs}|R]) -> extract_def2(Cs) ++ extract_def2(R); extract_def2([]) -> []. +strip_type_cast(Int) -> + lists:reverse(strip_type_cast2(lists:reverse(Int))). + +strip_type_cast2("u"++Rest) -> Rest; %% unsigned +strip_type_cast2("lu"++Rest) -> Rest; %% unsigned long +strip_type_cast2("llu"++Rest) -> Rest; %% unsigned long long +strip_type_cast2(Rest) -> Rest. + + strip_comment("/*" ++ Rest) -> strip_comment_until_end(Rest); strip_comment("//" ++ _) -> []; diff --git a/lib/wx/api_gen/gl_gen_c.erl b/lib/wx/api_gen/gl_gen_c.erl index be2c5cf2bf..c6d4f3a520 100644 --- a/lib/wx/api_gen/gl_gen_c.erl +++ b/lib/wx/api_gen/gl_gen_c.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2011. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -242,7 +243,7 @@ decode_arg(P=#arg{name=Name,type=#type{name=Type,base=guard_int}},A0) -> {P, A}; decode_arg(P=#arg{name=Name,type=#type{name=Type,base=string,single=true}},A0) -> w(" ~s *~s = (~s *) bp;~n", [Type,Name,Type]), - w(" int ~sLen[1] = {strlen((char *)~s)}; bp += ~sLen[0]+1+((8-((1+~sLen[0]+~p)%8))%8);~n", + w(" int ~sLen[1] = {(int)strlen((char *)~s)}; bp += ~sLen[0]+1+((8-((1+~sLen[0]+~p)%8))%8);~n", [Name,Name,Name,Name,A0]), {P, 0}; decode_arg(P=#arg{name=Name, diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index 446521098e..1be8d775be 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -91,7 +92,6 @@ types() -> gl_api(Fs) -> open_write("../src/gen/gl.erl", [{encoding,utf8}]), - w("%% -*- coding: utf-8 -*-~n~n", []), erl_copyright(), w("~n%% OPENGL API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), @@ -150,7 +150,6 @@ gl_api(Fs) -> glu_api(Fs) -> open_write("../src/gen/glu.erl", [{encoding,utf8}]), - w("%% -*- coding: utf-8 -*-~n~n", []), erl_copyright(), w("~n%% OPENGL UTILITY API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), @@ -227,10 +226,14 @@ gen_types(Where) -> w("-type clamp() :: float(). %% 0.0..1.0~n", []), w("-type offset() :: non_neg_integer(). %% Offset in memory block~n", []) end, - w("-type matrix() :: {float(),float(),float(),float(),~n", []), + w("-type matrix12() :: {float(),float(),float(),float(),~n", []), + w(" float(),float(),float(),float(),~n", []), + w(" float(),float(),float(),float()}.~n", []), + w("-type matrix16() :: {float(),float(),float(),float(),~n", []), w(" float(),float(),float(),float(),~n", []), w(" float(),float(),float(),float(),~n", []), w(" float(),float(),float(),float()}.~n", []), + w("-type matrix() :: matrix12() | matrix16().~n", []), w("-type mem() :: binary() | tuple(). %% Memory block~n", []), ok. @@ -460,7 +463,7 @@ doc_return_types(T, Ps0) -> Ps = [P || P=#arg{in=In, where=Where} <- Ps0,In =/= true, Where =/= c], doc_return_types2(T, Ps). -doc_return_types2(void, []) -> "ok"; +doc_return_types2(void, []) -> "'ok'"; doc_return_types2(void, [#arg{type=T}]) -> doc_arg_type2(T); doc_return_types2(T, []) -> doc_arg_type2(T); doc_return_types2(void, Ps) -> @@ -481,10 +484,12 @@ doc_arg_type2(T=#type{single=true}) -> doc_arg_type3(T); doc_arg_type2(T=#type{single=undefined}) -> doc_arg_type3(T); -doc_arg_type2(T=#type{single={tuple,undefined}}) -> - "{" ++ doc_arg_type3(T) ++ "}"; +doc_arg_type2(_T=#type{single={tuple,undefined}}) -> + "tuple()"; doc_arg_type2(#type{base=float, single={tuple,16}}) -> "matrix()"; +doc_arg_type2(#type{base=string, single=list}) -> + "iolist()"; doc_arg_type2(T=#type{single={tuple,Sz}}) -> "{" ++ args(fun doc_arg_type3/1, ",", lists:duplicate(Sz,T)) ++ "}"; doc_arg_type2(T=#type{single=list}) -> diff --git a/lib/wx/api_gen/gl_scan_doc.erl b/lib/wx/api_gen/gl_scan_doc.erl index 80b4826a30..0a1c25ae13 100644 --- a/lib/wx/api_gen/gl_scan_doc.erl +++ b/lib/wx/api_gen/gl_scan_doc.erl @@ -2,18 +2,19 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012-2013. All Rights Reserved. +%% Copyright Ericsson AB 2012-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %%---------------------------------------------------------------------- diff --git a/lib/wx/api_gen/wx_doxygen.conf b/lib/wx/api_gen/wx_doxygen.conf index 829702cbbf..f4d3c99ec0 100644 --- a/lib/wx/api_gen/wx_doxygen.conf +++ b/lib/wx/api_gen/wx_doxygen.conf @@ -57,7 +57,6 @@ GENERATE_DEPRECATEDLIST= NO ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages @@ -110,7 +109,6 @@ HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = @@ -251,7 +249,9 @@ PREDEFINED = \ wxUSE_DATAOBJ=1 \ wxUSE_SLIDER=1 \ wxUSE_CLIPBOARD=1 \ + wxUSE_POPUPWIN=1 \ wxUSE_SYSTEM_OPTIONS=1 \ + wxUSE_INTL=1 \ wxABI_VERSION=20809 \ __WXGTK24__=1 \ __WXGTK20__=1 \ diff --git a/lib/wx/api_gen/wx_extra/added_func.h b/lib/wx/api_gen/wx_extra/added_func.h new file mode 100644 index 0000000000..417188cc8a --- /dev/null +++ b/lib/wx/api_gen/wx_extra/added_func.h @@ -0,0 +1,41 @@ +// Added 3.0 functionality + +class WXDLLIMPEXP_AUI wxAuiTabArt +{ +public: + virtual void SetColour(const wxColour& colour) = 0; + virtual void SetActiveColour(const wxColour& colour) = 0; +}; + +// Api to get data out of paneinfo +class WXDLLIMPEXP_AUI wxAuiPaneInfo +{ + public: + wxString GetName(); + wxString GetCaption(); + wxIcon GetIcon(); + + wxWindow* GetWindow(); + wxFrame* GetFrame(); + + int GetDirection(); + int GetLayer(); + int GetRow(); + int GetPosition(); + + wxPoint GetFloatingPosition(); + wxSize GetFloatingSize(); +}; + +class wxToolBar { + public: + wxToolBarToolBase * AddStretchableSpace(); + wxToolBarToolBase * InsertStretchableSpace(size_t pos); +}; + + +class wxWindow { + public: + bool IsDoubleBuffered(); + void SetDoubleBuffered(bool on); +}; diff --git a/lib/wx/api_gen/wx_extra/bugs.h b/lib/wx/api_gen/wx_extra/bugs.h index e3a4fa200b..0563a8901f 100644 --- a/lib/wx/api_gen/wx_extra/bugs.h +++ b/lib/wx/api_gen/wx_extra/bugs.h @@ -39,4 +39,12 @@ class WXDLLIMPEXP_ADV wxTreeCtrlBase : public wxControl { public: static bool IsTreeItemIdOk(wxTreeItemId id); -} +}; + + +// Enable lost macro functionality +class WXDLLEXPORT wxPanel : public wxWindow +{ + public: + void SetFocusIgnoringChildren(); +}; diff --git a/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src b/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src index 4e492db045..b9cb4f08cc 100644 --- a/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src +++ b/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src @@ -1,17 +1,5 @@ -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; +case 100: { // wxEvtHandler::Connect wxEvtHandler *This = (wxEvtHandler *) getPtr(bp, memenv); bp += 4; int * winid = (int *) bp; bp += 4; int * lastId = (int *) bp; bp += 4; @@ -22,20 +10,22 @@ case 100: { // wxEvtHandler::Connect int * eventTypeLen = (int *) bp; bp += 4; int * class_nameLen = (int *) bp; bp += 4; - if(*haveUserData) { - userData = new wxeErlTerm(Ecmd.bin[0]); + 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"); + wxeEvtListener * Evt_cb = new wxeEvtListener(Ecmd.caller,getRef(This, memenv), + class_name,*fun_cb, + *skip, userData, Ecmd.port); + This->Connect((int) *winid,(int) *lastId,eventType, + (wxObjectEventFunction)(wxEventFunction) &wxeEvtListener::forward, + Evt_cb, Evt_cb); + rt.addAtom("ok"); + rt.addRef(getRef((void *)Evt_cb,memenv), "wxeEvtListener"); + rt.addTupleCount(2); } else { rt.addAtom("badarg"); rt.addAtom("event_type"); @@ -43,7 +33,7 @@ case 100: { // wxEvtHandler::Connect } break; } -case 101: { // wxEvtHandler::Disconnect +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; @@ -52,15 +42,19 @@ case 101: { // wxEvtHandler::Disconnect int eventType = wxeEventTypeFromAtom(bp); bp += *eventTypeLen; if(eventType > 0) { + if(recurse_level > 1) { + delayed_delete->Append(Ecmd.Save(op)); + } else { bool Result = This->Disconnect((int) *winid,(int) *lastId,eventType, - (wxObjectEventFunction)(wxEventFunction) - &wxeEvtListener::forward, - NULL, Listener); + (wxObjectEventFunction)(wxEventFunction) + &wxeEvtListener::forward, + NULL, Listener); rt.addBool(Result); + } } else { rt.addAtom("badarg"); rt.addAtom("event_type"); - rt.addTupleCount(2); + rt.addTupleCount(2); } break; } diff --git a/lib/wx/api_gen/wx_extra/wxEvtHandler.erl b/lib/wx/api_gen/wx_extra/wxEvtHandler.erl index c5802af679..17e10fb306 100644 --- a/lib/wx/api_gen/wx_extra/wxEvtHandler.erl +++ b/lib/wx/api_gen/wx_extra/wxEvtHandler.erl @@ -27,17 +27,13 @@ -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]). +-export([connect_impl/2, disconnect_impl/2]). -export_type([wxEvtHandler/0, wx/0, event/0]). -type wxEvtHandler() :: wx:wx_object(). --record(evh, {et=null,id=?wxID_ANY,lastId=?wxID_ANY,skip=undefined,userdata=[],cb=0}). - %% @doc Equivalent to {@link connect/3. connect(This, EventType, [])} --spec connect(This::wxEvtHandler(), EventType::wxEventType()) -> ok. +-spec connect(This::wxEvtHandler(), EventType::wxEventType()) -> 'ok'. connect(This, EventType) -> connect(This, EventType, []). @@ -59,9 +55,9 @@ connect(This, EventType) -> %% 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: []. --spec connect(This::wxEvtHandler(), EventType::wxEventType(), [Option]) -> ok when - Option :: {id, integer()} | {lastId, integer()} | {skip, boolean()} | - callback | {callback, function()} | {userData, term()}. +-spec connect(This::wxEvtHandler(), EventType::wxEventType(), [Option]) -> 'ok' when + Option :: {'id', integer()} | {'lastId', integer()} | {'skip', boolean()} | + 'callback' | {'callback', function()} | {'userData', term()}. connect(This=#wx_ref{type=ThisT}, EventType, Options) -> EvH = parse_opts(Options, #evh{et=EventType}), ?CLASS(ThisT,wxEvtHandler), @@ -74,6 +70,8 @@ connect(This=#wx_ref{type=ThisT}, EventType, Options) -> parse_opts([{callback,Fun}|R], Opts) when is_function(Fun) -> %% Check Fun Arity? parse_opts(R, Opts#evh{cb=Fun}); +parse_opts([{callback,CB={nospawn, Fun}}|R], Opts) when is_function(Fun) -> + parse_opts(R, Opts#evh{cb=CB}); parse_opts([callback|R], Opts) -> parse_opts(R, Opts#evh{cb=self()}); parse_opts([{userData, UserData}|R],Opts) -> @@ -117,7 +115,7 @@ disconnect(This=#wx_ref{type=ThisT,ref=_ThisRef}, EventType) when is_atom(EventT %% EventType may be the atom 'null' to match any eventtype. %% Notice that the options skip and userdata is not used to match the eventhandler. -spec disconnect(This::wxEvtHandler(), EventType::wxEventType(), [Option]) -> boolean() when - Option :: {id, integer()} | {lastId, integer()} | {callback, function()}. + Option :: {'id', integer()} | {'lastId', integer()} | {'callback', function()}. disconnect(This=#wx_ref{type=ThisT,ref=_ThisRef}, EventType, Opts) -> ?CLASS(ThisT,wxEvtHandler), EvH = parse_opts(Opts, #evh{et=EventType}), @@ -130,54 +128,34 @@ disconnect(This=#wx_ref{type=ThisT,ref=_ThisRef}, EventType, Opts) -> %% @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}) +connect_impl(#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 -> + true -> wxe_util:send_bin(term_to_binary(Userdata)), 1 end, - wxe_util:call(100, <<EvtList:32/?UI,ThisRef:32/?UI, + wxe_util:call(100, <<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, + (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}) -> +disconnect_impl(#wx_ref{type=_ThisT,ref=ThisRef}, + #evh{id=Winid, lastId=LastId, et=EventType, + handler=#wx_ref{type=wxeEvtListener,ref=EvtList}}) -> EventTypeBin = list_to_binary([atom_to_list(EventType)|[0]]), - wxe_util:call(101, <<EvtList:32/?UI, + 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 index 8fa31e512e..7bf9a481de 100644 --- a/lib/wx/api_gen/wx_extra/wxListCtrl.c_src +++ b/lib/wx/api_gen/wx_extra/wxListCtrl.c_src @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2013. All Rights Reserved. +%% Copyright Ericsson AB 2011-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -165,7 +166,7 @@ case ~s: { // wxListCtrl::SortItems taylormade callbackInfo* cb = new callbackInfo(); cb->port = Ecmd.port; cb->callbackID = sortCallback; - bool Result = This->SortItems(wxEListCtrlCompare, (long)cb); + bool Result = This->SortItems(wxEListCtrlCompare, (wxeIntPtr)cb); delete cb; /* Destroy the callback, see wxEPrintout::clear_cb */ diff --git a/lib/wx/api_gen/wx_extra/wxListCtrl.erl b/lib/wx/api_gen/wx_extra/wxListCtrl.erl index 99255bc53f..acdb69fdeb 100644 --- a/lib/wx/api_gen/wx_extra/wxListCtrl.erl +++ b/lib/wx/api_gen/wx_extra/wxListCtrl.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011. All Rights Reserved. +%% Copyright Ericsson AB 2011-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/wx/api_gen/wx_extra/wxPrintout.erl b/lib/wx/api_gen/wx_extra/wxPrintout.erl index 1dfd86ec62..ba42c737b4 100644 --- a/lib/wx/api_gen/wx_extra/wxPrintout.erl +++ b/lib/wx/api_gen/wx_extra/wxPrintout.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/wx/api_gen/wx_extra/wxTreeCtrl.c_src b/lib/wx/api_gen/wx_extra/wxTreeCtrl.c_src index 50dca4e2bb..a21f74e798 100644 --- a/lib/wx/api_gen/wx_extra/wxTreeCtrl.c_src +++ b/lib/wx/api_gen/wx_extra/wxTreeCtrl.c_src @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013. All Rights Reserved. +%% Copyright Ericsson AB 2013-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/wx/api_gen/wx_extra/wxXmlResource.erl b/lib/wx/api_gen/wx_extra/wxXmlResource.erl index cd2bea6a1d..7700e2333e 100644 --- a/lib/wx/api_gen/wx_extra/wxXmlResource.erl +++ b/lib/wx/api_gen/wx_extra/wxXmlResource.erl @@ -2,18 +2,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 2009-2016. 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. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 2eb9d9d33d..cfae2197f8 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -25,7 +26,7 @@ -include_lib("xmerl/include/xmerl.hrl"). --import(lists, [foldl/3,foldr/3,reverse/1, keysearch/3, map/2, filter/2]). +-import(lists, [foldl/3,foldr/3,reverse/1,keysearch/3,map/2,filter/2,droplast/1]). -import(proplists, [get_value/2,get_value/3]). -compile(export_all). @@ -69,7 +70,7 @@ gen_code() -> gen_xml() -> %% {ok, Defs} = file:consult("wxapi.conf"), -%% Rel = reverse(tl(reverse(os:cmd("wx-config --release")))), +%% Rel = droplast(os:cmd("wx-config --release")), %% Dir = " /usr/include/wx-" ++ Rel ++ "/wx/", %% Files0 = [Dir ++ File || {class, File, _, _, _} <- Defs], %% Files1 = [Dir ++ File || {doxygen, File} <- Defs], @@ -172,7 +173,7 @@ parse_defs([], Acc) -> reverse(Acc). meta_info(C=#class{name=CName,methods=Ms0}) -> Ms = lists:append(Ms0), HaveConstructor = lists:keymember(constructor, #method.method_type, Ms), - case lists:keysearch(destructor, #method.method_type, Ms) of + case keysearch(destructor, #method.method_type, Ms) of false when HaveConstructor -> Dest = #method{name = "destroy", id = next_id(func_id), method_type = destructor, params = [this(CName)]}, @@ -288,7 +289,7 @@ parse_attr1([{{attr,_}, #xmlElement{content=C, attributes=Attrs}}|R], AttrList0, parse_attr1([{_Id,_}|R],AttrList,Info, Res) -> parse_attr1(R,AttrList,Info, Res); parse_attr1([],Left,_, Res) -> - {lists:reverse(Res), Left}. + {reverse(Res), Left}. attr_acc(#param{name=N}, List) -> Name = list_to_atom(N), @@ -704,6 +705,8 @@ parse_type2(["unsigned"|R],Info,Opts,T=#type{mod=Mod}) -> parse_type2(R,Info,Opts,T#type{mod=[unsigned|Mod]}); parse_type2(["int"|R],Info,Opts, T) -> parse_type2(R,Info,Opts,T#type{name=int,base=int}); +parse_type2(["wxByte"|R],Info,Opts, T) -> + parse_type2(R,Info,Opts,T#type{name=int,base=int}); parse_type2(["char"|R],Info,Opts, T) -> parse_type2(R,Info,Opts,T#type{name="char",base=int}); parse_type2([N="size_t"|R], Info, Opts, T) -> @@ -743,7 +746,14 @@ parse_type2([N="wxTreeItemData"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name="wxETreeItemData",base={term,N}}); parse_type2([N="wxClientData"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name="wxeErlTerm",base={term,N}}); -parse_type2([N="wxChar"|R],Info,Opts,T) -> +parse_type2([N="wxChar",{by_ref,_}|R],Info,Opts,T = #type{mod=[const]}) -> + case get(current_class) of + "wxLocale" -> %% Special since changed between 2.8 and 3.0 + parse_type2(R,Info,Opts,T#type{name="wxeLocaleC",base=string}); + _ -> + parse_type2(R,Info,Opts,T#type{name=N,base=int,single=false}) + end; +parse_type2([N="wxChar"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name=N,base=int}); parse_type2(["wxUint32"|R],Info,Opts,T=#type{mod=Mod}) -> parse_type2(R,Info,Opts,T#type{name=int,base=int,mod=[unsigned|Mod]}); @@ -763,14 +773,19 @@ parse_type2([N="wxGridCellCoordsArray"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name=N,base={comp,"wxGridCellCoords", [{int,"R"},{int,"C"}]}, single=array}); +parse_type2([N="wxAuiPaneInfoArray"|R],Info,Opts,T) -> + parse_type2(R,Info,Opts,T#type{name=N,base={class,"wxAuiPaneInfo"}, + single=array}); + parse_type2([N="wxRect"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name=N,base={comp,N,[{int,"X"},{int,"Y"}, {int,"W"},{int,"H"}]}}); parse_type2([N="wxColour"|R],Info,Opts,T) -> parse_type2(R,Info,Opts,T#type{name=N, base={comp,N,[{int,"R"},{int,"G"},{int,"B"},{int,"A"}]}}); -parse_type2([N="wxColor"|R],Info,Opts,T) -> - parse_type2(R,Info,Opts,T#type{name="wxColour", +parse_type2(["wxColor"|R],Info,Opts,T) -> + N = "wxColour", + parse_type2(R,Info,Opts,T#type{name=N, base={comp,N,[{int,"R"},{int,"G"},{int,"B"},{int,"A"}]}}); parse_type2([N="wxPoint2DDouble"|R],Info,Opts,T) -> @@ -994,7 +1009,7 @@ erl_skip_opt2([F={_,{N,In,_},M=#method{where=Where}}|Ms],Acc1,Acc2,Check) -> [] -> erl_skip_opt2(Ms,[F|Acc1],[M#method{where=erl_no_opt}|Acc2],[]); _ -> - Skipped = reverse(tl(reverse(In))), + Skipped = droplast(In), T = fun({_,{_,Args,_},_}) -> true =:= types_differ(Skipped,Args) end, case lists:all(T, Check) of true -> @@ -1188,7 +1203,7 @@ translate_constants(Enums, NotConsts0, Skip0) -> create_consts([{{enum, Name},Enum = #enum{vals=Vals}}|R], Skip, NotConsts, Acc0) -> CC = fun(What, Acc) -> - create_const(What, Skip, NotConsts, Acc) + create_const(What, Name, Skip, NotConsts, Acc) end, Acc = case Vals of undefined -> @@ -1202,17 +1217,17 @@ create_consts([{{enum, Name},Enum = #enum{vals=Vals}}|R], Skip, NotConsts, Acc0) create_consts(R, Skip, NotConsts, Acc); create_consts([],_,_,Acc) -> Acc. -create_const({Name, Val}, Skip, NotConsts, Acc) -> +create_const({Name, Val}, EnumName, Skip, NotConsts, Acc) -> case gb_sets:is_member(Name, Skip) of true -> Acc; false -> - case gb_sets:is_member(Name, NotConsts) of + case gb_sets:is_member(Name, NotConsts) orelse + gb_sets:is_member(EnumName, NotConsts) + of true -> [#const{name=Name,val=next_id(const),is_const=false}|Acc]; false -> [#const{name=Name,val=Val,is_const=true}|Acc] -%% false -> -%% [#const{name=Name,val=Val}|Acc] end end. @@ -1274,6 +1289,7 @@ parse_enums([File|Files], Parsed) -> %%io:format("Parse Enums in ~s ~n", [FileName]), case xmerl_scan:file(FileName, [{space, normalize}]) of {error, enoent} -> + %% io:format("Ignore ~p~n", [FileName]), parse_enums(Files, gb_sets:add(File,Parsed)); {Doc, _} -> ES = "./compounddef/sectiondef/memberdef[@kind=\"enum\"]", @@ -1350,12 +1366,16 @@ extract_enum3([#xmlElement{name=name,content=[#xmlText{value=Name}]}|R], Id, Acc end; extract_enum3([#xmlElement{name=initializer,content=Cs}|_],_Id,[{Name,_}|Acc]) -> - String = extract_def2(Cs), + String = case extract_def2(Cs) of + "= " ++ Str0 -> Str0; %% Doxygen 1.8.3.1 keeps the '=' sign + "=" ++ Str0 -> Str0; %% Doxygen 1.8.3.1 keeps the '=' sign + Str0 -> Str0 + end, Val0 = gen_util:tokens(String,"<& "), try case Val0 of ["0x" ++ Val1] -> - Val = http_util:hexlist_to_integer(Val1), + Val = list_to_integer(Val1, 16), {[{Name, Val}|Acc], Val+1}; ["1", "<<", Shift] -> Val = 1 bsl list_to_integer(Shift), @@ -1411,7 +1431,7 @@ extract_def([#xmlElement{name=param}|_],Name,_) -> extract_def([#xmlElement{name=initializer,content=Cs}|_R],N,Skip) -> Val0 = extract_def2(Cs), case Val0 of - "0x" ++ Val1 -> {N, http_util:hexlist_to_integer(Val1)}; + "0x" ++ Val1 -> {N, list_to_integer(Val1, 16)}; _ -> try Val = list_to_integer(Val0), @@ -1433,7 +1453,7 @@ extract_def(_,N,_) -> throw(N). extract_def2([#xmlText{value=Val}|R]) -> - strip_comment(string:strip(Val)) ++ extract_def2(R); + string:strip(strip_comment(Val)) ++ extract_def2(R); extract_def2([#xmlElement{content=Cs}|R]) -> extract_def2(Cs) ++ extract_def2(R); extract_def2([]) -> []. diff --git a/lib/wx/api_gen/wx_gen.hrl b/lib/wx/api_gen/wx_gen.hrl index 89577b9707..4b7a7f3bb8 100644 --- a/lib/wx/api_gen/wx_gen.hrl +++ b/lib/wx/api_gen/wx_gen.hrl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% -record(class, diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index f00fc0c720..84d3990786 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -71,7 +72,8 @@ gen_derived_dest_2(C=#class{name=Class, options=Opts}) -> if Derived andalso (TaylorMade =:= false) -> case lists:keysearch(ifdef,1,Opts) of - {value, {ifdef, What}} -> w("#if ~p~n",[What]); + {value, {ifdef, What}} when is_list(What)-> w("#if ~s~n",[What]); + {value, {ifdef, What}} when is_atom(What) -> w("#if ~p~n",[What]); _ -> ok end, w("class E~s : public ~s {~n",[Class,Class]), @@ -114,8 +116,13 @@ taylormade_class(#class{name=CName, methods=Ms}) -> gen_constructors(#class{name=Class, methods=Ms0}) -> Ms = lists:append(Ms0), Cs = lists:filter(fun(#method{method_type=MT}) -> MT =:= constructor end, Ms), - [gen_constructor(Class, Const) || Const <- Cs]. - + [gen_constructor(Class, Const) || Const <- Cs], + case need_copy_constr(Class) of + true -> + w(" E~s(~s copy) : ~s(copy) {};~n", [Class, Class, Class]); + false -> + ignore + end. gen_constructor(_Class, #method{where=merged_c}) -> ok; gen_constructor(_Class, #method{where=erl_no_opt}) -> ok; gen_constructor(Class, _M=#method{params=Ps, opts=FOpts}) -> @@ -143,6 +150,14 @@ gen_constructor(Class, _M=#method{params=Ps, opts=FOpts}) -> Endif andalso w("#endif~n", []), ok. + +need_copy_constr("wxFont") -> true; +need_copy_constr("wxIcon") -> true; +need_copy_constr("wxImage") -> true; +need_copy_constr("wxBitmap") -> true; +%%need_copy_constr("wxGraphics" ++ _) -> true; +need_copy_constr(_) -> false. + gen_type(#type{name=Type, ref={pointer,1}, mod=Mod},_) -> mods(Mod) ++ to_string(Type) ++ " * "; gen_type(#type{name=Type, ref={pointer,2}, mod=Mod},_) -> @@ -180,35 +195,42 @@ gen_funcs(Defs) -> w("void WxeApp::wxe_dispatch(wxeCommand& Ecmd)~n{~n"), w(" char * bp = Ecmd.buffer;~n"), + w(" int op = Ecmd.op;~n"), + w(" Ecmd.op = -1;~n"), w(" wxeMemEnv *memenv = getMemEnv(Ecmd.port);~n"), %% w(" wxMBConvUTF32 UTFconverter;~n"), - w(" wxeReturn rt = wxeReturn(WXE_DRV_PORT, Ecmd.caller, true);~n"), + w(" wxeReturn rt = wxeReturn(WXE_DRV_PORT, Ecmd.caller, true);~n"), w(" try {~n"), - w(" switch (Ecmd.op)~n{~n"), + w(" switch (op)~n{~n"), %% w(" case WXE_CREATE_PORT:~n", []), %% w(" { newMemEnv(Ecmd.port); } break;~n", []), %% w(" case WXE_REMOVE_PORT:~n", []), %% w(" { destroyMemEnv(Ecmd.port); } break;~n", []), w(" case DESTROY_OBJECT: {~n"), - w(" wxObject *This = (wxObject *) getPtr(bp,memenv); "), - w(" if(This) {"), - w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n"), - w(" delete This; }~n } break;~n"), + w(" void *This = getPtr(bp,memenv);~n"), + w(" wxeRefData *refd = getRefData(This);~n"), + w(" if(This && refd) {~n"), + w(" if(recurse_level > 1 && refd->type != 8) {~n"), + w(" delayed_delete->Append(Ecmd.Save(op));~n"), + w(" } else {~n"), + w(" delete_object(This, refd);~n"), + w(" ((WxeApp *) wxTheApp)->clearPtr(This);}~n"), + w(" } } break;~n"), w(" case WXE_REGISTER_OBJECT: {~n" " registerPid(bp, Ecmd.caller, memenv);~n" " rt.addAtom(\"ok\");~n" " break;~n" " }~n"), - w(" case WXE_BIN_INCR:~n driver_binary_inc_refc(Ecmd.bin[0]->bin);~n break;~n",[]), - w(" case WXE_BIN_DECR:~n driver_binary_dec_refc(Ecmd.bin[0]->bin);~n break;~n",[]), - w(" case WXE_INIT_OPENGL:~n wxe_initOpenGL(rt, bp);~n break;~n",[]), + w(" case WXE_BIN_INCR:~n driver_binary_inc_refc(Ecmd.bin[0].bin);~n break;~n",[]), + w(" case WXE_BIN_DECR:~n driver_binary_dec_refc(Ecmd.bin[0].bin);~n break;~n",[]), + w(" case WXE_INIT_OPENGL:~n wxe_initOpenGL(&rt, bp);~n break;~n",[]), Res = [gen_class(Class) || Class <- Defs], w(" default: {~n"), w(" wxeReturn error = wxeReturn(WXE_DRV_PORT, Ecmd.caller, false);"), w(" error.addAtom(\"_wxe_error_\");~n"), - w(" error.addInt((int) Ecmd.op);~n"), + w(" error.addInt((int) op);~n"), w(" error.addAtom(\"not_supported\");~n"), w(" error.addTupleCount(3);~n"), w(" error.send();~n"), @@ -219,7 +241,7 @@ gen_funcs(Defs) -> w("} catch (wxe_badarg badarg) { // try~n"), w(" wxeReturn error = wxeReturn(WXE_DRV_PORT, Ecmd.caller, false);"), w(" error.addAtom(\"_wxe_error_\");~n"), - w(" error.addInt((int) Ecmd.op);~n"), + w(" error.addInt((int) op);~n"), w(" error.addAtom(\"badarg\");~n"), w(" error.addInt((int) badarg.ref);~n"), w(" error.addTupleCount(2);~n"), @@ -228,27 +250,45 @@ gen_funcs(Defs) -> w("}} /* The End */~n~n~n"), UglySkipList = ["wxCaret", "wxCalendarDateAttr", - "wxFileDataObject", "wxTextDataObject", "wxBitmapDataObject" + "wxFileDataObject", "wxTextDataObject", "wxBitmapDataObject", + "wxAuiSimpleTabArt" ], - w("void WxeApp::delete_object(void *ptr, wxeRefData *refd) {~n", []), + w("bool WxeApp::delete_object(void *ptr, wxeRefData *refd) {~n", []), + w(" if(wxe_debug) {\n" + " wxString msg;\n" + " const wxChar *class_info = wxT(\"unknown\");\n" + " if(refd->type < 10) {\n" + " wxClassInfo *cinfo = ((wxObject *)ptr)->GetClassInfo();\n" + " class_info = cinfo->GetClassName();\n" + " }\n" + " msg.Printf(wxT(\"Deleting {wx_ref, %d, %s} at %p \"), refd->ref, class_info, ptr);\n" + " send_msg(\"debug\", &msg);\n" + " };\n"), + w(" switch(refd->type) {~n", []), - Case = fun(#class{name=Class, id=Id, abstract=IsAbs, parent=P}) when P /= "static" -> + w("#if wxUSE_GRAPHICS_CONTEXT~n", []), + w(" case 4: delete (wxGraphicsObject *) ptr; break;~n", []), + w("#endif~n", []), + Case = fun(C=#class{name=Class, id=Id, abstract=IsAbs, parent=P}) when P /= "static" -> UglyWorkaround = lists:member(Class, UglySkipList), + HaveVirtual = virtual_dest(C), case hd(reverse(wx_gen_erl:parents(Class))) of - root when IsAbs == false, UglyWorkaround == false -> - w(" case ~p: delete (~s *) ptr; break;~n", [Id, Class]); root when IsAbs == false, UglyWorkaround == true -> w(" case ~p: /* delete (~s *) ptr;" "These objects must be deleted by owner object */ " "break;~n", [Id, Class]); + root when IsAbs == false, HaveVirtual == true -> + w(" case ~p: delete (E~s *) ptr; return false;~n", [Id, Class]); + root when IsAbs == false, UglyWorkaround == false -> + w(" case ~p: delete (~s *) ptr; break;~n", [Id, Class]); _ -> ok end; (_) -> ok end, [Case(Class) || Class <- Defs], - w(" default: delete (wxObject *) ptr;~n", []), - w("}}~n~n", []), + w(" default: delete (wxObject *) ptr; return false;~n", []), + w(" }~n return true;~n}~n~n", []), Res. gen_class(C=#class{name=Name,methods=Ms,options=Opts}) -> @@ -263,7 +303,8 @@ gen_class(C=#class{name=Name,methods=Ms,options=Opts}) -> false -> case lists:keysearch(ifdef,1,Opts) of {value, {ifdef, What}} -> - w("#if ~p~n",[What]), + is_atom(What) andalso w("#if ~p~n",[What]), + is_list(What) andalso w("#if ~s~n",[What]), Methods = lists:flatten(Ms), MsR = [gen_method(Name,M) || M <- lists:keysort(#method.id, Methods)], @@ -312,12 +353,8 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId put(current_func, N), put(bin_count,-1), ?WTC("gen_method"), - Endif = case lists:keysearch(deprecated, 1, FOpts) of - {value, {deprecated, IfDef}} -> - w("#if ~s~n", [IfDef]), - true; - _ -> false - end, + Endif1 = gen_if(deprecated, FOpts), + Endif2 = gen_if(test_if, FOpts), w("case ~s: { // ~s::~s~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]), Ps1 = declare_variables(void, Ps0), {Ps2,Align} = decode_arguments(Ps1), @@ -336,10 +373,19 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId free_args(), build_return_vals(T,Ps3), w(" break;~n}~n", []), - Endif andalso w("#endif~n", []), + Endif1 andalso w("#endif~n", []), + Endif2 andalso w("#endif~n", []), erase(current_func), M. +gen_if(What, Opts) -> + case lists:keysearch(What, 1, Opts) of + {value, {What, IfDef}} -> + w("#if ~s~n", [IfDef]), + true; + _ -> false + end. + declare_variables(void,Ps) -> [declare_var(P) || P <- Ps]; declare_variables(T, Ps) -> @@ -397,6 +443,8 @@ declare_type(N,true,Def,#type{base=Base,single=true,name=Type,by_val=false,ref={ w(" ~s *~s=~s;~n", [Type,N,Def]); declare_type(N,true,Def,#type{single=true,name="wxArtClient"}) -> w(" wxArtClient ~s= ~s;~n", [N,Def]); +declare_type(N,true,_Def,#type{name="wxeLocaleC", single=true,base=string}) -> + w(" wxString ~s= wxEmptyString;~n", [N]); declare_type(N,true,Def,#type{single=true,base=string}) -> w(" wxString ~s= ~s;~n", [N,Def]); %% declare_type(N,true,_Def,#type{name="wxString"}) -> @@ -618,10 +666,10 @@ decode_arg(N,#type{name=Type,base=binary,mod=Mod0},Arg,A0) -> Mod = mods([M || M <- Mod0]), case Arg of arg -> - w(" ~s~s * ~s = (~s~s*) Ecmd.bin[~p]->base;~n", + w(" ~s~s * ~s = (~s~s*) Ecmd.bin[~p].base;~n", [Mod,Type,N,Mod,Type, next_id(bin_count)]); opt -> - w(" ~s = (~s~s*) Ecmd.bin[~p]->base;~n", + w(" ~s = (~s~s*) Ecmd.bin[~p].base;~n", [N,Mod,Type,next_id(bin_count)]) end, A0; @@ -631,10 +679,10 @@ decode_arg(N,#type{base={term,"wxTreeItemData"},mod=Mod0},Arg,A0) -> BinCnt = next_id(bin_count), case Arg of arg -> - w(" ~s~s * ~s = new ~s(Ecmd.bin[~p]->size, Ecmd.bin[~p]->base);~n", + w(" ~s~s * ~s = new ~s(Ecmd.bin[~p].size, Ecmd.bin[~p].base);~n", [Mod,Type,N,Type,BinCnt,BinCnt]); opt -> - w(" ~s = new ~s(Ecmd.bin[~p]->size, Ecmd.bin[~p]->base);~n", + w(" ~s = new ~s(Ecmd.bin[~p].size, Ecmd.bin[~p].base);~n", [N,Type,BinCnt,BinCnt]) end, A0; @@ -643,10 +691,10 @@ decode_arg(N,#type{name=Type,base={term,_},mod=Mod0},Arg,A0) -> BinCnt = next_id(bin_count), case Arg of arg -> - w(" ~s~s * ~s = new ~s(Ecmd.bin[~p]);~n", + w(" ~s~s * ~s = new ~s(&Ecmd.bin[~p]);~n", [Mod,Type,N,Type,BinCnt]); opt -> - w(" ~s = new ~s(Ecmd.bin[~p]);~n", + w(" ~s = new ~s(&Ecmd.bin[~p]);~n", [N,Type,BinCnt]) end, A0; @@ -726,9 +774,13 @@ call_wx(_N,{constructor,_},#type{base={class,RClass}},Ps) -> false -> 0 end; false -> - case hd(reverse(wx_gen_erl:parents(RClass))) of - root -> Id; - _ -> 1 + case is_dc(RClass) of + true -> 8; + false -> + case hd(reverse(wx_gen_erl:parents(RClass))) of + root -> Id; + _ -> 1 + end end end, case virtual_dest(ClassDef) orelse (CType =/= 0) of @@ -781,19 +833,22 @@ return_res1(#type{name=Type,base={class,_},single=list,ref=reference}) -> return_res1(#type{name=Type,base={comp,_,_},single=array,by_val=true}) -> {Type ++ " Result = ", ""}; return_res1(#type{name=Type,single=true,by_val=true, base={class, _}}) -> - %% Temporary memory leak !!!!!! - case Type of - "wxImage" -> ok; - "wxFont" -> ok; - "wxBitmap" -> ok; - "wxIcon" -> ok; - "wxGraphics" ++ _ -> ok; - _ -> + case {need_copy_constr(Type), Type} of + {true, _} -> + {Type ++ " * Result = new E" ++ Type ++ "(", "); newPtr((void *) Result," + ++ "3, memenv);"}; + {false, "wxGraphics" ++ _} -> + %% {"wxGraphicsObject * Result = new wxGraphicsObject(", "); newPtr((void *) Result," + %% ++ "3, memenv);"}; + {Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result," + ++ "4, memenv);"}; + {false, _} -> + %% Temporary memory leak !!!!!! io:format("~s::~s Building return value of temp ~s~n", - [get(current_class),get(current_func),Type]) - end, - {Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result," - ++ "3, memenv);"}; + [get(current_class),get(current_func),Type]), + {Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result," + ++ "3, memenv);"} + end; return_res1(#type{base={enum,_Type},single=true,by_val=true}) -> {"int Result = " , ""}; return_res1(#type{name="wxCharBuffer", base={binary,_},single=true,by_val=true}) -> @@ -815,7 +870,7 @@ call_arg(#param{where=c, alt={length,Alt}}) when is_list(Alt) -> "*" ++ Alt ++ "Len"; call_arg(#param{where=c, alt={size,Id}}) when is_integer(Id) -> %% It's a binary - "Ecmd.bin["++ integer_to_list(Id) ++ "]->size"; + "Ecmd.bin["++ integer_to_list(Id) ++ "].size"; call_arg(#param{name=N,def=Def,type=#type{by_val=true,single=true,base=Base}}) when Base =:= int; Base =:= long; Base =:= float; Base =:= double; Base =:= bool -> case Def of @@ -855,34 +910,24 @@ call_arg(#param{name=N,type={merged,_,_,_,_,_,_}}) -> N. to_string(Type) when is_atom(Type) -> atom_to_list(Type); to_string(Type) when is_list(Type) -> Type. -virtual_dest(#class{abstract=true, parent="root"}) -> false; -virtual_dest(#class{abstract=true, parent="object"}) -> true; virtual_dest(#class{abstract=true, parent=Parent}) -> - virtual_dest(get({class,Parent})); + virtual_dest(get_parent_class(Parent)); virtual_dest(#class{methods=Ms, parent=Parent}) -> case lists:keysearch(destructor,#method.method_type, lists:append(Ms)) of {value, #method{method_type=destructor, virtual=Virtual}} -> case Virtual of - undefined -> - case get({class,Parent}) of - undefined -> - case Parent of - "object" -> - true; - "root" -> - false; - _ -> - io:format("Error: ~p~n",[Parent]), - erlang:error(no_parent) - end; - PClass -> - virtual_dest(PClass) - end; - _ -> - Virtual + true -> true; + _ -> virtual_dest(get_parent_class(Parent)) end; - false -> - false + false -> virtual_dest(get_parent_class(Parent)) + end; +virtual_dest("root") -> false; +virtual_dest("object") -> true. + +get_parent_class(Parent) -> + case get({class, Parent}) of + undefined -> Parent; + Class -> Class end. debug(F,A) -> @@ -900,11 +945,28 @@ is_window(Class) -> is_dialog(Class) -> lists:member("wxDialog", wx_gen_erl:parents(Class)). -build_return_vals(Type,Ps) -> +is_dc(Class) -> + Parents = wx_gen_erl:parents(Class), + lists:member("wxDC", Parents) orelse lists:member("wxGraphicsContext", Parents). + +build_return_vals(Type,Ps0) -> + Ps = [P || P = #param{in=In} <- Ps0, In =/= true], HaveType = case Type of void -> 0; _ -> 1 end, - NoOut = lists:sum([1 || #param{in=In} <- Ps, In =/= true]) + HaveType, + NoOut = length(Ps) + HaveType, OutTupSz = if NoOut > 1 -> NoOut; true -> 0 end, + CountFloats = fun(#param{type=#type{base=Float, single=true}}, Acc) + when Float =:= float; Float =:= double -> + Acc + 1; + (_, Acc) -> + Acc + end, + NofFloats = lists:foldl(CountFloats, 1, Ps), + case NofFloats > 1 of + true -> %%io:format("Floats ~p:~p ~p ~n",[get(current_class),get(current_func), NofFloats]); + w(" rt.ensureFloatCount(~p);~n",[NofFloats]); + false -> ignore + end, build_ret_types(Type,Ps), if OutTupSz > 1 -> w(" rt.addTupleCount(~p);~n",[OutTupSz]); @@ -913,12 +975,11 @@ build_return_vals(Type,Ps) -> Ps. build_ret_types(void,Ps) -> - Calc = fun(#param{name=N,in=False,type=T}, Free) when False =/= true -> - case build_ret(N, {arg, False}, T) of + Calc = fun(#param{name=N,in=In,type=T}, Free) -> + case build_ret(N, {arg, In}, T) of ok -> Free; Other -> [Other|Free] - end; - (_, Free) -> Free + end end, lists:foldl(Calc, [], Ps); build_ret_types(Type,Ps) -> @@ -926,12 +987,11 @@ build_ret_types(Type,Ps) -> ok -> []; FreeStr -> [FreeStr] end, - Calc = fun(#param{name=N,in=False,type=T}, FreeAcc) when False =/= true -> - case build_ret(N, {arg, False}, T) of + Calc = fun(#param{name=N,in=In,type=T}, FreeAcc) -> + case build_ret(N, {arg, In}, T) of ok -> FreeAcc; FreeMe -> [FreeMe|FreeAcc] - end; - (_, FreeAcc) -> FreeAcc + end end, lists:foldl(Calc, Free, Ps). @@ -965,6 +1025,13 @@ build_ret(Name = "ev->m_scanCode",_,#type{base=bool,single=true,by_val=true}) -> w(" rt.addBool(~s);~n",[Name]), w("#else~n rt.addBool(false);~n",[]), w("#endif~n",[]); +build_ret(Name = "ev->m_metaDown",_,#type{base=bool,single=true,by_val=true}) -> + %% Hardcoded workaround for MAC on 2.9 and later + w("#if wxCHECK_VERSION(2,9,0) && defined(_MACOSX)~n", []), + w(" rt.addBool(ev->m_rawControlDown);~n",[]), + w("#else~n rt.addBool(~s);~n",[Name]), + w("#endif~n",[]); + build_ret(Name,_,#type{base=bool,single=true,by_val=true}) -> w(" rt.addBool(~s);~n",[Name]); build_ret(Name,{arg, both},#type{base=int,single=true,mod=M}) -> @@ -985,6 +1052,10 @@ build_ret(Name,_,#type{base={comp,_,_},single=array}) -> w(" for(unsigned int i=0; i < ~s.GetCount(); i++) {~n", [Name]), w(" rt.add(~s[i]);~n }~n",[Name]), w(" rt.endList(~s.GetCount());~n",[Name]); +build_ret(Name,_,#type{base={class,Class},single=array}) -> + w(" for(unsigned int i=0; i < ~s.GetCount(); i++) {~n", [Name]), + w(" rt.addRef(getRef((void *) &~s.Item(i), memenv), \"~s\");~n }~n",[Name, Class]), + w(" rt.endList(~s.GetCount());~n",[Name]); build_ret(Name,_,#type{name=List,single=list,base={class,Class}}) -> w(" int i=0;~n"), w(" for(~s::const_iterator it = ~s.begin(); it != ~s.end(); ++it) {~n", @@ -999,10 +1070,11 @@ build_ret(Name,_,#type{name="wxArrayTreeItemIds"}) -> w(" rt.endList(~s.GetCount());~n",[Name]); build_ret(Name,_,#type{base=float,single=true}) -> -%% w(" double Temp~s = ~s;~n", [Name,Name]), w(" rt.addFloat(~s);~n",[Name]); build_ret(Name,_,#type{base=double,single=true}) -> w(" rt.addFloat(~s);~n",[Name]); +build_ret(Name,_,#type{name="wxeLocaleC"}) -> + w(" rt.add(wxeLocaleC2String(~s));~n",[Name]); build_ret(Name,_,#type{base=string,single=true}) -> w(" rt.add(~s);~n",[Name]); build_ret(Name,_,#type{name="wxArrayString", single=array}) -> @@ -1096,10 +1168,12 @@ gen_macros() -> w("#include <wx/listbook.h>~n"), w("#include <wx/treebook.h>~n"), w("#include <wx/taskbar.h>~n"), + w("#include <wx/popupwin.h>~n"), w("#include <wx/html/htmlwin.h>~n"), w("#include <wx/html/htmlcell.h>~n"), w("#include <wx/filename.h>~n"), w("#include <wx/sysopt.h>~n"), + w("#include <wx/overlay.h>~n"), w("~n~n", []), w("#ifndef wxICON_DEFAULT_BITMAP_TYPE~n",[]), @@ -1196,15 +1270,6 @@ find_id(OtherClass) -> encode_events(Evs) -> ?WTC("encode_events"), - w("void wxeEvtListener::forward(wxEvent& event)~n" - "{~n" - "#ifdef DEBUG~n" - " if(!sendevent(&event, port))~n" - " fprintf(stderr, \"Couldn't send event!\\r\\n\");~n" - "#else~n" - "sendevent(&event, port);~n" - "#endif~n" - "}~n~n"), w("int getRef(void* ptr, wxeMemEnv* memenv)~n" "{~n" " WxeApp * app = (WxeApp *) wxTheApp;~n" @@ -1215,7 +1280,7 @@ encode_events(Evs) -> " char * evClass = NULL;~n" " wxMBConvUTF32 UTFconverter;~n" " wxeEtype *Etype = etmap[event->GetEventType()];~n" - " wxeCallbackData *cb = (wxeCallbackData *)event->m_callbackUserData;~n" + " wxeEvtListener *cb = (wxeEvtListener *)event->m_callbackUserData;~n" " WxeApp * app = (WxeApp *) wxTheApp;~n" " wxeMemEnv *memenv = app->getMemEnv(port);~n" " if(!memenv) return 0;~n~n" @@ -1223,7 +1288,7 @@ encode_events(Evs) -> w("~n rt.addAtom((char*)\"wx\");~n" " rt.addInt((int) event->GetId());~n" - " rt.addRef(getRef((void *)(cb->obj), memenv), cb->class_name);~n" + " rt.addRef(cb->obj, cb->class_name);~n" " rt.addExt2Term(cb->user_data);~n"), w(" switch(Etype->cID) {~n"), @@ -1244,6 +1309,11 @@ encode_events(Evs) -> w(" } else {~n"), w(" send_res = rt.send();~n"), w(" if(cb->skip) event->Skip();~n"), + w(" if(app->recurse_level < 1) {~n"), + w(" app->recurse_level++;~n"), + w(" app->dispatch_cmds();~n"), + w(" app->recurse_level--;~n"), + w(" }~n"), w(" };~n"), w(" return send_res;~n"), w(" }~n"). diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index 2e1a0d617a..794de25002 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -44,7 +45,11 @@ gen(Defs) -> gen_unique_names(Defs), gen_event_recs(), gen_enums_ints(), - [gen_class(Class) || Class <- Defs], + Static = gen_static([C || C=#class{parent="static"} <- Defs]), + Replace = fun(C=#class{name=Name}, Dfs) -> + lists:keyreplace(Name, #class.name, Dfs, C) + end, + [gen_class(Class) || Class <- lists:foldl(Replace, Defs, Static)], gen_funcnames(). gen_class(Class) -> @@ -54,30 +59,39 @@ gen_class(Class) -> Class end. -gen_class1(C=#class{name=Name,parent="static",methods=Ms,options=_Opts}) -> +gen_static(Files) -> open_write("../src/gen/wx_misc.erl"), - put(current_class, Name), erl_copyright(), w("", []), w("%% This file is generated DO NOT EDIT~n~n", []), w("%% @doc See external documentation: " - "<a href=\"http://www.wxwidgets.org/manuals/stable/wx_miscellany.html\">Misc</a>.\n\n",[]), + "<a href=\"http://www.wxwidgets.org/manuals/2.8.12/wx_miscellany.html\">Misc</a>.\n\n",[]), w("%% This module contains wxWidgets utility functions.~n~n", []), w("-module(wx_misc).~n", []), w("-include(\"wxe.hrl\").~n",[]), %% w("-compile(export_all).~n~n", []), %% XXXX remove ??? + [gen_static_exports(C) || C <- Files], + Classes = [gen_static_methods(C) || C <- Files], + close(), + Classes. + +gen_static_exports(C=#class{parent="static",methods=Ms}) -> Exp = fun(M) -> gen_export(C,M) end, ExportList = lists:usort(lists:append(lists:map(Exp,reverse(Ms)))), w("-export([~s]).~n~n", [args(fun({EF,_}) -> EF end, ",", ExportList, 60)]), + ok. +gen_static_methods(C=#class{name=Name, parent="static",methods=Ms}) -> + put(current_class, Name), Gen = fun(M) -> gen_method(Name,M) end, NewMs = lists:map(Gen,reverse(Ms)), - close(), erase(current_class), - C#class{methods=NewMs}; + C#class{methods=NewMs}. +gen_class1(C=#class{parent="static"}) -> + C; gen_class1(C=#class{name=Name,parent=Parent,methods=Ms,options=Opts}) -> case Opts of ["ignore"] -> throw(skipped); @@ -96,7 +110,7 @@ gen_class1(C=#class{name=Name,parent=Parent,methods=Ms,options=Opts}) -> NewMs = Ms; false -> w("%% @doc See external documentation: " - "<a href=\"http://www.wxwidgets.org/manuals/stable/wx_~s.html\">~s</a>.\n", + "<a href=\"http://www.wxwidgets.org/manuals/2.8.12/wx_~s.html\">~s</a>.\n", [lowercase_all(Name), Name]), case C#class.doc of @@ -137,15 +151,27 @@ gen_class1(C=#class{name=Name,parent=Parent,methods=Ms,options=Opts}) -> w("%% inherited exports~n",[]), Done0 = ["Destroy", "New", "Create", "destroy", "new", "create"], Done = gb_sets:from_list(Done0 ++ [M|| #method{name=M} <- lists:append(Ms)]), - {_, InExported} = gen_inherited(Parents, Done, []), - w("-export([~s]).~n~n", [args(fun(EF) -> EF end, ",", - lists:usort(["parent_class/1"|InExported]), + {_, InExported0} = gen_inherited(Parents, Done, []), + InExported = lists:ukeysort(2, [{?MODULE,{"parent_class","1"},false}|InExported0]), + w("-export([~s]).~n~n", [args(fun({_M,{F,A},_Dep}) -> F ++ "/" ++ A end, ",", + InExported, 60)]), w("-export_type([~s/0]).~n", [Name]), case lists:filter(fun({_F,Depr}) -> Depr end, ExportList) of [] -> ok; Depr -> w("-deprecated([~s]).~n~n", [args(fun({EF,_}) -> EF end, ",", Depr, 60)]) end, + case lists:filter(fun({_,_,Depr}) -> Depr end, InExported) of + [] -> ok; + NoWDepr -> w("-compile([~s]).~n~n", + [args(fun({M,{F,A},_}) -> + DStr=io_lib:format("{nowarn_deprecated_function, {~s,~s,~s}}", + [M,F,A]), + lists:flatten(DStr) + end, ",", NoWDepr, 60)]) + end, + + w("%% @hidden~n", []), parents_check(Parents), w("-type ~s() :: wx:wx_object().~n", [Name]), @@ -353,7 +379,7 @@ gen_dest(#class{name=CName,abstract=Abs}, Ms) -> gen_dest2(Class, Id) -> w("%% @doc Destroys this object, do not use object again~n", []), - w("-spec destroy(This::~s()) -> ok.~n", [Class]), + w("-spec destroy(This::~s()) -> 'ok'.~n", [Class]), w("destroy(Obj=#wx_ref{type=Type}) ->~n", []), w(" ?CLASS(Type,~s),~n",[Class]), case Id of @@ -375,7 +401,7 @@ gen_inherited([Parent|Ps], Done0, Exported0) -> {Done,Exported} = gen_inherited_ms(Ms, Class, Done0, gb_sets:empty(), Exported0), gen_inherited(Ps, gb_sets:union(Done,Done0), Exported). -gen_inherited_ms([[#method{name=Name,alias=A,params=Ps0,where=W,method_type=MT}|_]|R], +gen_inherited_ms([[M=#method{name=Name,alias=A,params=Ps0,where=W,method_type=MT}|_]|R], Class,Skip,Done, Exported) when W =/= merged_c -> case gb_sets:is_member(Name,Skip) of @@ -399,8 +425,10 @@ gen_inherited_ms([[#method{name=Name,alias=A,params=Ps0,where=W,method_type=MT}| _ when W =:= erl_no_opt -> 0; _ -> 1 end, - Export = erl_func_name(Name,A) ++ "/" ++ integer_to_list(length(Args) + OptLen), - gen_inherited_ms(R,Class,Skip, gb_sets:add(Name,Done), [Export|Exported]); + {_, Depr} = deprecated(M,ignore), + Export = {Class,{erl_func_name(Name,A),integer_to_list(length(Args) + OptLen)}, Depr}, + gen_inherited_ms(R,Class,Skip, gb_sets:add(Name,Done), + [Export|Exported]); _ -> gen_inherited_ms(R,Class, Skip, Done, Exported) end; @@ -454,7 +482,7 @@ arg_type_test(#param{name=Name0,in=In,type=#type{base={class,T},single=true},def arg_type_test(#param{name=Name0,in=In,type=#type{base={class,T}}, def=none},EOS,Acc) when In =/= false -> Name = erl_arg_name(Name0), - w(" [?CLASS(~sT,~s) || #wx_ref{type=~sT} <- ~s],~s", [Name,T,Name,Name,EOS]), + w(" _ = [?CLASS(~sT,~s) || #wx_ref{type=~sT} <- ~s],~s", [Name,T,Name,Name,EOS]), Acc; arg_type_test(#param{name=Name0,def=none,in=In, type={merged, @@ -741,15 +769,15 @@ write_spec(Args, Optional, {complex, Res}, Eol) -> optional_type(Opts, Eol) -> "Option :: " ++ args(fun optional_type2/1, Eol++"\t\t | ", Opts). -optional_type2(#param{name=Name, def=Def, type=T}) -> - "{" ++ erl_option_name(Name) ++ ", " ++ doc_arg_type2(T) ++ "}". %% %% Default: " ++ Def. +optional_type2(#param{name=Name, def=_Def, type=T}) -> + "{'" ++ erl_option_name(Name) ++ "', " ++ doc_arg_type2(T) ++ "}". %% %% Default: " ++ Def. doc_link("utils", Func) -> - w("%% @doc See <a href=\"http://www.wxwidgets.org/manuals/stable/wx_miscellany.html#~s\">" + w("%% @doc See <a href=\"http://www.wxwidgets.org/manuals/2.8.12/wx_miscellany.html#~s\">" "external documentation</a>.~n", [lowercase_all(Func)]); doc_link(Class, Func) -> - w("%% @doc See <a href=\"http://www.wxwidgets.org/manuals/stable/wx_~s.html#~s~s\">" + w("%% @doc See <a href=\"http://www.wxwidgets.org/manuals/2.8.12/wx_~s.html#~s~s\">" "external documentation</a>.~n", [lowercase_all(Class),lowercase_all(Class),lowercase_all(Func)]). @@ -833,7 +861,7 @@ doc_arg_type3(T, _) -> ?error({unknown_type,T}). doc_return_types(T, Ps) -> doc_return_types2(T, [P || P=#param{in=In} <- Ps,In =/= true]). -doc_return_types2(void, []) -> {simple, "ok"}; +doc_return_types2(void, []) -> {simple, "'ok'"}; doc_return_types2(void, [#param{type=T}]) -> {simple, doc_arg_type2(T, out)}; doc_return_types2(T, []) -> {simple, doc_arg_type2(T, out)}; doc_return_types2(void, Ps) when length(Ps) < 4 -> @@ -1061,7 +1089,7 @@ gen_enums_ints() -> %% open_write("../include/wx.hrl"), opened in gen_event_recs w("~n%% Hardcoded Records~n", []), w("-record(wxMouseState, {x :: integer(), y :: integer(),~n" - " leftDown :: boolean(), middleDown :: boolean, rightDown :: boolean, ~n" + " leftDown :: boolean(), middleDown :: boolean(), rightDown :: boolean(), ~n" " controlDown :: boolean(), shiftDown :: boolean(),~n" " altDown :: boolean(), metaDown :: boolean(), cmdDown :: boolean()~n" " }).~n", []), @@ -1141,7 +1169,7 @@ build_enum_ints(#enum{from=From, vals=Vals},Done) -> const_value(V,_,_) when is_integer(V) -> integer_to_list(V); const_value(V = "16#" ++ IntList,_,_) -> - _ = http_util:hexlist_to_integer(IntList), %% ASSERT + _ = list_to_integer(IntList, 16), %% ASSERT V; const_value(V0, EnumClass, Ignore) -> try @@ -1192,7 +1220,7 @@ gen_event_recs() -> build_event_rec(Class=#class{name=Name, event=Evs}) -> EvTypes = [event_type_name(Ev) || Ev <- Evs], - Str = args(fun(Ev) -> Ev end, " | ", EvTypes), + Str = args(fun(Ev) -> "'" ++ Ev ++ "'" end, " | ", EvTypes), Attr = filter_attrs(Class), Rec = event_rec_name(Name), %%GetName = fun(#param{name=N}) ->event_attr_name(N) end, @@ -1343,4 +1371,3 @@ split_list(F, Keep, [M|Ms], Acc) -> split_list(_, _, [], []) -> []; split_list(_, _, [], Acc) -> [lists:reverse(Acc)]. - diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 81f2a389ab..786e536f93 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -2,18 +2,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2013. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. 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/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% 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. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% % @@ -31,7 +32,12 @@ %% wxALWAYS_NATIVE_DOUBLE_BUFFER, wxGAUGE_EMULATE_INDETERMINATE_MODE, - wxTR_DEFAULT_STYLE + wxTR_DEFAULT_STYLE, + wxSL_LABELS, + wxCURSOR_DEFAULT, + wxCURSOR_ARROWWAIT, + wxCURSOR_MAX, + wxLanguage ]}. {gvars, @@ -144,7 +150,12 @@ 'ShouldInheritColours','Show','Thaw','TransferDataFromWindow', 'TransferDataToWindow',%'UnregisterHotKey', 'Update','UpdateWindowUI','Validate', - 'WarpPointer']}. + 'WarpPointer', + {'SetTransparent', [{test_if, "wxCHECK_VERSION(2,8,12)"}]}, + {'CanSetTransparent', [{test_if, "wxCHECK_VERSION(2,8,12)"}]}, + {'IsDoubleBuffered', [{test_if, "wxCHECK_VERSION(3,0,0)"}]}, + {'SetDoubleBuffered', [{test_if, "wxCHECK_VERSION(3,0,0) && !defined(__WXMAC__)"}]} +]}. {class, wxTopLevelWindowGTK, wxWindow, [{alias, [{wxTopLevelWindowGTK, wxTopLevelWindow}]}], @@ -190,8 +201,9 @@ {class, wxPanel, wxWindow, [], ['wxPanel','~wxPanel',%'Create', %%'GetDefaultItem', - 'InitDialog'%, - %%'OnSysColourChanged', %'SetDefaultItem','SetFocus','SetFocusIgnoringChildren' + 'InitDialog', + %%'OnSysColourChanged', %'SetDefaultItem','SetFocus', + 'SetFocusIgnoringChildren' ]}. {class, wxScrolledWindow, wxPanel, [], @@ -360,7 +372,7 @@ {class,wxMirrorDC, wxDC, [], ['wxMirrorDC', '~wxMirrorDC']}. {class,wxScreenDC, wxDC, [], ['wxScreenDC', '~wxScreenDC']}. -{class,wxPostScriptDC,wxDC,[], +{class,wxPostScriptDC,wxDC,[{ifdef, wxUSE_POSTSCRIPT}], ['wxPostScriptDC','~wxPostScriptDC', {'SetResolution', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, {'GetResolution', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}]}. @@ -486,6 +498,8 @@ {class, wxToolBar, wxControl, [], ['AddControl','AddSeparator','AddTool','AddCheckTool','AddRadioTool', + {'AddStretchableSpace', [{test_if, "wxCHECK_VERSION(3,0,0)"}]}, + {'InsertStretchableSpace', [{test_if, "wxCHECK_VERSION(3,0,0)"}]}, 'DeleteTool','DeleteToolByPos','EnableTool','FindById','FindControl', 'FindToolForPosition','GetToolSize','GetToolBitmapSize','GetMargins', %%'GetToolClientData' , %%'SetToolClientData', @@ -504,7 +518,8 @@ [{'wxStatusBar',[{"size", skip_member}]}, '~wxStatusBar', {'Create',[{"size", skip_member}]}, - 'GetFieldRect','GetFieldsCount','GetStatusText','PopStatusText', + {'GetFieldRect', [{"rect", out}]}, + 'GetFieldsCount','GetStatusText','PopStatusText', 'PushStatusText', {'SetFieldsCount', [{"number", {def,none}}, {"widths", [{single, array}, {def, "(int *) NULL"}]}]}, @@ -549,14 +564,14 @@ {"alpha",[in,{base,binary}]}, {{4,pre_hook}, [{c, "if(!static_data) {" - "data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]}, + "data = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]}, {{5,pre_hook}, [{c, "if(!static_data) {" - " data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - " alpha = (unsigned char *) malloc(Ecmd.bin[1]->size);" - " memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);" - " memcpy(alpha,Ecmd.bin[1]->base,Ecmd.bin[1]->size);}"}]} + " data = (unsigned char *) malloc(Ecmd.bin[0].size);" + " alpha = (unsigned char *) malloc(Ecmd.bin[1].size);" + " memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);" + " memcpy(alpha,Ecmd.bin[1].base,Ecmd.bin[1].size);}"}]} ]}, '~wxImage',%'AddHandler', 'Blur','BlurHorizontal','BlurVertical', @@ -568,14 +583,14 @@ {"alpha",[in,{base,binary}]}, {{4,pre_hook}, [{c, "if(!static_data) {" - "data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]}, + "data = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]}, {{5,pre_hook}, [{c, "if(!static_data) {" - " data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - " alpha = (unsigned char *) malloc(Ecmd.bin[1]->size);" - " memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);" - " memcpy(alpha,Ecmd.bin[1]->base,Ecmd.bin[1]->size);}"}]} + " data = (unsigned char *) malloc(Ecmd.bin[0].size);" + " alpha = (unsigned char *) malloc(Ecmd.bin[1].size);" + " memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);" + " memcpy(alpha,Ecmd.bin[1].base,Ecmd.bin[1].size);}"}]} ]}, 'Destroy','FindFirstUnusedColour', % 'FindHandler', 'GetImageExtWildcard', @@ -601,14 +616,14 @@ {'SetAlpha', [{{2,"alpha"},[in,{base,binary}, {def, none}]}, {{2,pre_hook}, [{c, "if(!static_data) {" - "alpha = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(alpha,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]} + "alpha = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(alpha,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]} ]}, {'SetData', [{"data",[in,{base,binary}]}, {pre_hook, [{c, "if(!static_data) {" - "data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]} + "data = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]} ]}, 'SetMask','SetMaskColour','SetMaskFromImage','SetOption', 'SetPalette', @@ -787,9 +802,9 @@ 'CanRedo','CanUndo','Copy','Cut','GetInsertionPoint','GetLastPosition', 'GetValue','Paste','Redo','Replace','Remove','SetInsertionPoint', 'SetInsertionPointEnd','SetSelection','SetValue','Undo']}. -{class, wxGauge, wxControl, [], - ['wxGauge','~wxGauge','Create','GetBezelFace','GetRange','GetShadowWidth', - 'GetValue','IsVertical','SetBezelFace','SetRange','SetShadowWidth','SetValue', +{class, wxGauge, wxControl, [], + ['wxGauge','~wxGauge','Create','GetRange', + 'GetValue','IsVertical','SetRange','SetValue', 'Pulse']}. {class, wxGenericDirCtrl, wxControl, [], ['wxGenericDirCtrl','~wxGenericDirCtrl','Create','Init','CollapseTree', @@ -810,7 +825,7 @@ {"size",{def, "wxDefaultSize"}}, {"choices",{def, ""}}]}, '~wxListBox','Create','Deselect',{'GetSelections',[{"aSelections", [out]}]}, - {'InsertItems',2},'IsSelected',{'Set',[{"clientData",[skip]}]}, + {'InsertItems',2},'IsSelected',{'Set',[{"clientData",[nowhere]}, {"n", skip_member}]}, 'HitTest', 'SetFirstItem']}. @@ -829,7 +844,7 @@ 'GetItemSpacing','GetItemState', 'GetItemText','GetItemTextColour', 'GetNextItem','GetSelectedItemCount','GetTextColour','GetTopItem', - 'GetViewRect',{'HitTest',[{"pSubItem",nowhere}, {"flags", in}]}, + 'GetViewRect',{'HitTest',[{"pSubItem",out}]}, 'InsertColumn','InsertItem', %%'OnGetItemAttr', 'OnGetItemImage','OnGetItemText', 'RefreshItem','RefreshItems','ScrollList', @@ -875,6 +890,7 @@ {class, wxTextCtrl, wxControl, [], ['wxTextCtrl','~wxTextCtrl','AppendText','CanCopy','CanCut','CanPaste', 'CanRedo','CanUndo','Clear','Copy','Create','Cut','DiscardEdits', + 'ChangeValue', 'EmulateKeyPress','GetDefaultStyle','GetInsertionPoint','GetLastPosition', 'GetLineLength','GetLineText','GetNumberOfLines','GetRange','GetSelection', 'GetStringSelection','GetStyle','GetValue',%'HitTest', %no Mac @@ -1237,7 +1253,8 @@ 'SetArtProvider','SetDockSizeConstraint','SetFlags','SetManagedWindow', 'ShowHint','UnInit','Update']}. -{class, wxAuiPaneInfo, root, [{ifdef, wxUSE_AUI}], +{class, wxAuiPaneInfo, root, + [{ifdef, wxUSE_AUI}], [ wxAuiPaneInfo,'~wxAuiPaneInfo', 'BestSize','Bottom','BottomDockable','Caption','CaptionVisible', @@ -1254,7 +1271,44 @@ 'MinSize','MinimizeButton','Movable','Name', 'PaneBorder','PinButton','Position','Resizable','Right', 'RightDockable','Row','SafeSet','SetFlag','Show','ToolbarPane', - 'Top','TopDockable','Window']}. + 'Top','TopDockable','Window', + %% Extended func + %% These are not initilized by default and thus cause crashes + %% {'GetName', + %% [{pre_hook, [{c, "#if 0\n"}]}, + %% {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxString Result = This->name"}]}]}, + %% {'GetCaption', + %% [{pre_hook, [{c, "#if 0\n"}]}, + %% {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxString Result = This->caption"}]}]}, + %% {'GetIcon', + %% [{pre_hook, [{c, "#if 0\n"}]}, + %% {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxIcon Result = This->icon"}]}]}, + {'GetWindow', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxWindow* Result = This->window"}]}]}, + {'GetFrame', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxFrame* Result = This->frame"}]}]}, + {'GetDirection', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_direction"}]}]}, + {'GetLayer', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_layer"}]}]}, + {'GetRow', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_row"}]}]}, + {'GetPosition', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_pos"}]}]}, + {'GetFloatingPosition', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxPoint Result = This->floating_pos"}]}]}, + {'GetFloatingSize', + [{pre_hook, [{c, "#if 0\n"}]}, + {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxSize Result = This->floating_size"}]}]} + +]}. {class, wxAuiNotebook, wxControl, [{ifdef, wxUSE_AUI}], ['wxAuiNotebook','AddPage',%'AdvanceSelection', @@ -1273,15 +1327,22 @@ %'Clone','DrawBackground','DrawButton','DrawTab','GetBestTabCtrlSize', %'GetIndentSize','GetTabSize','SetFlags','SetMeasuringFont', %'SetNormalFont','SetSelectedFont','SetSizingInfo'%,'ShowWindowList' + 'SetFlags', 'SetMeasuringFont', 'SetNormalFont', 'SetSelectedFont', + {'SetColour', [{test_if, "wxCHECK_VERSION(3,0,0)"}]}, + {'SetActiveColour', [{test_if, "wxCHECK_VERSION(3,0,0)"}]} ]}. {class,wxAuiDockArt, root, [{ifdef, wxUSE_AUI}], [%% 'wxAuiDockArt','~wxAuiDockArt' %, %%'DrawBackground','DrawBorder','DrawCaption', %% Pure virtual funcs %%'DrawGripper','DrawPaneButton','DrawSash', - %%'GetColor','GetColour','GetFont','GetMetric','SetColor','SetColour','SetFont','SetMetric' + 'GetColour','GetFont','GetMetric','SetColour','SetFont','SetMetric' ]}. +{class,wxAuiSimpleTabArt, wxAuiTabArt, [{ifdef, wxUSE_AUI}], + [wxAuiSimpleTabArt]}. + + {class, wxMDIParentFrame, wxFrame, [], [ 'wxMDIParentFrame', @@ -1351,7 +1412,8 @@ wxEVT_SCROLL_THUMBRELEASE,wxEVT_SCROLL_CHANGED]}], ['GetOrientation','GetPosition']}. {class, wxScrollWinEvent,wxEvent, - [{event, + [{acc, [{m_commandInt, "GetPosition()"}, {m_extraLong, "GetOrientation()"}]}, + {event, [wxEVT_SCROLLWIN_TOP,wxEVT_SCROLLWIN_BOTTOM,wxEVT_SCROLLWIN_LINEUP, wxEVT_SCROLLWIN_LINEDOWN,wxEVT_SCROLLWIN_PAGEUP, wxEVT_SCROLLWIN_PAGEDOWN,wxEVT_SCROLLWIN_THUMBTRACK, @@ -1376,7 +1438,9 @@ 'ShiftDown' ]}. -{class, wxSetCursorEvent, wxEvent, [{event,[wxEVT_SET_CURSOR]}], +{class, wxSetCursorEvent, wxEvent, + [{acc, [{m_x, "GetX()"}, {m_y, "GetY()"}, {m_cursor, "GetCursor()"}]}, + {event,[wxEVT_SET_CURSOR]}], ['GetCursor','GetX','GetY','HasCursor','SetCursor']}. {class, wxKeyEvent, wxEvent, @@ -1391,7 +1455,7 @@ {class, wxSizeEvent, wxEvent, [{event,[wxEVT_SIZE]}], ['GetSize']}. -{class, wxMoveEvent, wxEvent, [{event,[wxEVT_MOVE]}], +{class, wxMoveEvent, wxEvent, [{acc, [{m_pos, "GetPosition()"}, {m_rect, "GetRect()"}]}, {event,[wxEVT_MOVE]}], ['GetPosition']}. {class, wxPaintEvent, wxEvent, [{event,[wxEVT_PAINT]}],[]}. %%{class, wxNcPaintEvent, wxEvent, [{event,[wxEVT_NC_PAINT]}],[]}. @@ -1400,28 +1464,28 @@ {event, [wxEVT_ERASE_BACKGROUND]}], ['GetDC']}. {class, wxFocusEvent, wxEvent, - [{event,[wxEVT_SET_FOCUS,wxEVT_KILL_FOCUS]}], + [{acc, [{m_win, "GetWindow()"}]}, + {event,[wxEVT_SET_FOCUS,wxEVT_KILL_FOCUS]}], ['GetWindow']}. {class,wxChildFocusEvent,wxCommandEvent, [{event,[wxEVT_CHILD_FOCUS]}], ['GetWindow']}. -%% {class, wxActivateEvent, wxEvent, [{event, -%% [wxEVT_ACTIVATE,wxEVT_ACTIVATE_APP,wxEVT_HIBERNATE]}],[]}. - -%%{class, wxInitDialogEvent, wxEvent, [{event, []}],[]}. - -{class, wxMenuEvent, wxEvent, - [{event, [wxEVT_MENU_OPEN,wxEVT_MENU_CLOSE,wxEVT_MENU_HIGHLIGHT]}], +{class, wxMenuEvent, wxEvent, + [{acc, [{m_menuId, "GetMenuId()"}, {m_menu, "GetMenu()"}]}, + {event, [wxEVT_MENU_OPEN,wxEVT_MENU_CLOSE,wxEVT_MENU_HIGHLIGHT]}], ['GetMenu','GetMenuId','IsPopup']}. {class, wxCloseEvent, wxEvent, [{event, [wxEVT_CLOSE_WINDOW,wxEVT_END_SESSION,wxEVT_QUERY_END_SESSION]}], ['CanVeto','GetLoggingOff','SetCanVeto','SetLoggingOff','Veto']}. -{class, wxShowEvent, wxEvent, [{event,[wxEVT_SHOW]}],['SetShow','GetShow']}. -{class, wxIconizeEvent, wxEvent, [{event,[wxEVT_ICONIZE]}],['Iconized']}. +{class, wxShowEvent, wxEvent, [{acc, [{m_show, "GetShow()"}]},{event,[wxEVT_SHOW]}],['SetShow','GetShow']}. +{class, wxIconizeEvent, wxEvent, [{acc, [{m_iconized, "Iconized()"}]},{event,[wxEVT_ICONIZE]}],['Iconized']}. {class, wxMaximizeEvent, wxEvent, [{event,[wxEVT_MAXIMIZE]}],[]}. -{class, wxJoystickEvent, wxEvent, - [{event,[wxEVT_JOY_BUTTON_DOWN,wxEVT_JOY_BUTTON_UP, +{class, wxJoystickEvent, wxEvent, + [{acc, [{m_pos, "GetPosition()"},{m_zPosition, "GetZPosition()"}, + {m_buttonChange, "GetButtonChange()"}, {m_buttonState, "GetButtonState()"}, + {m_joyStick, "GetJoystick()"}]}, + {event,[wxEVT_JOY_BUTTON_DOWN,wxEVT_JOY_BUTTON_UP, wxEVT_JOY_MOVE,wxEVT_JOY_ZMOVE]}], ['ButtonDown','ButtonIsDown','ButtonUp','GetButtonChange','GetButtonState', 'GetJoystick','GetPosition','GetZPosition','IsButton','IsMove','IsZMove']}. @@ -1459,7 +1523,8 @@ 'SetOrigin', 'SetPosition']}. -{class, wxContextMenuEvent, wxCommandEvent, [{event,[wxEVT_CONTEXT_MENU]}], +{class, wxContextMenuEvent, wxCommandEvent, + [{acc, [{m_pos, "GetPosition()"}]}, {event,[wxEVT_CONTEXT_MENU]}], ['GetPosition','SetPosition']}. {enum, wxIdleMode, "wxIDLE_"}. {class, wxIdleEvent, wxEvent, [{event,[wxEVT_IDLE]}], @@ -1518,7 +1583,8 @@ ]}. {class, wxCalendarEvent, wxDateEvent, - [{event,[wxEVT_CALENDAR_SEL_CHANGED, wxEVT_CALENDAR_DAY_CHANGED, + [{acc, [{m_date, "GetDate()"}, {m_wday, "GetWeekDay()"}]}, + {event,[wxEVT_CALENDAR_SEL_CHANGED, wxEVT_CALENDAR_DAY_CHANGED, wxEVT_CALENDAR_MONTH_CHANGED, wxEVT_CALENDAR_YEAR_CHANGED, wxEVT_CALENDAR_DOUBLECLICKED, wxEVT_CALENDAR_WEEKDAY_CLICKED]}], [ @@ -1575,9 +1641,14 @@ 'wxShutdown', {'wxShell', 1}, 'wxLaunchDefaultBrowser', {'wxGetEmailAddress',0}, {'wxGetUserId',0}, {'wxGetHomeDir',0}, 'wxNewId', 'wxRegisterId', 'wxGetCurrentId', - 'wxGetOsDescription', 'wxIsPlatformLittleEndian', 'wxIsPlatform64Bit' + 'wxGetOsDescription', 'wxIsPlatformLittleEndian', 'wxIsPlatform64Bit' + ]}. + +{class, gdicmn, static, [], + [ {'wxDisplaySize', [{"width", [out]}, {"height", [out]}]}, 'wxSetCursor' ]}. + {class, wxPrintout, object, [{alias, [{wxePrintout, wxePrintout}]}], [{'wxPrintout', [{where, taylormade}]},'~wxPrintout', 'GetDC', %% 'GetPageInfo',Callback @@ -1718,8 +1789,9 @@ ['GetKeyCode','GetItem','GetKeyEvent','GetLabel','GetOldItem','GetPoint', 'IsEditCancelled','SetToolTip']}. -{class, wxNotebookEvent, wxNotifyEvent, - [{event, [wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, +{class, wxNotebookEvent, wxNotifyEvent, + [{acc, [{m_nSel, "GetSelection()"}, {m_nOldSel, "GetOldSelection()"}]}, + {event, [wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING]}], ['GetOldSelection','GetSelection','SetOldSelection','SetSelection']}. @@ -1741,6 +1813,12 @@ 'Get' ]}. +{class, wxClipboardTextEvent, wxCommandEvent, + [{event, [wxEVT_COMMAND_TEXT_COPY, + wxEVT_COMMAND_TEXT_CUT, + wxEVT_COMMAND_TEXT_PASTE]}], + []}. + {class, wxSpinEvent, wxNotifyEvent, [{acc, [{m_commandInt, "GetPosition()"}]}, {event, [wxEVT_COMMAND_SPINCTRL_UPDATED, @@ -1844,7 +1922,7 @@ ]}. -{class, wxAuiManagerEvent, wxEvent, +{class, wxAuiManagerEvent, wxEvent, [{acc, [{button, "GetButton()"}, {dc, "GetDC()"}, {pane, "GetPane()"}, @@ -1854,6 +1932,7 @@ wxEVT_AUI_PANE_CLOSE, wxEVT_AUI_PANE_MAXIMIZE, wxEVT_AUI_PANE_RESTORE, + {wxEVT_AUI_PANE_ACTIVATED, {test_if, "wxCHECK_VERSION(2,9,5)"}}, wxEVT_AUI_RENDER, wxEVT_AUI_FIND_MANAGER ]}], @@ -1875,3 +1954,37 @@ [{event,[wxEVT_TASKBAR_MOVE,wxEVT_TASKBAR_LEFT_DOWN,wxEVT_TASKBAR_LEFT_UP, wxEVT_TASKBAR_RIGHT_DOWN,wxEVT_TASKBAR_RIGHT_UP, wxEVT_TASKBAR_LEFT_DCLICK,wxEVT_TASKBAR_RIGHT_DCLICK]}],[]}. + +{class, wxInitDialogEvent, wxEvent, [{event,[wxEVT_INIT_DIALOG]}], []}. + +{class, wxLocale, root, [{skip, [{'wxLocale', 5}, {'Init', 6}]}], + ['wxLocale', '~wxLocale', 'Init', + 'AddCatalog','AddCatalogLookupPathPrefix', + %%'AddLanguage','FindLanguageInfo', 'GetLanguageInfo', + 'GetCanonicalName','GetLanguage', + 'GetLanguageName','GetLocale','GetName','GetString', + 'GetHeaderValue', + 'GetSysName', + 'GetSystemEncoding','GetSystemEncodingName', + 'GetSystemLanguage', + 'IsLoaded','IsOk']}. + +{class, wxActivateEvent, wxEvent, + [{acc, [{m_active, "GetActive()"}]}, + {event, [wxEVT_ACTIVATE, wxEVT_ACTIVATE_APP, wxEVT_HIBERNATE]}], + ['GetActive']}. + +{class, wxPopupWindow, wxWindow, [{ifdef, wxUSE_POPUPWIN}], + ['wxPopupWindow', '~wxPopupWindow', 'Create', 'Position']}. + +{class, wxPopupTransientWindow, wxPopupWindow, [{ifdef, wxUSE_POPUPWIN}], + ['wxPopupTransientWindow', '~wxPopupTransientWindow', 'Popup', 'Dismiss']}. + +{class, wxMouseCaptureLostEvent, wxEvent, + [{event,[wxEVT_MOUSE_CAPTURE_LOST]}],[]}. + +{class, wxOverlay, root, [], + ['wxOverlay', '~wxOverlay', 'Reset']}. + +{class, wxDCOverlay, root, [], + ['wxDCOverlay', '~wxDCOverlay', 'Clear']}. |