diff options
author | Dan Gudmundsson <[email protected]> | 2012-10-24 15:16:04 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-01-09 11:41:40 +0100 |
commit | 0d2d008ecfc8e2f5c5d14ff38bf8da0d28a3fdb4 (patch) | |
tree | 6d5ac93431331879f8d8d7e94c62b7536976870b /lib/wx/api_gen | |
parent | 5f99f7197518fc93f0337834c26810f8ee949c39 (diff) | |
download | otp-0d2d008ecfc8e2f5c5d14ff38bf8da0d28a3fdb4.tar.gz otp-0d2d008ecfc8e2f5c5d14ff38bf8da0d28a3fdb4.tar.bz2 otp-0d2d008ecfc8e2f5c5d14ff38bf8da0d28a3fdb4.zip |
wx: Ifdef changed/removed functionality in wxWidgets-2.9.x
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 22 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen.hrl | 5 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 27 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 56 |
4 files changed, 76 insertions, 34 deletions
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 8c3b97f38e..cc1453158d 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -421,22 +421,30 @@ select_member(Several, #class{name=Class,file=Orig}, Defs0, Opts) -> parse_member(Data,MType,Virtual,Opts = #hs{fopt=Fopts}) -> Parse = fun(Con,A) -> parse_member2(Con,Opts,A) end, - Method = #method{name=MName,params=PS0} = + Method = #method{name=MName,params=PS0} = foldl(Parse, #method{method_type=MType, virtual=Virtual}, Data), %% Skip motif name's if it's last and optional PS2 = case PS0 of %% Backward order.. - [#param{name="name",def=Def,type=#type{name="wxString"}}|PS1] - when Def =/= none -> + [#param{name="name",def=Def,type=#type{name="wxString"}}|PS1] + when Def =/= none -> PS1; _ -> PS0 end, Sz = length(PS2), - PS = map(fun(P=#param{name=PName}) -> + PS = map(fun(P=#param{name=PName}) -> patch_param(MName,{Sz,PName},P,Fopts) end, PS2), - Alias = find_erl_alias_name(MName,PS,Fopts), - Method#method{params=PS, alias=Alias}. + Alias = find_erl_alias_name(MName,PS,Fopts), + FOpts = case gb_trees:lookup(MName, Fopts) of + {value, FuncO} when is_list(FuncO) -> + case lists:keyfind({func,Sz}, 1, FuncO) of + false -> FuncO; + {_, FuncNO} -> FuncNO + end; + _ -> [] + end, + Method#method{params=PS, alias=Alias, opts=FOpts}. find_erl_alias_name(MName,Ps,Fopts) -> case gb_trees:lookup(MName, Fopts) of @@ -527,7 +535,7 @@ add_param2(P=#param{name=Name},#hs{fopt=FOpt},M0=#method{name=MName,params=Ps}) M0#method{params=[Patched|Ps]} end. -patch_param(Method, Name, P, Opt) -> +patch_param(Method, Name, P, Opt) -> case gb_trees:lookup(Method,Opt) of none -> P; {value,NoArg} when is_integer(NoArg) -> P; diff --git a/lib/wx/api_gen/wx_gen.hrl b/lib/wx/api_gen/wx_gen.hrl index 426e3adfae..89577b9707 100644 --- a/lib/wx/api_gen/wx_gen.hrl +++ b/lib/wx/api_gen/wx_gen.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. 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 @@ -44,7 +44,8 @@ doc, % Extra documentation virtual, % Is virtual? pre_hook = [], % Pre hook before call in c-code - post_hook = [] % Post hook after call in c-code + post_hook = [], % Post hook after call in c-code + opts = [] % Options } ). diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 2209e4a53b..eb7a892f64 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -118,12 +118,18 @@ gen_constructors(#class{name=Class, methods=Ms0}) -> gen_constructor(_Class, #method{where=merged_c}) -> ok; gen_constructor(_Class, #method{where=erl_no_opt}) -> ok; -gen_constructor(Class, _M=#method{params=Ps}) -> +gen_constructor(Class, _M=#method{params=Ps, opts=FOpts}) -> Gen1 = fun(#param{name=N, type=T}) -> gen_type(T,1) ++ N end, Gen2 = fun(#param{name=N, type=T}) -> gen_type(T,2) ++ N end, CallA = fun(#param{name=N}) -> N end, HaveMergedType = fun(#param{type={merged,_,_,_,_,_,_}}) -> true; (_) -> false end, ?WTC("gen_constructor"), + Endif = case lists:keysearch(ifdef, 1, FOpts) of + {value, {ifdef, IfDef}} -> + w("#if ~s~n", [IfDef]), + true; + _ -> false + end, case lists:any(HaveMergedType, Ps) of false -> w(" E~s(~s) : ~s(~s) {};~n", @@ -133,7 +139,9 @@ gen_constructor(Class, _M=#method{params=Ps}) -> [Class,args(Gen1,",",Ps),Class,args(CallA,",",Ps)]), w(" E~s(~s) : ~s(~s) {};~n", [Class,args(Gen2,",",Ps),Class,args(CallA,",",Ps)]) - end. + end, + Endif andalso w("#endif~n", []), + ok. gen_type(#type{name=Type, ref={pointer,1}, mod=Mod},_) -> mods(Mod) ++ to_string(Type) ++ " * "; @@ -292,10 +300,16 @@ gen_method(CName, M=#method{name=N,params=[Ps],method_type=destructor,id=MethodI ignore end, M; -gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId}) -> +gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId, opts=FOpts}) -> put(current_func, N), put(bin_count,-1), ?WTC("gen_method"), + Endif = case lists:keysearch(ifdef, 1, FOpts) of + {value, {ifdef, IfDef}} -> + w("#if ~s~n", [IfDef]), + true; + _ -> false + end, 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), @@ -314,6 +328,7 @@ 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", []), erase(current_func), M. @@ -936,6 +951,12 @@ build_ret(Name,{ret,_},#type{base={comp,_,_},single=true, ref=reference}) -> w(" rt.add((*~s));~n",[Name]); build_ret(Name,_,#type{base={comp,_,_},single=true}) -> w(" rt.add(~s);~n",[Name]); +build_ret(Name = "ev->m_scanCode",_,#type{base=bool,single=true,by_val=true}) -> + %% Hardcoded workaround for 2.9 and later + w("#if !wxCHECK_VERSION(2,9,0)~n", []), + w(" rt.addBool(~s);~n",[Name]), + w("#else~n rt.addBool(false);~n",[]), + 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}) -> diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 943d7abb45..ca647c43ae 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -279,8 +279,9 @@ {class, wxGridCellEditor, root, [], ['Create', 'IsCreated', 'SetSize', 'Show', - 'PaintBackground', 'BeginEdit', 'EndEdit', 'Reset', 'StartingKey', - 'StartingClick', 'HandleReturn' + 'PaintBackground', 'BeginEdit', {'EndEdit', [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}, + 'Reset', 'StartingKey', + 'StartingClick', 'HandleReturn' %'Destroy','Clone','~wxGridCellEditor', ]}. @@ -319,7 +320,9 @@ {class, wxDC, object, [{skip, [{'DrawEllipse',5},{'DrawRectangle',5}, {'DrawRoundedRectangle',6},{'SetClippingRegion',5}]}], - [{'Blit',7},'CalcBoundingBox','Clear','ComputeScaleAndOrigin',{'CrossHair',1}, + [{'Blit',7},'CalcBoundingBox','Clear', + {'ComputeScaleAndOrigin',[{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}, + {'CrossHair',1}, 'DestroyClippingRegion','DeviceToLogicalX','DeviceToLogicalXRel', 'DeviceToLogicalY','DeviceToLogicalYRel',{'DrawArc',3},{'DrawBitmap',3}, {'DrawCheckMark',1},{'DrawCircle',2},'DrawEllipse',{'DrawEllipticArc',4}, @@ -345,16 +348,25 @@ {class,wxMirrorDC, wxDC, [], ['wxMirrorDC', '~wxMirrorDC']}. {class,wxScreenDC, wxDC, [], ['wxScreenDC', '~wxScreenDC']}. -{class,wxPostScriptDC,wxDC,[],['wxPostScriptDC','~wxPostScriptDC','SetResolution','GetResolution']}. -{class,wxWindowDC, wxDC, [], ['wxWindowDC', '~wxWindowDC']}. -{class,wxClientDC,wxWindowDC,[],['wxClientDC', '~wxClientDC']}. -{class,wxPaintDC, wxWindowDC, [], ['wxPaintDC', '~wxPaintDC']}. +{class,wxPostScriptDC,wxDC,[], + ['wxPostScriptDC','~wxPostScriptDC', + {'SetResolution', [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}, + {'GetResolution', [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}]}. +{class,wxWindowDC, wxDC, [], + [{'wxWindowDC', [{{func, 0}, [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxWindowDC']}. +{class,wxClientDC,wxWindowDC,[], + [{'wxClientDC', [{{func, 0}, [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxClientDC']}. +{class,wxPaintDC, wxWindowDC, [], + [{'wxPaintDC', [{{func, 0}, [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxPaintDC']}. %%{class,wxPrinterDC, wxDC, [], ['wxPrinterDC','GetPaperRect']}. Not in GTK {class,wxMemoryDC, wxDC, [], ['wxMemoryDC', '~wxMemoryDC','SelectObject','SelectObjectAsSource']}. {class,wxBufferedDC,wxMemoryDC,[],['wxBufferedDC','~wxBufferedDC','Init']}. {class,wxBufferedPaintDC,wxBufferedDC,[],['wxBufferedPaintDC', '~wxBufferedPaintDC']}. %% Only a typedef! -%%{class,wxAutoBufferedPaintDC,wxBufferedPaintDC,[],['wxAutoBufferedPaintDC']}. +%%{class,wxAutoBufferedPaintDC,wxBufferedPaintDC,[],['wxAutoBufferedPaintDC']}. {class, wxGraphicsObject, object, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], ['~wxGraphicsObject', 'GetRenderer','IsNull']}. @@ -362,8 +374,10 @@ [{ifdef, wxUSE_GRAPHICS_CONTEXT}, {skip, [{'StrokeLines',4}]}], ['~wxGraphicsContext', 'Create', %%CreateFromNative CreateFromNativeWindow - 'CreatePen','CreateBrush','CreateRadialGradientBrush', - 'CreateLinearGradientBrush','CreateFont','CreateMatrix', + 'CreatePen','CreateBrush', + {'CreateRadialGradientBrush', [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}, + {'CreateLinearGradientBrush', [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}, + 'CreateFont','CreateMatrix', 'CreatePath','Clip','ResetClip', 'DrawBitmap','DrawEllipse','DrawIcon', {'DrawLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}]}, @@ -1233,7 +1247,8 @@ {class, wxMDIParentFrame, wxFrame, [], [ - 'wxMDIParentFrame', '~wxMDIParentFrame', 'ActivateNext', 'ActivatePrevious', + 'wxMDIParentFrame', + '~wxMDIParentFrame', 'ActivateNext', 'ActivatePrevious', 'ArrangeIcons', 'Cascade', 'Create', %%'GetClientSize', 'GetToolBar', 'SetToolBar', defined in parent 'GetActiveChild', 'GetClientWindow', @@ -1244,8 +1259,9 @@ {class, wxMDIChildFrame, wxFrame, [], ['wxMDIChildFrame','~wxMDIChildFrame','Activate','Create','Maximize','Restore']}. -{class, wxMDIClientWindow, wxWindow, [], - ['wxMDIClientWindow','~wxMDIClientWindow','CreateClient']}. +{class, wxMDIClientWindow, wxWindow, [], + [{'wxMDIClientWindow', [{{func, 2}, [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}]}, + '~wxMDIClientWindow','CreateClient']}. {class, wxLayoutAlgorithm, object, [], ['wxLayoutAlgorithm', '~wxLayoutAlgorithm', @@ -1310,12 +1326,7 @@ [wxEVT_LEFT_DOWN,wxEVT_LEFT_UP,wxEVT_MIDDLE_DOWN,wxEVT_MIDDLE_UP, wxEVT_RIGHT_DOWN,wxEVT_RIGHT_UP,wxEVT_MOTION,wxEVT_ENTER_WINDOW, wxEVT_LEAVE_WINDOW,wxEVT_LEFT_DCLICK,wxEVT_MIDDLE_DCLICK, - wxEVT_RIGHT_DCLICK,wxEVT_MOUSEWHEEL, - wxEVT_NC_LEFT_DOWN,wxEVT_NC_LEFT_UP, - wxEVT_NC_MIDDLE_DOWN,wxEVT_NC_MIDDLE_UP,wxEVT_NC_RIGHT_DOWN, - wxEVT_NC_RIGHT_UP,wxEVT_NC_MOTION,wxEVT_NC_ENTER_WINDOW, - wxEVT_NC_LEAVE_WINDOW,wxEVT_NC_LEFT_DCLICK,wxEVT_NC_MIDDLE_DCLICK, - wxEVT_NC_RIGHT_DCLICK]}], + wxEVT_RIGHT_DCLICK,wxEVT_MOUSEWHEEL]}], ['AltDown','Button','ButtonDClick','ButtonDown','ButtonUp','CmdDown','ControlDown', 'Dragging', 'Entering', 'GetButton', 'GetPosition', 'GetLogicalPosition', 'GetLinesPerAction', 'GetWheelRotation', 'GetWheelDelta', 'GetX', 'GetY', @@ -1345,8 +1356,8 @@ ['GetSize']}. {class, wxMoveEvent, wxEvent, [{event,[wxEVT_MOVE]}], ['GetPosition']}. -{class, wxPaintEvent, wxEvent, [{event,[wxEVT_PAINT,wxEVT_PAINT_ICON]}],[]}. -{class, wxNcPaintEvent, wxEvent, [{event,[wxEVT_NC_PAINT]}],[]}. +{class, wxPaintEvent, wxEvent, [{event,[wxEVT_PAINT]}],[]}. +%%{class, wxNcPaintEvent, wxEvent, [{event,[wxEVT_NC_PAINT]}],[]}. {class, wxEraseEvent, wxEvent, [{acc, [{m_dc, "GetDC()"}]}, {event, [wxEVT_ERASE_BACKGROUND]}], @@ -1415,7 +1426,8 @@ ['GetPosition','SetPosition']}. {enum, wxIdleMode, "wxIDLE_"}. {class, wxIdleEvent, wxEvent, [{event,[wxEVT_IDLE]}], - ['CanSend','GetMode','RequestMore','MoreRequested','SetMode']}. + [{'CanSend', [{ifdef, "!wxCHECK_VERSION(2,9,0)"}]}, + 'GetMode','RequestMore','MoreRequested','SetMode']}. {class, wxGridEvent, wxNotifyEvent, [{acc, [{m_row, "GetRow()"}, {m_col, "GetCol()"}, {m_x, "GetPosition().x"},{m_y, "GetPosition().y"}, {m_selecting, "Selecting()"},{m_control,"ControlDown()"}, |