diff options
Diffstat (limited to 'lib/wx/api_gen/wx_gen_cpp.erl')
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index ea5d89be72..31ed1374c2 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -235,24 +235,27 @@ gen_funcs(Defs) -> "wxFileDataObject", "wxTextDataObject", "wxBitmapDataObject" ], - w("void WxeApp::delete_object(void *ptr, wxeRefData *refd) {~n", []), + w("bool WxeApp::delete_object(void *ptr, wxeRefData *refd) {~n", []), w(" switch(refd->type) {~n", []), - Case = fun(#class{name=Class, id=Id, abstract=IsAbs, parent=P}) when P /= "static" -> + 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}) -> @@ -401,6 +404,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"}) -> @@ -997,6 +1002,8 @@ build_ret(Name,_,#type{base=float,single=true}) -> 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}) -> |