diff options
author | Dan Gudmundsson <[email protected]> | 2016-09-28 13:08:10 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2016-09-28 13:08:10 +0200 |
commit | b271012d04897f788866760c1dea7d51b1b44a4d (patch) | |
tree | 28ae35fbd9d8d6ba7ef02b5a177fb5d9be8a09b7 /lib/wx/api_gen | |
parent | ee80c779c3ae7900e183c98f2568d386e03e3b66 (diff) | |
download | otp-b271012d04897f788866760c1dea7d51b1b44a4d.tar.gz otp-b271012d04897f788866760c1dea7d51b1b44a4d.tar.bz2 otp-b271012d04897f788866760c1dea7d51b1b44a4d.zip |
wx: Add simple dropfiles support
Added wxDropFiles event
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r-- | lib/wx/api_gen/wx_doxygen.conf | 2 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 34 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 7 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_erl.erl | 11 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 12 |
5 files changed, 41 insertions, 25 deletions
diff --git a/lib/wx/api_gen/wx_doxygen.conf b/lib/wx/api_gen/wx_doxygen.conf index f4d3c99ec0..a96db00254 100644 --- a/lib/wx/api_gen/wx_doxygen.conf +++ b/lib/wx/api_gen/wx_doxygen.conf @@ -252,7 +252,7 @@ PREDEFINED = \ wxUSE_POPUPWIN=1 \ wxUSE_SYSTEM_OPTIONS=1 \ wxUSE_INTL=1 \ - wxABI_VERSION=20809 \ + wxABI_VERSION=20812 \ __WXGTK24__=1 \ __WXGTK20__=1 \ __WXGTK__=1 \ diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index cfae2197f8..6979a600f3 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -271,33 +271,31 @@ parse_attr1([{{attr,_}, #xmlElement{content=C, attributes=Attrs}}|R], AttrList0, #param{where=nowhere} -> parse_attr1(R,AttrList0,Opts,Res); _ -> - case keysearch(prot, #xmlAttribute.name, Attrs) of - {value, #xmlAttribute{value = "public"}} -> - {Acc,AttrList} = attr_acc(Param0, AttrList0), - parse_attr1(R,AttrList,Opts, - [Param0#param{in=false,prot=public,acc=Acc}|Res]); - {value, #xmlAttribute{value = "protected"}} -> - {Acc,AttrList} = attr_acc(Param0, AttrList0), - parse_attr1(R,AttrList,Opts, - [Param0#param{in=false,prot=protected,acc=Acc}|Res]); - {value, #xmlAttribute{value = "private"}} -> - {Acc,AttrList} = attr_acc(Param0, AttrList0), - parse_attr1(R,AttrList,Opts, - [Param0#param{in=false,prot=private,acc=Acc}|Res]) - end + {value, #xmlAttribute{value=Type}} = + keysearch(prot, #xmlAttribute.name, Attrs), + {Param,AttrList} = attr_acc(Param0, list_to_atom(Type), AttrList0), + parse_attr1(R,AttrList,Opts,[Param|Res]) end; parse_attr1([{_Id,_}|R],AttrList,Info, Res) -> parse_attr1(R,AttrList,Info, Res); parse_attr1([],Left,_, Res) -> {reverse(Res), Left}. -attr_acc(#param{name=N}, List) -> +attr_acc(#param{name=N}=P, Type, List) -> Name = list_to_atom(N), case get_value(Name, List, undefined) of - undefined -> {undefined, List}; - Val -> {Val, lists:keydelete(Name,1,List)} + undefined -> {P#param{in=false,prot=Type,acc=undefined}, List}; + Val when is_list(Val), is_integer(hd(Val)) -> + %% Function String + {P#param{in=false,prot=Type,acc=Val}, lists:keydelete(Name,1,List)}; + OptList when is_list(OptList) -> + Param = foldl(fun handle_param_opt/2,P,OptList), + {Param#param{in=false,prot=Type,acc=undefined}, + lists:keydelete(Name,1,List)}; + Val -> + {P#param{in=false,prot=Type,acc=Val}, lists:keydelete(Name,1,List)} end. - + load_members(FileName, Class, Defs, Tab, Type,Opts) -> File = filename:join(["wx_xml",FileName ++ ".xml"]), put({loaded, FileName}, true), diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 84d3990786..0a0b1f9209 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -1079,6 +1079,13 @@ build_ret(Name,_,#type{base=string,single=true}) -> w(" rt.add(~s);~n",[Name]); build_ret(Name,_,#type{name="wxArrayString", single=array}) -> w(" rt.add(~s);~n", [Name]); +build_ret(Name,_,#type{name="wxString", single={list,Variable}}) -> + Obj = case Name of + "ev->" ++ _ -> "ev"; + _ -> "This" + end, + w(" wxArrayString tmpArrayStr(~s->~s, ~s);~n", [Obj,Variable,Name]), + w(" rt.add(tmpArrayStr);~n", []); build_ret(Name,In,T) -> ?error({nyi, Name,In, T}). diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index 794de25002..05dc540a16 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -801,8 +801,13 @@ doc_arg_type(_, _) -> skip. doc_arg_type2(T) -> doc_arg_type2(T, in). -doc_arg_type2(T=#type{single=Single}, Out) when Single =:= array; Single =:= list -> - "[" ++ doc_arg_type3(T, Out) ++ "]"; +doc_arg_type2(T=#type{single=Single}, Out) -> + case Single of + array -> "[" ++ doc_arg_type3(T, Out) ++ "]"; + list -> "[" ++ doc_arg_type3(T, Out) ++ "]"; + {list, _} -> "[" ++ doc_arg_type3(T, Out) ++ "]"; + true -> doc_arg_type3(T, Out) + end; doc_arg_type2(T, Out) -> doc_arg_type3(T, Out). @@ -1207,7 +1212,7 @@ gen_event_recs() -> w("-type wx() :: #wx{}. %% wx event record ~n",[]), w("%% Here comes the definitions of all event records.~n" "%% they contain the event type and possible some extra information.~n~n",[]), - Events = [build_event_rec(C) || {_,C=#class{event=Evs}} <- get(), Evs =/= false], + Events = [build_event_rec(C) || {_,C=#class{event=Evs}} <- lists:sort(get()), Evs =/= false], EventSubTypes = [Type || {_Rec, Type} <- Events], EventRecs = [Rec || {Rec, _Type} <- Events], w("-type event() :: ~s.~n", diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 786e536f93..33c51af236 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -104,7 +104,8 @@ 'Center','CenterOnParent','Centre','CentreOnParent','ClearBackground', {'ClientToScreen',[{"x",both},{"y",both}]}, 'Close', 'ConvertDialogToPixels','ConvertPixelsToDialog','Destroy','DestroyChildren', - 'Disable',%%'DoGetBestSize','DoUpdateWindowUI', 'DragAcceptFiles', + 'Disable',%%'DoGetBestSize','DoUpdateWindowUI', + %% {'DragAcceptFiles', [{test_if, "wxCHECK_VERSION(2,8,10)"}]}, 'Enable', 'FindFocus','FindWindow','FindWindowById','FindWindowByName','FindWindowByLabel', 'Fit','FitInside','Freeze', 'GetAcceleratorTable', % 'GetAccessible', @@ -1490,8 +1491,6 @@ ['ButtonDown','ButtonIsDown','ButtonUp','GetButtonChange','GetButtonState', 'GetJoystick','GetPosition','GetZPosition','IsButton','IsMove','IsZMove']}. -%% {class, wxDropFilesEvent, wxEvent, [{event,[wxEVT_DROP_FILES]}],[]}. %FIXME - {enum, wxUpdateUIMode, "wxUPDATE_UI_"}. {class, wxUpdateUIEvent, wxCommandEvent, @@ -1988,3 +1987,10 @@ {class, wxDCOverlay, root, [], ['wxDCOverlay', '~wxDCOverlay', 'Clear']}. + +{class, wxDropFilesEvent, wxEvent, + [{acc, [{m_files, [{single, {list, 'm_noFiles'}}]}]}, + {event,[wxEVT_DROP_FILES]}], + ['GetPosition', 'GetNumberOfFiles', + {'GetFiles', [{return, [{single, {list, 'm_noFiles'}}]}]} + ]}. |