diff options
author | Dan Gudmundsson <[email protected]> | 2012-12-13 10:54:12 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-01-09 11:44:27 +0100 |
commit | c8b4d62cf92b3e0662adfb9e6a5d80d516413cde (patch) | |
tree | 0d244c8f2fdf2230e434b8140d2fa6cdb0b7d286 /lib/wx | |
parent | 7771a19fa7e65b866a5c6a922adc636c1ec45a51 (diff) | |
download | otp-c8b4d62cf92b3e0662adfb9e6a5d80d516413cde.tar.gz otp-c8b4d62cf92b3e0662adfb9e6a5d80d516413cde.tar.bz2 otp-c8b4d62cf92b3e0662adfb9e6a5d80d516413cde.zip |
wx: Fix changed getfunctions
wx-2.9 have changed some functions from returning references to objects to
returning objects instead
Diffstat (limited to 'lib/wx')
-rw-r--r-- | lib/wx/api_gen/wx_gen.erl | 6 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 13 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 28 | ||||
-rw-r--r-- | lib/wx/c_src/gen/wxe_funcs.cpp | 28 |
4 files changed, 46 insertions, 29 deletions
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl index 53bf9a6ecb..d3d0a78af2 100644 --- a/lib/wx/api_gen/wx_gen.erl +++ b/lib/wx/api_gen/wx_gen.erl @@ -576,9 +576,11 @@ handle_param_opt({single,Opt}, P=#param{type=T}) -> P#param{type=T#type{single= handle_param_opt({base,Enum={enum,Type}}, P=#param{type=T}) -> P#param{type=T#type{base=Enum, name=Type}}; handle_param_opt({base,Opt}, P=#param{type=T}) -> P#param{type=T#type{base=Opt}}; handle_param_opt({c_only,Opt},P) -> P#param{where=c, alt=Opt}; -handle_param_opt({ref, pointer}, P=#param{type=T}) -> +handle_param_opt({ref, pointer}, P=#param{type=T}) -> P#param{type=T#type{by_val=false,ref={pointer, 1}}}; -handle_param_opt({mod,Mods}, P=#param{type=T=#type{mod=Mods0}}) -> +handle_param_opt({by_val, true}, P=#param{type=T}) -> + P#param{type=T#type{by_val=true}}; +handle_param_opt({mod,Mods}, P=#param{type=T=#type{mod=Mods0}}) -> P#param{type=T#type{mod=Mods++Mods0}}. get_opt(Opt, Method, Sz, Opts) -> diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 7027ac305d..08f8068555 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -769,7 +769,7 @@ return_res1(#type{name=Type,ref={pointer,_}, base={term,_}}) -> {Type ++ " * Result = (" ++ Type ++ "*)", ""}; return_res1(#type{name=Type,ref={pointer,_}}) -> {Type ++ " * Result = (" ++ Type ++ "*)", ""}; -return_res1(#type{name=Type,single=true,ref=reference}) -> +return_res1(#type{name=Type,single=true,by_val=false,ref=reference}) -> {Type ++ " * Result = &", ""}; return_res1(#type{name=Type,single=true,by_val=true}) when is_atom(Type) -> @@ -792,8 +792,13 @@ return_res1(#type{name=Type,single=true,by_val=true, base={class, _}}) -> io:format("~s::~s Building return value of temp ~s~n", [get(current_class),get(current_func),Type]) end, - %% #class{id=Id} = get({class,Type}), - {Type ++ " * Result = new " ++ Type ++ "(", "); newPtr((void *) Result," + %% ClassDef = get({class,Type}), + %% Class = case is_derived(ClassDef) of + %% true -> "E" ++ Type; + %% false -> Type + %% end, + Class = Type, %% Remove + {Class ++ " * Result = new " ++ Class ++ "(", "); newPtr((void *) Result," ++ "3, memenv);"}; return_res1(#type{base={enum,_Type},single=true,by_val=true}) -> {"int Result = " , ""}; @@ -955,6 +960,8 @@ build_ret(Name,_,#type{base={enum,_Type},single=true}) -> w(" rt.addInt(~s);~n",[Name]); build_ret(Name,_,#type{base={comp,_,{record, _}},single=true}) -> w(" rt.add(~s);~n", [Name]); +build_ret(Name,{ret,_},#type{base={comp,_,_},single=true, by_val=true}) -> + w(" rt.add(~s);~n",[Name]); 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}) -> diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 4610f80234..94142ff6ba 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -148,7 +148,8 @@ {class, wxTopLevelWindowGTK, wxWindow, [{alias, [{wxTopLevelWindowGTK, wxTopLevelWindow}]}], - ['GetIcon','GetIcons','GetTitle','IsActive','Iconize', + [{'GetIcon', [{return, {by_val, true}}]}, + 'GetIcons','GetTitle','IsActive','Iconize', 'IsFullScreen','IsIconized','IsMaximized','Maximize', 'RequestUserAttention','SetIcon','SetIcons', 'CenterOnScreen', 'CentreOnScreen', @@ -532,8 +533,7 @@ {class, wxIconBundle, root, [], ['wxIconBundle','~wxIconBundle','AddIcon', - 'GetIcon']}. -%% {'GetIcon', [{return, {by_val, true}}]}]}. + {'GetIcon', [{return, {by_val, true}}]}]}. {class, wxCursor, wxBitmap,[], [{'wxCursor',[{{func, 5}, [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, @@ -615,11 +615,14 @@ 'SetRGB']}. {class, wxBrush, object, [], - ['wxBrush','~wxBrush','GetColour','GetStipple','GetStyle', + ['wxBrush','~wxBrush', + {'GetColour', [{return, {by_val, true}}]}, + 'GetStipple','GetStyle', 'IsHatch','IsOk','SetColour','SetStipple','SetStyle']}. {class, wxPen, object, [], - ['wxPen','~wxPen','GetCap','GetColour', + ['wxPen','~wxPen','GetCap', + {'GetColour', [{return, {by_val, true}}]}, %%'GetDashes', %'GetStipple', 'GetJoin', 'GetStyle','GetWidth','IsOk', {'SetCap', [{"capStyle", [{base, {enum, "wxPenCap"}}]}]}, @@ -724,8 +727,11 @@ ['wxButton','~wxButton','Create',%'GetLabel', 'GetDefaultSize', 'SetDefault','SetLabel']}. {class, wxBitmapButton, wxButton, [], - ['wxBitmapButton','~wxBitmapButton','Create','GetBitmapDisabled', - 'GetBitmapFocus','GetBitmapLabel','GetBitmapSelected', + ['wxBitmapButton','~wxBitmapButton','Create', + {'GetBitmapDisabled', [{return, {by_val, true}}]}, + {'GetBitmapFocus', [{return, {by_val, true}}]}, + {'GetBitmapLabel', [{return, {by_val, true}}]}, + {'GetBitmapSelected', [{return, {by_val, true}}]}, 'SetBitmapDisabled','SetBitmapFocus','SetBitmapLabel','SetBitmapSelected']}. {class, wxToggleButton, wxControl, [], ['wxToggleButton','~wxToggleButton','Create','GetValue','SetValue']}. @@ -734,7 +740,8 @@ {class, wxDateTime, root, [ignore], []}. %% Only for ifdefs and enums {class, wxCalendarCtrl, wxControl, [], - ['wxCalendarCtrl','Create','~wxCalendarCtrl','SetDate','GetDate', + ['wxCalendarCtrl','Create','~wxCalendarCtrl','SetDate', + {'GetDate', [{return, {by_val, true}}]}, {'EnableYearChange', [{deprecated, "!wxCHECK_VERSION(2,9,0)"}]}, %% Temp bug in wx I assume 'EnableMonthChange','EnableHolidayDisplay', 'SetHeaderColours','GetHeaderColourFg','GetHeaderColourBg', @@ -858,8 +865,9 @@ {enum, wxTextAttrAlignment, "wxTEXT_ALIGNMENT_"}. {class, wxTextAttr, root, [], - ['wxTextAttr','GetAlignment','GetBackgroundColour','GetFont','GetLeftIndent', - 'GetLeftSubIndent','GetRightIndent','GetTabs','GetTextColour', + ['wxTextAttr','GetAlignment','GetBackgroundColour', + {'GetFont', [{return, {by_val, true}}]}, + 'GetLeftIndent','GetLeftSubIndent','GetRightIndent','GetTabs','GetTextColour', 'HasBackgroundColour','HasFont','HasTextColour','GetFlags','IsDefault', 'SetAlignment','SetBackgroundColour','SetFlags','SetFont','SetLeftIndent', 'SetRightIndent','SetTabs','SetTextColour']}. diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp index b5ac38f1af..9b3c5b7b0a 100644 --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -1670,7 +1670,7 @@ case wxWindow_WarpPointer: { // wxWindow::WarpPointer case wxTopLevelWindow_GetIcon: { // wxTopLevelWindow::GetIcon wxTopLevelWindow *This = (wxTopLevelWindow *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxIcon * Result = &This->GetIcon(); + const wxIcon * Result = new wxIcon(This->GetIcon()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -9283,7 +9283,7 @@ case wxIconBundle_GetIcon_1_1: { // wxIconBundle::GetIcon int * sizeH = (int *) bp; bp += 4; wxSize size = wxSize(*sizeW,*sizeH); if(!This) throw wxe_badarg(0); - const wxIcon * Result = &This->GetIcon(size); + const wxIcon * Result = new wxIcon(This->GetIcon(size)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -9297,7 +9297,7 @@ case wxIconBundle_GetIcon_1_0: { // wxIconBundle::GetIcon } break; }}; if(!This) throw wxe_badarg(0); - const wxIcon * Result = &This->GetIcon(size); + const wxIcon * Result = new wxIcon(This->GetIcon(size)); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxIcon"); break; } @@ -10306,8 +10306,8 @@ case wxBrush_new_1: { // wxBrush::wxBrush case wxBrush_GetColour: { // wxBrush::GetColour wxBrush *This = (wxBrush *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxColour * Result = &This->GetColour(); - rt.add((*Result)); + wxColour Result = This->GetColour(); + rt.add(Result); break; } case wxBrush_GetStipple: { // wxBrush::GetStipple @@ -10409,8 +10409,8 @@ case wxPen_GetCap: { // wxPen::GetCap case wxPen_GetColour: { // wxPen::GetColour wxPen *This = (wxPen *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - wxColour * Result = &This->GetColour(); - rt.add((*Result)); + wxColour Result = This->GetColour(); + rt.add(Result); break; } case wxPen_GetJoin: { // wxPen::GetJoin @@ -13313,28 +13313,28 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4; case wxBitmapButton_GetBitmapDisabled: { // wxBitmapButton::GetBitmapDisabled wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapDisabled(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapDisabled()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } case wxBitmapButton_GetBitmapFocus: { // wxBitmapButton::GetBitmapFocus wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapFocus(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapFocus()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } case wxBitmapButton_GetBitmapLabel: { // wxBitmapButton::GetBitmapLabel wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapLabel(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapLabel()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } case wxBitmapButton_GetBitmapSelected: { // wxBitmapButton::GetBitmapSelected wxBitmapButton *This = (wxBitmapButton *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxBitmap * Result = &This->GetBitmapSelected(); + const wxBitmap * Result = new wxBitmap(This->GetBitmapSelected()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxBitmap"); break; } @@ -13560,8 +13560,8 @@ case wxCalendarCtrl_SetDate: { // wxCalendarCtrl::SetDate case wxCalendarCtrl_GetDate: { // wxCalendarCtrl::GetDate wxCalendarCtrl *This = (wxCalendarCtrl *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxDateTime * Result = &This->GetDate(); - rt.add((*Result)); + const wxDateTime Result = This->GetDate(); + rt.add(Result); break; } #if !wxCHECK_VERSION(2,9,0) @@ -16464,7 +16464,7 @@ case wxTextAttr_GetBackgroundColour: { // wxTextAttr::GetBackgroundColour case wxTextAttr_GetFont: { // wxTextAttr::GetFont wxTextAttr *This = (wxTextAttr *) getPtr(bp,memenv); bp += 4; if(!This) throw wxe_badarg(0); - const wxFont * Result = &This->GetFont(); + const wxFont * Result = new wxFont(This->GetFont()); newPtr((void *) Result,3, memenv);; rt.addRef(getRef((void *)Result,memenv), "wxFont"); break; } |