diff options
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 1 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_erl.erl | 26 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 7 |
3 files changed, 26 insertions, 8 deletions
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 0f28b3dd5e..48a48e55d6 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -1274,6 +1274,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\"]", diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index a4b03d3fd1..5ac781b40c 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -44,7 +44,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,9 +58,8 @@ 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", []), @@ -67,17 +70,27 @@ gen_class1(C=#class{name=Name,parent="static",methods=Ms,options=_Opts}) -> 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); @@ -755,7 +768,7 @@ 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}) -> +optional_type2(#param{name=Name, def=_Def, type=T}) -> "{" ++ erl_option_name(Name) ++ ", " ++ doc_arg_type2(T) ++ "}". %% %% Default: " ++ Def. doc_link("utils", Func) -> @@ -1357,4 +1370,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 73c5af43d8..ed4a61e681 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -1577,9 +1577,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 |