aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src
blob: 5e02066309343cb1815bff62ead2439133558834 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
case 100: { // wxEvtHandler::Connect
  wxEvtHandler *This = (wxEvtHandler *) getPtr(bp, memenv); bp += 4;
  int * winid  = (int *) bp; bp += 4;
  int * lastId = (int *) bp; bp += 4;
  int * skip   = (int *) bp; bp += 4;
  int * haveUserData = (int *) bp; bp += 4;
  wxeErlTerm * userData = NULL;
  int * fun_cb = (int *) bp; bp += 4;
  int * eventTypeLen = (int *) bp; bp += 4;
  int * class_nameLen = (int *) bp; bp += 4;

  if(*haveUserData) {
      userData = new wxeErlTerm(&Ecmd.bin[0]);
  }

  int eventType = wxeEventTypeFromAtom(bp); bp += *eventTypeLen;
  char *class_name = bp; bp+= *class_nameLen;
  if(eventType > 0 ) {
    wxeEvtListener * Evt_cb = new wxeEvtListener(Ecmd.caller,getRef(This, memenv),
                                                 class_name,*fun_cb,
                                                 *skip, userData, Ecmd.port);
    This->Connect((int) *winid,(int) *lastId,eventType,
	          (wxObjectEventFunction)(wxEventFunction) &wxeEvtListener::forward,
	          Evt_cb, Evt_cb);
    rt.addAtom("ok");
    rt.addRef(getRef((void *)Evt_cb,memenv), "wxeEvtListener");
    rt.addTupleCount(2);
  } else {
    rt.addAtom("badarg");
    rt.addAtom("event_type");
    rt.addTupleCount(2);
  }
  break;
}
case 101: { // wxEvtHandler::Disconnect
  wxeEvtListener *Listener = (wxeEvtListener *) getPtr(bp,memenv); bp += 4;
  wxEvtHandler *This = (wxEvtHandler *) getPtr(bp, memenv); bp += 4;
  int * winid  = (int *) bp; bp += 4;
  int * lastId = (int *) bp; bp += 4;
  int * eventTypeLen = (int *) bp; bp += 4;

  int eventType = wxeEventTypeFromAtom(bp); bp += *eventTypeLen;
  if(eventType > 0) {
     bool Result = This->Disconnect((int) *winid,(int) *lastId,eventType,
                                    (wxObjectEventFunction)(wxEventFunction)
                                    &wxeEvtListener::forward,
                                    NULL, Listener);
     rt.addBool(Result);
  } else {
    rt.addAtom("badarg");
    rt.addAtom("event_type");
    rt.addTupleCount(2);
  }
  break;
}