aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-12-13 10:54:12 +0100
committerDan Gudmundsson <[email protected]>2013-01-09 11:44:27 +0100
commitc8b4d62cf92b3e0662adfb9e6a5d80d516413cde (patch)
tree0d244c8f2fdf2230e434b8140d2fa6cdb0b7d286 /lib/wx/api_gen
parent7771a19fa7e65b866a5c6a922adc636c1ec45a51 (diff)
downloadotp-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/api_gen')
-rw-r--r--lib/wx/api_gen/wx_gen.erl6
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl13
-rw-r--r--lib/wx/api_gen/wxapi.conf28
3 files changed, 32 insertions, 15 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']}.