diff options
author | Dan Gudmundsson <dgud@erlang.org> | 2011-07-07 10:45:46 +0200 |
---|---|---|
committer | Dan Gudmundsson <dgud@erlang.org> | 2011-07-07 10:45:46 +0200 |
commit | 0f6282f2f88e97bfc57cc2e2957e9d8086b25aa2 (patch) | |
tree | 452ecbc6e0b809c24ef5da217112d629e649349e /lib/wx | |
parent | 98a0a3a7c3d24144c773629dd827bb06ea6cf5c1 (diff) | |
download | erlang-0f6282f2f88e97bfc57cc2e2957e9d8086b25aa2.tar.gz |
Generated code of previous commit
Diffstat (limited to 'lib/wx')
-rw-r--r-- | lib/wx/c_src/gen/wxe_derived_dest.h | 39 | ||||
-rw-r--r-- | lib/wx/c_src/gen/wxe_funcs.cpp | 46 | ||||
-rw-r--r-- | lib/wx/src/gen/wxListCtrl.erl | 77 |
3 files changed, 107 insertions, 55 deletions
diff --git a/lib/wx/c_src/gen/wxe_derived_dest.h b/lib/wx/c_src/gen/wxe_derived_dest.h index e4b77cd9b4..4e4aea098d 100644 --- a/lib/wx/c_src/gen/wxe_derived_dest.h +++ b/lib/wx/c_src/gen/wxe_derived_dest.h @@ -362,10 +362,22 @@ class EwxListBox : public wxListBox { EwxListBox() : wxListBox() {}; }; + class EwxListCtrl : public wxListCtrl { - public: ~EwxListCtrl() {((WxeApp *)wxTheApp)->clearPtr(this);}; + 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() {}; + + 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; }; class EwxListItem : public wxListItem { @@ -715,28 +727,3 @@ class EwxHtmlWindow : public wxHtmlWindow { EwxHtmlWindow() : wxHtmlWindow() {}; }; -void WxeApp::delete_object(void *ptr, wxeRefData *refd) { - switch(refd->type) { - case 24: delete (wxGridCellBoolRenderer *) ptr; break; - case 25: delete (wxGridCellBoolEditor *) ptr; break; - case 26: delete (wxGridCellFloatRenderer *) ptr; break; - case 27: delete (wxGridCellFloatEditor *) ptr; break; - case 28: delete (wxGridCellStringRenderer *) ptr; break; - case 29: delete (wxGridCellTextEditor *) ptr; break; - case 30: delete (wxGridCellChoiceEditor *) ptr; break; - case 31: delete (wxGridCellNumberRenderer *) ptr; break; - case 32: delete (wxGridCellNumberEditor *) ptr; break; - case 61: delete (wxIconBundle *) ptr; break; - case 69: delete (wxAcceleratorEntry *) ptr; break; - case 70: /* delete (wxCaret *) ptr;These objects must be deleted by owner object */ break; - case 72: delete (wxSizerFlags *) ptr; break; - case 88: /* delete (wxCalendarDateAttr *) ptr;These objects must be deleted by owner object */ break; - case 102: delete (wxTextAttr *) ptr; break; - case 154: delete (wxAuiPaneInfo *) ptr; break; - case 211: /* delete (wxFileDataObject *) ptr;These objects must be deleted by owner object */ break; - case 212: /* delete (wxTextDataObject *) ptr;These objects must be deleted by owner object */ break; - case 213: /* delete (wxBitmapDataObject *) ptr;These objects must be deleted by owner object */ break; - case 223: delete (wxLogNull *) ptr; break; - default: delete (wxObject *) ptr; -}} - diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp index fe463b6c30..0fcf8e3d07 100644 --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -15143,12 +15143,14 @@ case wxListBox_SetFirstItem_1_1: { // wxListBox::SetFirstItem This->SetFirstItem(s); break; } + case wxListCtrl_new_0: { // wxListCtrl::wxListCtrl wxListCtrl * Result = new EwxListCtrl(); newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxListCtrl"); break; } + case wxListCtrl_new_2: { // wxListCtrl::wxListCtrl wxWindowID winid=wxID_ANY; wxPoint pos= wxDefaultPosition; @@ -15156,6 +15158,8 @@ case wxListCtrl_new_2: { // wxListCtrl::wxListCtrl long style=wxLC_ICON; const wxValidator * validator= &wxDefaultValidator; 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; @@ -15179,8 +15183,21 @@ case wxListCtrl_new_2: { // wxListCtrl::wxListCtrl 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; }}; - wxListCtrl * Result = new EwxListCtrl(parent,winid,pos,size,style,*validator); + EwxListCtrl * Result = new EwxListCtrl(parent,winid,pos,size,style,*validator); + Result->onGetItemText = onGetItemText; + Result->onGetItemAttr = onGetItemAttr; + Result->onGetItemColumnImage = onGetItemColumnImage; + Result->port = Ecmd.port; newPtr((void *) Result, 0, memenv); rt.addRef(getRef((void *)Result,memenv), "wxListCtrl"); break; @@ -31188,3 +31205,30 @@ case wxLogNull_destroy: { // wxLogNull::destroy error.addTupleCount(3); error.send(); }} /* The End */ + + +void WxeApp::delete_object(void *ptr, wxeRefData *refd) { + switch(refd->type) { + case 24: delete (wxGridCellBoolRenderer *) ptr; break; + case 25: delete (wxGridCellBoolEditor *) ptr; break; + case 26: delete (wxGridCellFloatRenderer *) ptr; break; + case 27: delete (wxGridCellFloatEditor *) ptr; break; + case 28: delete (wxGridCellStringRenderer *) ptr; break; + case 29: delete (wxGridCellTextEditor *) ptr; break; + case 30: delete (wxGridCellChoiceEditor *) ptr; break; + case 31: delete (wxGridCellNumberRenderer *) ptr; break; + case 32: delete (wxGridCellNumberEditor *) ptr; break; + case 61: delete (wxIconBundle *) ptr; break; + case 69: delete (wxAcceleratorEntry *) ptr; break; + case 70: /* delete (wxCaret *) ptr;These objects must be deleted by owner object */ break; + case 72: delete (wxSizerFlags *) ptr; break; + case 88: /* delete (wxCalendarDateAttr *) ptr;These objects must be deleted by owner object */ break; + case 102: delete (wxTextAttr *) ptr; break; + case 154: delete (wxAuiPaneInfo *) ptr; break; + case 211: /* delete (wxFileDataObject *) ptr;These objects must be deleted by owner object */ break; + case 212: /* delete (wxTextDataObject *) ptr;These objects must be deleted by owner object */ break; + case 213: /* delete (wxBitmapDataObject *) ptr;These objects must be deleted by owner object */ break; + case 223: delete (wxLogNull *) ptr; break; + default: delete (wxObject *) ptr; +}} + diff --git a/lib/wx/src/gen/wxListCtrl.erl b/lib/wx/src/gen/wxListCtrl.erl index 9c4ba1e5a3..bf5f4ae20d 100644 --- a/lib/wx/src/gen/wxListCtrl.erl +++ b/lib/wx/src/gen/wxListCtrl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2011. 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 @@ -29,17 +29,17 @@ -module(wxListCtrl). -include("wxe.hrl"). --export([ sortItems/2 ,arrange/1,arrange/2,assignImageList/3,clearAll/1,create/2, - create/3,deleteAllItems/1,deleteColumn/2,deleteItem/2,destroy/1,editLabel/2, - ensureVisible/2,findItem/3,findItem/4,getColumn/3,getColumnCount/1, - getColumnWidth/2,getCountPerPage/1,getEditControl/1,getImageList/2, - getItem/2,getItemBackgroundColour/2,getItemCount/1,getItemData/2, - getItemFont/2,getItemPosition/3,getItemRect/3,getItemRect/4,getItemSpacing/1, - getItemState/3,getItemText/2,getItemTextColour/2,getNextItem/2,getNextItem/3, - getSelectedItemCount/1,getTextColour/1,getTopItem/1,getViewRect/1, - hitTest/2,insertColumn/3,insertColumn/4,insertItem/2,insertItem/3, - insertItem/4,new/0,new/1,new/2,refreshItem/2,refreshItems/3,scrollList/3, - setBackgroundColour/2,setColumn/3,setColumnWidth/3,setImageList/3, +-export([ new/0, new/1, new/2 , sortItems/2 ,arrange/1,arrange/2,assignImageList/3, + clearAll/1,create/2,create/3,deleteAllItems/1,deleteColumn/2,deleteItem/2, + destroy/1,editLabel/2,ensureVisible/2,findItem/3,findItem/4,getColumn/3, + getColumnCount/1,getColumnWidth/2,getCountPerPage/1,getEditControl/1, + getImageList/2,getItem/2,getItemBackgroundColour/2,getItemCount/1, + getItemData/2,getItemFont/2,getItemPosition/3,getItemRect/3,getItemRect/4, + getItemSpacing/1,getItemState/3,getItemText/2,getItemTextColour/2, + getNextItem/2,getNextItem/3,getSelectedItemCount/1,getTextColour/1, + getTopItem/1,getViewRect/1,hitTest/2,insertColumn/3,insertColumn/4, + insertItem/2,insertItem/3,insertItem/4,refreshItem/2,refreshItems/3, + scrollList/3,setBackgroundColour/2,setColumn/3,setColumnWidth/3,setImageList/3, setItem/2,setItem/4,setItem/5,setItemBackgroundColour/3,setItemColumnImage/4, setItemCount/2,setItemData/3,setItemFont/3,setItemImage/3,setItemImage/4, setItemPosition/3,setItemState/4,setItemText/3,setItemTextColour/3, @@ -89,11 +89,11 @@ parent_class(wxWindow) -> true; parent_class(wxEvtHandler) -> true; parent_class(_Class) -> erlang:error({badtype, ?MODULE}). + %% @spec () -> wxListCtrl() %% @doc See <a href="http://www.wxwidgets.org/manuals/stable/wx_wxlistctrl.html#wxlistctrlwxlistctrl">external documentation</a>. new() -> - wxe_util:construct(?wxListCtrl_new_0, - <<>>). + wxe_util:construct(?wxListCtrl_new_0, <<>>). %% @spec (Parent::wxWindow:wxWindow()) -> wxListCtrl() %% @equiv new(Parent, []) @@ -102,20 +102,41 @@ new(Parent) new(Parent, []). %% @spec (Parent::wxWindow:wxWindow(), [Option]) -> wxListCtrl() -%% Option = {winid, integer()} | {pos, {X::integer(),Y::integer()}} | {size, {W::integer(),H::integer()}} | {style, integer()} | {validator, wx:wx()} +%% Option = {winid, integer()} | +%% {pos, {X::integer(),Y::integer()}} | +%% {size, {W::integer(),H::integer()}} | +%% {style, integer()} | {validator, wx:wx()} +%% {VirtualCallback, Callback::function()} +%% +%% VirtualCallback = onGetItemText | onGetItemAttr | onGetItemImage | onGetItemColumnImage +%% Callback = fun OnGetItemText(This, Item, Column) -> wxString() | +%% fun OnGetItemAttr(This, Item) -> wxListItemAttr() | +%% fun 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), - 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:construct(?wxListCtrl_new_2, - <<ParentRef:32/?UI, 0:32,BinOpt/binary>>). + when is_list(Options)-> + ?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]; + ({onGetItemText, F}, Acc) when is_function(F) -> + Fun = fun([This,Item,Col]) -> unicode:characters_to_binary([F(This,Item,Col),0]) end, + [<<6:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc]; + ({onGetItemAttr, F}, Acc) when is_function(F) -> + Fun = fun([This,Item]) -> + #wx_ref{type=wxListItemAttr,ref=ThisRef} = F(This,Item), + <<ThisRef:32/?UI>> + end, + [<<7:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc]; + ({onGetItemColumnImage, F}, Acc) when is_function(F) -> + Fun = fun([This,Item, Col]) -> <<(F(This,Item,Col)):32/?I>> end, + [<<8:32/?UI,(wxe_util:get_cbId(Fun)):32/?UI>>|Acc]; + (BadOpt, _) -> erlang:error({badoption, BadOpt}) end, + BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)), + wxe_util:construct(?wxListCtrl_new_2, <<ParentRef:32/?UI, 0:32,BinOpt/binary>>). %% @spec (This::wxListCtrl()) -> bool() %% @equiv arrange(This, []) @@ -726,12 +747,12 @@ setWindowStyleFlag(#wx_ref{type=ThisT,ref=ThisRef},Style) %% @spec (This::wxListCtrl(), SortCallBack::function()) -> boolean() %% @doc Sort the items in the list control<br /> -%% <pre>SortCalBack(Item1,Item2) -> integer()</pre> +%% <pre>SortCallBack(Item1,Item2) -> integer()</pre> %% <br /> SortCallBack receives the client data associated with two items %% to compare, and should return 0 if the items are equal, a negative %% value if the first item is less than the second one and a positive %% value if the first item is greater than the second one. -%% <br /> NOTE: The callback may not call other processes. +%% <br /> NOTE: The callback may not call other (wx) processes. sortItems(#wx_ref{type=ThisT,ref=ThisRef}, SortCallBack) when is_function(SortCallBack, 2) -> ?CLASS(ThisT,wxListCtrl), |