aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2010-01-19 14:25:18 +0000
committerErlang/OTP <[email protected]>2010-01-19 14:25:18 +0000
commit7aeea26018246415dbfa829f134040b3eefa1ee2 (patch)
tree5109c4f2cd32f6b4143511dd8481928cec525dec /lib/wx/api_gen
parentb0b1c57b2256c0081b8e43b0c8799c71e30016fe (diff)
downloadotp-7aeea26018246415dbfa829f134040b3eefa1ee2.tar.gz
otp-7aeea26018246415dbfa829f134040b3eefa1ee2.tar.bz2
otp-7aeea26018246415dbfa829f134040b3eefa1ee2.zip
wx: Improved wxTreeCtrl.
Changed representation of wxTreeItem to be int. This saves memory, where the driver don't need to keep a reference map for every tree item. And added getFirstChild and getNextChild to wxTreeCtrl.
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r--lib/wx/api_gen/wx_gen.erl19
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl30
-rw-r--r--lib/wx/api_gen/wx_gen_erl.erl19
-rw-r--r--lib/wx/api_gen/wxapi.conf21
4 files changed, 56 insertions, 33 deletions
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl
index 50dd2d6f51..780bb2e741 100644
--- a/lib/wx/api_gen/wx_gen.erl
+++ b/lib/wx/api_gen/wx_gen.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. 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
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%% Api wrapper generator
@@ -699,10 +699,12 @@ parse_type2([N="wxArrayInt"|R],Info,Opts,T) ->
parse_type2(R,Info,Opts,T#type{name=N,base=int,single=array});
parse_type2([N="wxArrayDouble"|R],Info,Opts,T) ->
parse_type2(R,Info,Opts,T#type{name=N,base=double,single=array});
-parse_type2([N="wxTreeItemId"|R],Info,Opts,T) ->
- parse_type2(R,Info,Opts,T#type{name=N,base={ref,N}});
+parse_type2([N="wxTreeItemId"|R],Info,Opts,T) -> %% Use Pointer as Ids
+ parse_type2(R,Info,Opts,T#type{name=N,base=int64});
+parse_type2([N="wxTreeItemIdValue"|R],Info,Opts,T) -> %% Use Pointer as Ids
+ parse_type2(R,Info,Opts,T#type{name=N,base=int64});
parse_type2([N="wxArrayTreeItemIds"|R],Info,Opts,T) ->
- parse_type2(R,Info,Opts,T#type{name=N,base={ref,"wxTreeItemId"},single=array});
+ parse_type2(R,Info,Opts,T#type{name=N,base=int64,single=array});
parse_type2([N="wxTreeItemData"|R],Info,Opts,T) ->
parse_type2(R,Info,Opts,T#type{name="wxETreeItemData",base={term,N}});
parse_type2([N="wxClientData"|R],Info,Opts,T) ->
@@ -1082,6 +1084,7 @@ type_foot_print(#type{base=long}) -> int;
type_foot_print(#type{base=binary}) -> binary;
type_foot_print(#type{base={binary,_}}) -> binary;
type_foot_print(#type{base=int}) -> int;
+type_foot_print(#type{base=int64}) -> int;
type_foot_print(#type{base=bool}) -> bool;
%%type_foot_print(#type{base=datetime}) -> datetime;
type_foot_print(#type{base=float}) -> float;
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl
index fd0bea04ae..423dcd0179 100644
--- a/lib/wx/api_gen/wx_gen_cpp.erl
+++ b/lib/wx/api_gen/wx_gen_cpp.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. 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
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%%-------------------------------------------------------------------
@@ -309,6 +309,8 @@ declare_type(N,false,_,#type{name="wxArrayTreeItemIds",ref=reference}) ->
w(" wxArrayTreeItemIds ~s;~n", [N]);
declare_type(N,false,_,#type{name="wxDateTime"}) ->
w(" wxDateTime ~s;~n", [N]);
+declare_type(N,false,_,#type{name=Type, base=int64, ref=reference}) ->
+ w(" ~s ~s;~n", [Type,N]);
declare_type(N,true,Def,#type{base=Base,single=true,name=Type,by_val=true})
when Base =:= int; Base =:= long; Base =:= float; Base =:= double; Base =:= bool ->
w(" ~s ~s=~s;~n", [Type,N,Def]);
@@ -478,9 +480,13 @@ decode_arg(N,#type{base={comp,_,List},single=true,name=Type,ref=Ref},Arg,A0) ->
{double, _} -> 0
end;
-decode_arg(N,#type{name=Class,base={ref,"wxTreeItemId"},single=true},Arg,A0) ->
- A = align(A0,32),
- wa(" ~s ",[Class],"~s = wxTreeItemId(getPtr(bp,memenv)); bp += 4;~n",[N],Arg),
+decode_arg(N,#type{name=Class="wxTreeItemId",single=true},Arg,A0) ->
+ A = align(A0,64),
+ wa(" ~s ",[Class],"~s = wxTreeItemId((void *) *(wxUint64 *) bp); bp += 8;~n",[N],Arg),
+ A;
+decode_arg(N,#type{name=Class="wxTreeItemIdValue",single=true},Arg,A0) ->
+ A = align(A0,64),
+ wa(" ~s ",[Class],"~s = (~s) * (wxUint64 *) bp; bp += 8;~n",[N,Class],Arg),
A;
decode_arg(N,#type{name="wxChar", single=S},Arg,A0)
when S =/= true ->
@@ -851,8 +857,10 @@ build_ret_types(Type,Ps) ->
build_ret(Name,_,#type{base={class,Class},single=true}) ->
w(" rt.addRef(getRef((void *)~s,memenv), \"~s\");~n",[Name,Class]);
-build_ret(Name,_,#type{base={ref,"wxTreeItemId"=Class},single=true}) ->
- w(" rt.addRef(getRef((void *)~s.m_pItem,memenv), \"~s\");~n",[Name,Class]);
+build_ret(Name,_,#type{name="wxTreeItemId",single=true}) ->
+ w(" rt.add((wxUIntPtr *) ~s.m_pItem);~n",[Name]);
+build_ret(Name,_,#type{name="wxTreeItemIdValue",single=true}) ->
+ w(" rt.add((wxUIntPtr *) ~s);~n",[Name]);
build_ret(Name,_,#type{base={term,_},single=true}) ->
w(" rt.addExt2Term(~s);~n", [Name]);
build_ret(Name,_,#type{base={binary,Size},single=true}) ->
@@ -897,7 +905,7 @@ build_ret(Name,_,#type{name=List,single=list,base={class,Class}}) ->
build_ret(Name,_,#type{name="wxArrayTreeItemIds"}) ->
w(" for(unsigned int i=0; i < ~s.GetCount(); i++) {~n", [Name]),
- w(" rt.addRef(getRef((void *)~s[i].m_pItem,memenv), \"wxTreeItemId\");}~n",[Name]),
+ w(" rt.add((wxUIntPtr *)~s[i].m_pItem);}~n",[Name]),
w(" rt.endList(~s.GetCount());~n",[Name]);
build_ret(Name,_,#type{base=float,single=true}) ->
diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl
index 64c11baec1..c31d7d2a92 100644
--- a/lib/wx/api_gen/wx_gen_erl.erl
+++ b/lib/wx/api_gen/wx_gen_erl.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. 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
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%%-------------------------------------------------------------------
@@ -575,6 +575,8 @@ guard_test(#param{name=Name,type=#type{single=Single}})
"is_list(" ++ erl_arg_name(Name) ++ ")";
guard_test(#param{name=N,type=#type{base=int}}) ->
"is_integer(" ++ erl_arg_name(N) ++ ")";
+guard_test(#param{name=N,type=#type{base=int64}}) ->
+ "is_integer(" ++ erl_arg_name(N) ++ ")";
guard_test(#param{name=N,type=#type{base=long}}) ->
"is_integer(" ++ erl_arg_name(N) ++ ")";
guard_test(#param{name=N,type=#type{base=float}}) ->
@@ -603,6 +605,7 @@ guard_test(#param{name=N,type=#type{base={comp,"wxColour",_Tup}}}) ->
"tuple_size(" ++ erl_arg_name(N) ++ ") =:= 3; tuple_size(" ++ erl_arg_name(N) ++ ") =:= 4";
guard_test(#param{name=N,type=#type{base={comp,_,Tup}}}) ->
Doc = fun({int,V}) -> "is_integer("++erl_arg_name(N)++V ++")";
+ ({int64,V}) -> "is_integer("++erl_arg_name(N)++V ++")";
({double,V}) -> "is_number("++erl_arg_name(N)++V ++")"
end,
args(Doc, ",", Tup);
@@ -768,7 +771,9 @@ doc_arg_type3(#type{name="wxArrayString"}) -> "[string()]";
doc_arg_type3(#type{name="wxDateTime"}) -> "wx:datetime()";
doc_arg_type3(#type{name="wxArtClient"}) -> "string()";
doc_arg_type3(#type{base=int}) -> "integer()";
+doc_arg_type3(#type{base=int64}) -> "integer()";
doc_arg_type3(#type{base=long}) -> "integer()";
+doc_arg_type3(#type{name="wxTreeItemId"}) -> "wxTreeCtrl:treeItemId()";
doc_arg_type3(#type{base=bool}) -> "bool()";
doc_arg_type3(#type{base=float}) -> "float()";
doc_arg_type3(#type{base=double}) -> "float()";
@@ -851,7 +856,7 @@ doc_enum_desc([{Enum,Vs}|R]) ->
doc_enum_desc(R).
%% Misc functions prefixed with wx
-erl_func_name("wx" ++ Name, undefined) -> check_name(lowercase(Name));
+erl_func_name("wx" ++ Name, undefined) -> check_name(lowercase(Name));
erl_func_name(Name, undefined) -> check_name(lowercase(Name));
erl_func_name(_, Alias) -> check_name(lowercase(Alias)).
@@ -926,6 +931,8 @@ marshal_arg(#type{single=true,base=float}, Name, Align) ->
align(32, Align, Name ++ ":32/?F");
marshal_arg(#type{single=true,base=double}, Name, Align) ->
align(64, Align, Name ++ ":64/?F");
+marshal_arg(#type{single=true,base=int64}, Name, Align) ->
+ align(64, Align, Name ++ ":64/?UI");
marshal_arg(#type{single=true,base=int}, Name, Align) ->
align(32, Align, Name ++ ":32/?UI");
marshal_arg(#type{single=true,base={enum,_Enum}}, Name, Align) ->
diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf
index 4a646650ea..4bb358ebc9 100644
--- a/lib/wx/api_gen/wxapi.conf
+++ b/lib/wx/api_gen/wxapi.conf
@@ -1,20 +1,20 @@
%% -*- erlang -*-
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2008-2010. 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
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%
%% Api defs file, defines the classes and members we want.
@@ -889,7 +889,12 @@
{enum, wxTreeItemIcon, "wxTreeItemIcon_"}.
-{class, wxTreeCtrl, wxControl, [],
+{class, wxTreeCtrl, wxControl,
+ [{doc,
+ "Note: The representation of treeItemId() have changed "
+ "from the original class implementation to be an semi-opaque type,"
+ "Equality between TreeItemId's can be tested and zero means that the TreeItem is invalid."
+ }],
['wxTreeCtrl','~wxTreeCtrl','AddRoot','AppendItem',
%% Not on Windows 'AssignButtonsImageList','GetButtonsImageList','SetButtonsImageList'
'AssignImageList','AssignStateImageList','Collapse','CollapseAndReset',
@@ -897,10 +902,10 @@
%'EndEditLabel',
'EnsureVisible','Expand','GetBoundingRect',
'GetChildrenCount','GetCount','GetEditControl',
- %'GetFirstChild',
+ {'GetFirstChild',[{"cookie", out}]}, {'GetNextChild',[{"cookie", [both]}]},
'GetFirstVisibleItem',{'GetImageList',0},'GetIndent',
'GetItemBackgroundColour','GetItemData','GetItemFont','GetItemImage',
- 'GetItemText','GetItemTextColour','GetLastChild', % 'GetNextChild',
+ 'GetItemText','GetItemTextColour','GetLastChild',
'GetNextSibling','GetNextVisible','GetItemParent',%'GetParent',
'GetPrevSibling','GetPrevVisible','GetRootItem',
'GetSelection',{'GetSelections', [{return, nowhere},{"val",out}]},