%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2011-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%
%%
<<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() {};
int onGetItemText;
int onGetItemAttr;
int onGetItemColumnImage;
ErlDrvTermData 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>>
<<wxListCtrl_new_0
case ~s: { // wxListCtrl::wxListCtrl
wxListCtrl * Result = new EwxListCtrl();
newPtr((void *) Result, 0, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxListCtrl");
break;
}
wxListCtrl_new_0>>
<<wxListCtrl_new_2
case ~s: { // wxListCtrl::wxListCtrl
wxWindowID winid=wxID_ANY;
wxPoint pos= wxDefaultPosition;
wxSize size= wxDefaultSize;
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;
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;
}};
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;
}
wxListCtrl_new_2>>
<<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, (wxeIntPtr)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>>