aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-07-07 15:13:48 +0200
committerDan Gudmundsson <[email protected]>2011-07-07 15:13:48 +0200
commitf6d661504a1998f3a243731d3fe5769641f80bcc (patch)
tree8063da1b1fc5b146296b7a001e3cbc36d90a4ddb /lib/wx/api_gen
parentac970679c2570947374de24bc69f8721714002f0 (diff)
downloadotp-f6d661504a1998f3a243731d3fe5769641f80bcc.tar.gz
otp-f6d661504a1998f3a243731d3fe5769641f80bcc.tar.bz2
otp-f6d661504a1998f3a243731d3fe5769641f80bcc.zip
Fix documentation and callback options in wxListCtrl:create/3
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r--lib/wx/api_gen/wx_extra/wxListCtrl.c_src134
-rw-r--r--lib/wx/api_gen/wx_extra/wxListCtrl.erl54
-rw-r--r--lib/wx/api_gen/wxapi.conf3
3 files changed, 147 insertions, 44 deletions
diff --git a/lib/wx/api_gen/wx_extra/wxListCtrl.c_src b/lib/wx/api_gen/wx_extra/wxListCtrl.c_src
index 6443c02be2..54d6fafd01 100644
--- a/lib/wx/api_gen/wx_extra/wxListCtrl.c_src
+++ b/lib/wx/api_gen/wx_extra/wxListCtrl.c_src
@@ -17,30 +17,25 @@
%% %CopyrightEnd%
%%
-<<SortItems
-case ~s: { // wxListCtrl::SortItems taylormade
- wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4;
- int sortCallback=*(int *) bp; bp += 4;
- if(!This) throw wxe_badarg(0);
- callbackInfo* cb = new callbackInfo();
- cb->port = Ecmd.port;
- cb->callbackID = sortCallback;
- bool Result = This->SortItems(wxEListCtrlCompare, (long)cb);
- delete cb;
+<<wxListCtrl_class
+class EwxListCtrl : public wxListCtrl {
+ public: ~EwxListCtrl();
+ EwxListCtrl(wxWindow * parent,wxWindowID winid,const wxPoint& pos,const wxSize& size,long style,const wxValidator& validator) : wxListCtrl(parent,winid,pos,size,style,validator) {};
+ EwxListCtrl() : wxListCtrl() {};
- /* Destroy the callback, see wxEPrintout::clear_cb */
- wxeReturn cbrt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
- // NOTE: Remove this later when changing from funs to gen_server
- cbrt.addAtom("wx_delete_cb");
- cbrt.addInt(sortCallback);
- cbrt.addTupleCount(2);
- cbrt.send();
+ int onGetItemText;
+ int onGetItemAttr;
+ int onGetItemColumnImage;
+ ErlDrvPort port;
- rt.addBool(Result);
- break;
-}
-SortItems>>
+ private:
+ virtual wxString OnGetItemText(long item, long col) const;
+ virtual wxListItemAttr* OnGetItemAttr(long item) const;
+ virtual int OnGetItemImage(long item) const;
+ virtual int OnGetItemColumnImage(long item, long column) const;
+};
+wxListCtrl_class>>
<<wxListCtrl_new_0
case ~s: { // wxListCtrl::wxListCtrl
@@ -105,21 +100,86 @@ validator = (wxValidator *) getPtr(bp,memenv); bp += 4;
}
wxListCtrl_new_2>>
-<<wxListCtrl_class
-class EwxListCtrl : public wxListCtrl {
- public: ~EwxListCtrl();
- EwxListCtrl(wxWindow * parent,wxWindowID winid,const wxPoint& pos,const wxSize& size,long style,const wxValidator& validator) : wxListCtrl(parent,winid,pos,size,style,validator) {};
- EwxListCtrl() : wxListCtrl() {};
+<<Create
+case ~s: { // wxListCtrl::Create
+ wxWindowID winid=wxID_ANY;
+ wxPoint pos= wxDefaultPosition;
+ wxSize size= wxDefaultSize;
+ long style=wxLC_ICON;
+ const wxValidator * validator= &wxDefaultValidator;
+ EwxListCtrl *This = (EwxListCtrl *) getPtr(bp,memenv); bp += 4;
+ wxWindow *parent = (wxWindow *) getPtr(bp,memenv); bp += 4;
+ int onGetItemText = 0, onGetItemAttr = 0, onGetItemColumnImage = 0;
+
+ bp += 4; /* Align */
+ while( * (int*) bp) { switch (* (int*) bp) {
+ case 1: {bp += 4;
+ winid = (wxWindowID)*(int *) bp; bp += 4;
+ } break;
+ case 2: {bp += 4;
+ int * posX = (int *) bp; bp += 4;
+ int * posY = (int *) bp; bp += 4;
+ pos = wxPoint(*posX,*posY);
+ bp += 4; /* Align */
+ } break;
+ case 3: {bp += 4;
+ int * sizeW = (int *) bp; bp += 4;
+ int * sizeH = (int *) bp; bp += 4;
+ size = wxSize(*sizeW,*sizeH);
+ bp += 4; /* Align */
+ } break;
+ case 4: {bp += 4;
+ style = (long)*(int *) bp; bp += 4;
+ } break;
+ case 5: {bp += 4;
+validator = (wxValidator *) getPtr(bp,memenv); bp += 4;
+ } break;
+ case 6: {bp += 4;
+ onGetItemText = *(int *) bp; bp += 4;
+ } break;
+ case 7: {bp += 4;
+ onGetItemAttr = *(int *) bp; bp += 4;
+ } break;
+ case 8: {bp += 4;
+ onGetItemColumnImage = *(int *) bp; bp += 4;
+ } break;
+ }};
+ if(!This) throw wxe_badarg(0);
+ bool Result = This->Create(parent,winid,pos,size,style,*validator);
+ This->onGetItemText = onGetItemText;
+ This->onGetItemAttr = onGetItemAttr;
+ This->onGetItemColumnImage = onGetItemColumnImage;
+ This->port = Ecmd.port;
+
+ rt.addBool(Result);
+ break;
+}
+Create>>
+
+<<SortItems
+case ~s: { // wxListCtrl::SortItems taylormade
+ wxListCtrl *This = (wxListCtrl *) getPtr(bp,memenv); bp += 4;
+ int sortCallback=*(int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+
+ callbackInfo* cb = new callbackInfo();
+ cb->port = Ecmd.port;
+ cb->callbackID = sortCallback;
+ bool Result = This->SortItems(wxEListCtrlCompare, (long)cb);
+ delete cb;
+
+ /* Destroy the callback, see wxEPrintout::clear_cb */
+ wxeReturn cbrt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
+ // NOTE: Remove this later when changing from funs to gen_server
+ cbrt.addAtom("wx_delete_cb");
+ cbrt.addInt(sortCallback);
+ cbrt.addTupleCount(2);
+ cbrt.send();
+
+ rt.addBool(Result);
+ break;
+}
+SortItems>>
+
- int onGetItemText;
- int onGetItemAttr;
- int onGetItemColumnImage;
- ErlDrvPort port;
- private:
- virtual wxString OnGetItemText(long item, long col) const;
- virtual wxListItemAttr* OnGetItemAttr(long item) const;
- virtual int OnGetItemImage(long item) const;
- virtual int OnGetItemColumnImage(long item, long column) const;
-};
-wxListCtrl_class>> \ No newline at end of file
diff --git a/lib/wx/api_gen/wx_extra/wxListCtrl.erl b/lib/wx/api_gen/wx_extra/wxListCtrl.erl
index e6a77fef59..99255bc53f 100644
--- a/lib/wx/api_gen/wx_extra/wxListCtrl.erl
+++ b/lib/wx/api_gen/wx_extra/wxListCtrl.erl
@@ -59,14 +59,17 @@ new(Parent)
%% Option = {winid, integer()} |
%% {pos, {X::integer(),Y::integer()}} |
%% {size, {W::integer(),H::integer()}} |
-%% {style, integer()} | {validator, wx:wx()}
-%% {VirtualCallback, Callback::function()}
+%% {style, integer()} |
+%% {validator, wx:wx()} |
+%% {onGetItemText, OnGetItemText} |
+%% {onGetItemAttr, OnGetItemAttr} |
+%% {onGetItemColumnImage, OnGetItemColumnImage}
%%
-%% VirtualCallback = onGetItemText | onGetItemAttr | onGetItemImage | onGetItemColumnImage
-%% Callback = fun OnGetItemText(This, Item, Column) -> wxString() |
-%% fun OnGetItemAttr(This, Item) -> wxListItemAttr() |
-%% fun OnGetItemColumnImage(This, Item, Column) -> integer()
+%% OnGetItemText = (This, Item, Column) -> wxString()
+%% OnGetItemAttr = (This, Item) -> wxListItemAttr()
+%% OnGetItemColumnImage = (This, Item, Column) -> integer()
%% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlwxlistctrl">external documentation</a>.
+
new(#wx_ref{type=ParentT,ref=ParentRef}, Options)
when is_list(Options)->
?CLASS(ParentT,wxWindow),
@@ -93,3 +96,42 @@ new(#wx_ref{type=ParentT,ref=ParentRef}, Options)
wxe_util:construct(~s, <<ParentRef:32/?UI, 0:32,BinOpt/binary>>).
wxListCtrl_new_2>>
+
+<<EXPORT:Create create/2, create/3 Create:EXPORT>>
+
+<<Create
+%% @spec (This::wxListCtrl(), Parent::wxWindow:wxWindow()) -> bool()
+%% @equiv create(This,Parent, [])
+create(This,Parent)
+ when is_record(This, wx_ref),is_record(Parent, wx_ref) ->
+ create(This,Parent, []).
+
+%% @spec (This::wxListCtrl(), Parent::wxWindow:wxWindow(), [Option]) -> bool()
+%% Option = {winid, integer()} |
+%% {pos, {X::integer(),Y::integer()}} |
+%% {size, {W::integer(),H::integer()}} |
+%% {style, integer()} |
+%% {validator, wx:wx()} |
+%% {onGetItemText, OnGetItemText} |
+%% {onGetItemAttr, OnGetItemAttr} |
+%% {onGetItemColumnImage, OnGetItemColumnImage}
+%%
+%% OnGetItemText = (This, Item, Column) -> wxString()
+%% OnGetItemAttr = (This, Item) -> wxListItemAttr()
+%% OnGetItemColumnImage = (This, Item, Column) -> integer()
+%% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlcreate">external documentation</a>.
+create(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=ParentT,ref=ParentRef}, Options)
+ when is_list(Options) ->
+ ?CLASS(ThisT,wxListCtrl),
+ ?CLASS(ParentT,wxWindow),
+ MOpts = fun({winid, Winid}, Acc) -> [<<1:32/?UI,Winid:32/?UI>>|Acc];
+ ({pos, {PosX,PosY}}, Acc) -> [<<2:32/?UI,PosX:32/?UI,PosY:32/?UI,0:32>>|Acc];
+ ({size, {SizeW,SizeH}}, Acc) -> [<<3:32/?UI,SizeW:32/?UI,SizeH:32/?UI,0:32>>|Acc];
+ ({style, Style}, Acc) -> [<<4:32/?UI,Style:32/?UI>>|Acc];
+ ({validator, #wx_ref{type=ValidatorT,ref=ValidatorRef}}, Acc) -> ?CLASS(ValidatorT,wx),[<<5:32/?UI,ValidatorRef:32/?UI>>|Acc];
+ (BadOpt, _) -> erlang:error({badoption, BadOpt}) end,
+ BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)),
+ wxe_util:call(~s,
+ <<ThisRef:32/?UI,ParentRef:32/?UI, BinOpt/binary>>).
+
+Create>>
diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf
index 945f3afb00..8ee4451057 100644
--- a/lib/wx/api_gen/wxapi.conf
+++ b/lib/wx/api_gen/wxapi.conf
@@ -757,7 +757,8 @@
{class, wxListCtrl, wxControl, [],
[{'wxListCtrl', [{where, taylormade}]},
- '~wxListCtrl','Arrange','AssignImageList','ClearAll','Create',
+ '~wxListCtrl','Arrange','AssignImageList','ClearAll',
+ {'Create',[{where, taylormade}]},
'DeleteAllItems','DeleteColumn','DeleteItem',
{'EditLabel',[{"textControlClass",nowhere}]},
'EnsureVisible',