diff options
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r-- | lib/wx/api_gen/gl_gen.erl | 2 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_extra/added_func.h | 7 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 8 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 36 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_erl.erl | 2 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 7 |
6 files changed, 46 insertions, 16 deletions
diff --git a/lib/wx/api_gen/gl_gen.erl b/lib/wx/api_gen/gl_gen.erl index 8b24e38cc0..ab8f842d31 100644 --- a/lib/wx/api_gen/gl_gen.erl +++ b/lib/wx/api_gen/gl_gen.erl @@ -191,7 +191,7 @@ parse_define([#xmlElement{name=initializer,content=Contents}|_R],Def,_Os) -> try case Val0 of "0x" ++ Val1 -> - _ = http_util:hexlist_to_integer(Val1), + _ = list_to_integer(Val1, 16), Def#def{val=Val1, type=hex}; _ -> Val = list_to_integer(Val0), diff --git a/lib/wx/api_gen/wx_extra/added_func.h b/lib/wx/api_gen/wx_extra/added_func.h index 0698621c5f..417188cc8a 100644 --- a/lib/wx/api_gen/wx_extra/added_func.h +++ b/lib/wx/api_gen/wx_extra/added_func.h @@ -32,3 +32,10 @@ class wxToolBar { wxToolBarToolBase * AddStretchableSpace(); wxToolBarToolBase * InsertStretchableSpace(size_t pos); }; + + +class wxWindow { + public: + bool IsDoubleBuffered(); + void SetDoubleBuffered(bool on); +}; diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 5cf09e5eee..ec2c35cc0e 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -705,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) -> @@ -1373,7 +1375,7 @@ extract_enum3([#xmlElement{name=initializer,content=Cs}|_],_Id,[{Name,_}|Acc]) - 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), @@ -1429,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), @@ -1451,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_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index ed7b27f3bf..71b2038c56 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -116,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}) -> @@ -145,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},_) -> @@ -805,18 +818,21 @@ 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, _} -> ok; + {_, "wxGraphics" ++ _} -> ok; _ -> 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);"}; + case need_copy_constr(Type) of + true -> + {Type ++ " * Result = new E" ++ Type ++ "(", "); newPtr((void *) Result," + ++ "3, memenv);"}; + false -> + {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}) -> diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index 9df5cb853e..c28b9238dc 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -1169,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 diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index f5a6751696..b8458e901b 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -150,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}]}], |