/* DO NOT EDIT THIS FILE. */
/* This file was generated by xctocc from "wxs_evnt.xc". */


#if defined(_MSC_VER)
# include "wx.h"
#endif
#if defined(OS_X)
# include "common.h"
#endif

#include "wx_stdev.h"

class wxEvent_ext : public wxEvent {
 public: wxEvent_ext(long ts);
};

wxEvent_ext::wxEvent_ext(long ts)
: wxEvent() 
{		
  timeStamp = ts;
}

class wxCommandEvent_ext : public wxCommandEvent {
 public: wxCommandEvent_ext(int at, long ts);
};

wxCommandEvent_ext::wxCommandEvent_ext(int at, long ts)
: wxCommandEvent(at) 
{
  timeStamp = ts;
}

class wxScrollEvent_ext : public wxScrollEvent {
 public: wxScrollEvent_ext(int et, int d, int p, long ts);
};

wxScrollEvent_ext::wxScrollEvent_ext(int et, int d, int p, long ts)
: wxScrollEvent()
{
  moveType = et;
  direction = d;
  pos = p;
  timeStamp = ts;
}

class wxKeyEvent_ext : public wxKeyEvent {
 public: wxKeyEvent_ext(int kc, int sd, int cd, int md, int ad, int xv, int yv, long ts);
};

wxKeyEvent_ext::wxKeyEvent_ext(int kc, int sd, int cd, int md, int ad, int xv, int yv, long ts) 
: wxKeyEvent(wxEVENT_TYPE_CHAR) 
{
  keyCode = kc;
  shiftDown = sd;
  controlDown = cd;
  metaDown = md;
  altDown = ad;
  x = xv;
  y = yv;
  timeStamp = ts;
}

class wxMouseEvent_ext : public wxMouseEvent {
 public: wxMouseEvent_ext(int et, int ld, int mdd, int rd, int xv, int yv, int sd, int cd, int md, int ad, long ts);
};

wxMouseEvent_ext::wxMouseEvent_ext(int et, int ld, int mdd, int rd, int xv, int yv, int sd, int cd, int md, int ad, long ts) 
: wxMouseEvent(et)
{
  leftDown = ld;
  middleDown = mdd;
  rightDown = rd;
  x = xv;
  y = yv;
  shiftDown = sd;
  controlDown = cd;
  metaDown = md;
  altDown = ad;
  timeStamp = ts;
}




#ifdef wx_x
# define BM_SELECTED(map) ((map)->selectedTo)
#endif
#if defined(wx_mac) || defined(wx_msw)
# define BM_SELECTED(map) ((map)->selectedInto)
#endif
# define BM_IN_USE(map) ((map)->selectedIntoDC)





#include "wxscheme.h"
#include "wxs_evnt.h"

#ifdef MZ_PRECISE_GC
START_XFORM_SKIP;
#endif




class os_wxEvent : public wxEvent_ext {
 public:

  os_wxEvent CONSTRUCTOR_ARGS((ExactLong x0 = 0));
  ~os_wxEvent();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxEvent::gcMark() {
  wxEvent_ext::gcMark();
}
void os_wxEvent::gcFixup() {
  wxEvent_ext::gcFixup();
}
#endif

static Scheme_Object *os_wxEvent_class;

os_wxEvent::os_wxEvent CONSTRUCTOR_ARGS((ExactLong x0))
CONSTRUCTOR_INIT(: wxEvent_ext(x0))
{
}

os_wxEvent::~os_wxEvent()
{
    objscheme_destroy(this, (Scheme_Object *) __gc_external);
}

static Scheme_Object *objscheme_wxEvent_GettimeStamp(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  ExactLong v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxEvent_class, "get-time-stamp in event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-time-stamp in event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxEvent *)cobj->primdata)->wxEvent::timeStamp;
  else
    v = ((wxEvent *)cobj->primdata)->timeStamp;

  return WITH_REMEMBERED_STACK(scheme_make_integer_value(v));
}

static Scheme_Object *objscheme_wxEvent_SettimeStamp(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  ExactLong v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxEvent_class, "set-time-stamp in event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-time-stamp in event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET], "set-time-stamp in event%"));
  ((wxEvent *)cobj->primdata)->timeStamp = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxEvent_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxEvent *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  ExactLong x0;

  SETUP_VAR_STACK_PRE_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, realobj);

  
  if ((n > (POFFSET+1))) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in event%", POFFSET+POFFSET, POFFSET+1, n, p, 1));
  if (n > (POFFSET+0)) {
    x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "initialization in event%"));
  } else
    x0 = 0;

  
  realobj = WITH_VAR_STACK(new os_wxEvent CONSTRUCTOR_ARGS((x0)));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxEvent_ext(x0));
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxEvent(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxEvent_class);

  os_wxEvent_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "event%", "object%", (Scheme_Method_Prim *)os_wxEvent_ConstructScheme, 2));


  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxEvent_class,"get-time-stamp" " method", (Scheme_Method_Prim *)objscheme_wxEvent_GettimeStamp, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxEvent_class,"set-time-stamp" " method", (Scheme_Method_Prim *)objscheme_wxEvent_SettimeStamp, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxEvent_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxEvent(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (objscheme_is_a(obj,  os_wxEvent_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "event% object or " XC_NULL_STR: "event% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxEvent(class wxEvent *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxEvent_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  return (Scheme_Object *)obj;
}

class wxEvent *objscheme_unbundle_wxEvent(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxEvent(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxEvent *)o->primdata;
  else
    return (wxEvent *)o->primdata;
}


static Scheme_Object *actionType_wxEVENT_TYPE_BUTTON_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_CHECKBOX_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_CHOICE_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_LISTBOX_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_TEXT_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_SLIDER_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_RADIOBOX_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_TEXT_ENTER_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_TAB_CHOICE_COMMAND_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_MENU_SELECT_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_MENU_POPDOWN_sym = NULL;
static Scheme_Object *actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym = NULL;

static void init_symset_actionType(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(actionType_wxEVENT_TYPE_BUTTON_COMMAND_sym);
  actionType_wxEVENT_TYPE_BUTTON_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("button"));
  wxREGGLOB(actionType_wxEVENT_TYPE_CHECKBOX_COMMAND_sym);
  actionType_wxEVENT_TYPE_CHECKBOX_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("check-box"));
  wxREGGLOB(actionType_wxEVENT_TYPE_CHOICE_COMMAND_sym);
  actionType_wxEVENT_TYPE_CHOICE_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("choice"));
  wxREGGLOB(actionType_wxEVENT_TYPE_LISTBOX_COMMAND_sym);
  actionType_wxEVENT_TYPE_LISTBOX_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("list-box"));
  wxREGGLOB(actionType_wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND_sym);
  actionType_wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("list-box-dclick"));
  wxREGGLOB(actionType_wxEVENT_TYPE_TEXT_COMMAND_sym);
  actionType_wxEVENT_TYPE_TEXT_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text-field"));
  wxREGGLOB(actionType_wxEVENT_TYPE_SLIDER_COMMAND_sym);
  actionType_wxEVENT_TYPE_SLIDER_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("slider"));
  wxREGGLOB(actionType_wxEVENT_TYPE_RADIOBOX_COMMAND_sym);
  actionType_wxEVENT_TYPE_RADIOBOX_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("radio-box"));
  wxREGGLOB(actionType_wxEVENT_TYPE_TEXT_ENTER_COMMAND_sym);
  actionType_wxEVENT_TYPE_TEXT_ENTER_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text-field-enter"));
  wxREGGLOB(actionType_wxEVENT_TYPE_TAB_CHOICE_COMMAND_sym);
  actionType_wxEVENT_TYPE_TAB_CHOICE_COMMAND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("tab-panel"));
  wxREGGLOB(actionType_wxEVENT_TYPE_MENU_SELECT_sym);
  actionType_wxEVENT_TYPE_MENU_SELECT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("menu"));
  wxREGGLOB(actionType_wxEVENT_TYPE_MENU_POPDOWN_sym);
  actionType_wxEVENT_TYPE_MENU_POPDOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("menu-popdown"));
  wxREGGLOB(actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym);
  actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("menu-popdown-none"));
}

static int unbundle_symset_actionType(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym) WITH_VAR_STACK(init_symset_actionType());
  if (0) { }
  else if (v == actionType_wxEVENT_TYPE_BUTTON_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_BUTTON_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_CHECKBOX_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_CHECKBOX_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_CHOICE_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_CHOICE_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_LISTBOX_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_LISTBOX_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_TEXT_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_TEXT_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_SLIDER_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SLIDER_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_RADIOBOX_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_RADIOBOX_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_TEXT_ENTER_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_TEXT_ENTER_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_TAB_CHOICE_COMMAND_sym) { READY_TO_RETURN; return wxEVENT_TYPE_TAB_CHOICE_COMMAND; }
  else if (v == actionType_wxEVENT_TYPE_MENU_SELECT_sym) { READY_TO_RETURN; return wxEVENT_TYPE_MENU_SELECT; }
  else if (v == actionType_wxEVENT_TYPE_MENU_POPDOWN_sym) { READY_TO_RETURN; return wxEVENT_TYPE_MENU_POPDOWN; }
  else if (v == actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym) { READY_TO_RETURN; return wxEVENT_TYPE_MENU_POPDOWN_NONE; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "actionType symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_actionType(int v) {
  if (!actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym) init_symset_actionType();
  switch (v) {
  case wxEVENT_TYPE_BUTTON_COMMAND: return actionType_wxEVENT_TYPE_BUTTON_COMMAND_sym;
  case wxEVENT_TYPE_CHECKBOX_COMMAND: return actionType_wxEVENT_TYPE_CHECKBOX_COMMAND_sym;
  case wxEVENT_TYPE_CHOICE_COMMAND: return actionType_wxEVENT_TYPE_CHOICE_COMMAND_sym;
  case wxEVENT_TYPE_LISTBOX_COMMAND: return actionType_wxEVENT_TYPE_LISTBOX_COMMAND_sym;
  case wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND: return actionType_wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND_sym;
  case wxEVENT_TYPE_TEXT_COMMAND: return actionType_wxEVENT_TYPE_TEXT_COMMAND_sym;
  case wxEVENT_TYPE_SLIDER_COMMAND: return actionType_wxEVENT_TYPE_SLIDER_COMMAND_sym;
  case wxEVENT_TYPE_RADIOBOX_COMMAND: return actionType_wxEVENT_TYPE_RADIOBOX_COMMAND_sym;
  case wxEVENT_TYPE_TEXT_ENTER_COMMAND: return actionType_wxEVENT_TYPE_TEXT_ENTER_COMMAND_sym;
  case wxEVENT_TYPE_TAB_CHOICE_COMMAND: return actionType_wxEVENT_TYPE_TAB_CHOICE_COMMAND_sym;
  case wxEVENT_TYPE_MENU_SELECT: return actionType_wxEVENT_TYPE_MENU_SELECT_sym;
  case wxEVENT_TYPE_MENU_POPDOWN: return actionType_wxEVENT_TYPE_MENU_POPDOWN_sym;
  case wxEVENT_TYPE_MENU_POPDOWN_NONE: return actionType_wxEVENT_TYPE_MENU_POPDOWN_NONE_sym;
  default: return NULL;
  }
}





class os_wxCommandEvent : public wxCommandEvent_ext {
 public:

  os_wxCommandEvent CONSTRUCTOR_ARGS((int x0, ExactLong x1 = 0));
  ~os_wxCommandEvent();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxCommandEvent::gcMark() {
  wxCommandEvent_ext::gcMark();
}
void os_wxCommandEvent::gcFixup() {
  wxCommandEvent_ext::gcFixup();
}
#endif

static Scheme_Object *os_wxCommandEvent_class;

os_wxCommandEvent::os_wxCommandEvent CONSTRUCTOR_ARGS((int x0, ExactLong x1))
CONSTRUCTOR_INIT(: wxCommandEvent_ext(x0, x1))
{
}

os_wxCommandEvent::~os_wxCommandEvent()
{
    objscheme_destroy(this, (Scheme_Object *) __gc_external);
}

static Scheme_Object *objscheme_wxCommandEvent_GeteventType(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxCommandEvent_class, "get-event-type in control-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-event-type in control-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxCommandEvent *)cobj->primdata)->wxCommandEvent::eventType;
  else
    v = ((wxCommandEvent *)cobj->primdata)->eventType;

  return WITH_REMEMBERED_STACK(bundle_symset_actionType(v));
}

static Scheme_Object *objscheme_wxCommandEvent_SeteventType(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxCommandEvent_class, "set-event-type in control-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-event-type in control-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(unbundle_symset_actionType(p[POFFSET], "set-event-type in control-event%"));
  ((wxCommandEvent *)cobj->primdata)->eventType = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxCommandEvent_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxCommandEvent *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  int x0;
  ExactLong x1;

  SETUP_VAR_STACK_PRE_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, realobj);

  
  if ((n < (POFFSET+1)) || (n > (POFFSET+2))) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in control-event%", POFFSET+1, POFFSET+2, n, p, 1));
  x0 = WITH_VAR_STACK(unbundle_symset_actionType(p[POFFSET+0], "initialization in control-event%"));
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "initialization in control-event%"));
  } else
    x1 = 0;

  
  realobj = WITH_VAR_STACK(new os_wxCommandEvent CONSTRUCTOR_ARGS((x0, x1)));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxCommandEvent_ext(x0, x1));
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxCommandEvent(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxCommandEvent_class);

  os_wxCommandEvent_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "control-event%", "event%", (Scheme_Method_Prim *)os_wxCommandEvent_ConstructScheme, 2));


  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxCommandEvent_class,"get-event-type" " method", (Scheme_Method_Prim *)objscheme_wxCommandEvent_GeteventType, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxCommandEvent_class,"set-event-type" " method", (Scheme_Method_Prim *)objscheme_wxCommandEvent_SeteventType, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxCommandEvent_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxCommandEvent(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (objscheme_is_a(obj,  os_wxCommandEvent_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "control-event% object or " XC_NULL_STR: "control-event% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxCommandEvent(class wxCommandEvent *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxCommandEvent_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  return (Scheme_Object *)obj;
}

class wxCommandEvent *objscheme_unbundle_wxCommandEvent(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxCommandEvent(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxCommandEvent *)o->primdata;
  else
    return (wxCommandEvent *)o->primdata;
}



// This class is not instantiated from Scheme; it is only
// instantiated to send info to mred.ss:




class os_wxPopupEvent : public wxPopupEvent {
 public:

  os_wxPopupEvent CONSTRUCTOR_ARGS(());
  ~os_wxPopupEvent();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxPopupEvent::gcMark() {
  wxPopupEvent::gcMark();
}
void os_wxPopupEvent::gcFixup() {
  wxPopupEvent::gcFixup();
}
#endif

static Scheme_Object *os_wxPopupEvent_class;

os_wxPopupEvent::os_wxPopupEvent CONSTRUCTOR_ARGS(())
CONSTRUCTOR_INIT(: wxPopupEvent())
{
}

os_wxPopupEvent::~os_wxPopupEvent()
{
    objscheme_destroy(this, (Scheme_Object *) __gc_external);
}

static Scheme_Object *objscheme_wxPopupEvent_GetmenuId(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  ExactLong v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxPopupEvent_class, "get-menu-id in popup-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-menu-id in popup-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxPopupEvent *)cobj->primdata)->wxPopupEvent::menuId;
  else
    v = ((wxPopupEvent *)cobj->primdata)->menuId;

  return WITH_REMEMBERED_STACK(scheme_make_integer_value(v));
}

static Scheme_Object *objscheme_wxPopupEvent_SetmenuId(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  ExactLong v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxPopupEvent_class, "set-menu-id in popup-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-menu-id in popup-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET], "set-menu-id in popup-event%"));
  ((wxPopupEvent *)cobj->primdata)->menuId = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxPopupEvent_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxPopupEvent *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();

  SETUP_VAR_STACK_PRE_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, realobj);

  
  if (n != (POFFSET+0)) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in popup-event%", POFFSET+0, POFFSET+0, n, p, 1));

  
  realobj = WITH_VAR_STACK(new os_wxPopupEvent CONSTRUCTOR_ARGS(()));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxPopupEvent());
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxPopupEvent(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxPopupEvent_class);

  os_wxPopupEvent_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "popup-event%", "control-event%", (Scheme_Method_Prim *)os_wxPopupEvent_ConstructScheme, 2));


  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPopupEvent_class,"get-menu-id" " method", (Scheme_Method_Prim *)objscheme_wxPopupEvent_GetmenuId, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxPopupEvent_class,"set-menu-id" " method", (Scheme_Method_Prim *)objscheme_wxPopupEvent_SetmenuId, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxPopupEvent_class));

  WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxPopupEvent, wxTYPE_POPUP_EVENT));

  READY_TO_RETURN;
}

int objscheme_istype_wxPopupEvent(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (objscheme_is_a(obj,  os_wxPopupEvent_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "popup-event% object or " XC_NULL_STR: "popup-event% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxPopupEvent(class wxPopupEvent *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((realobj->__type != wxTYPE_POPUP_EVENT) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPopupEvent_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  return (Scheme_Object *)obj;
}

class wxPopupEvent *objscheme_unbundle_wxPopupEvent(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxPopupEvent(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxPopupEvent *)o->primdata;
  else
    return (wxPopupEvent *)o->primdata;
}


static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_TOP_sym = NULL;
static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_BOTTOM_sym = NULL;
static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_LINEUP_sym = NULL;
static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_LINEDOWN_sym = NULL;
static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEUP_sym = NULL;
static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEDOWN_sym = NULL;
static Scheme_Object *scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym = NULL;

static void init_symset_scrollMoveType(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_TOP_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_TOP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("top"));
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_BOTTOM_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_BOTTOM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bottom"));
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_LINEUP_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_LINEUP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("line-up"));
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_LINEDOWN_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_LINEDOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("line-down"));
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEUP_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEUP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("page-up"));
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEDOWN_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEDOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("page-down"));
  wxREGGLOB(scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym);
  scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("thumb"));
}

static int unbundle_symset_scrollMoveType(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym) WITH_VAR_STACK(init_symset_scrollMoveType());
  if (0) { }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_TOP_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_TOP; }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_BOTTOM_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_BOTTOM; }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_LINEUP_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_LINEUP; }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_LINEDOWN_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_LINEDOWN; }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEUP_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_PAGEUP; }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEDOWN_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_PAGEDOWN; }
  else if (v == scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym) { READY_TO_RETURN; return wxEVENT_TYPE_SCROLL_THUMBTRACK; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "scrollMoveType symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_scrollMoveType(int v) {
  if (!scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym) init_symset_scrollMoveType();
  switch (v) {
  case wxEVENT_TYPE_SCROLL_TOP: return scrollMoveType_wxEVENT_TYPE_SCROLL_TOP_sym;
  case wxEVENT_TYPE_SCROLL_BOTTOM: return scrollMoveType_wxEVENT_TYPE_SCROLL_BOTTOM_sym;
  case wxEVENT_TYPE_SCROLL_LINEUP: return scrollMoveType_wxEVENT_TYPE_SCROLL_LINEUP_sym;
  case wxEVENT_TYPE_SCROLL_LINEDOWN: return scrollMoveType_wxEVENT_TYPE_SCROLL_LINEDOWN_sym;
  case wxEVENT_TYPE_SCROLL_PAGEUP: return scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEUP_sym;
  case wxEVENT_TYPE_SCROLL_PAGEDOWN: return scrollMoveType_wxEVENT_TYPE_SCROLL_PAGEDOWN_sym;
  case wxEVENT_TYPE_SCROLL_THUMBTRACK: return scrollMoveType_wxEVENT_TYPE_SCROLL_THUMBTRACK_sym;
  default: return NULL;
  }
}



static Scheme_Object *orientation_wxVERTICAL_sym = NULL;
static Scheme_Object *orientation_wxHORIZONTAL_sym = NULL;

static void init_symset_orientation(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(orientation_wxVERTICAL_sym);
  orientation_wxVERTICAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("vertical"));
  wxREGGLOB(orientation_wxHORIZONTAL_sym);
  orientation_wxHORIZONTAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("horizontal"));
}

static int unbundle_symset_orientation(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!orientation_wxHORIZONTAL_sym) WITH_VAR_STACK(init_symset_orientation());
  if (0) { }
  else if (v == orientation_wxVERTICAL_sym) { READY_TO_RETURN; return wxVERTICAL; }
  else if (v == orientation_wxHORIZONTAL_sym) { READY_TO_RETURN; return wxHORIZONTAL; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "orientation symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_orientation(int v) {
  if (!orientation_wxHORIZONTAL_sym) init_symset_orientation();
  switch (v) {
  case wxVERTICAL: return orientation_wxVERTICAL_sym;
  case wxHORIZONTAL: return orientation_wxHORIZONTAL_sym;
  default: return NULL;
  }
}





class os_wxScrollEvent : public wxScrollEvent_ext {
 public:

  os_wxScrollEvent CONSTRUCTOR_ARGS((int x0 = wxEVENT_TYPE_SCROLL_THUMBTRACK, int x1 = wxVERTICAL, int x2 = 0, ExactLong x3 = 0));
  ~os_wxScrollEvent();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxScrollEvent::gcMark() {
  wxScrollEvent_ext::gcMark();
}
void os_wxScrollEvent::gcFixup() {
  wxScrollEvent_ext::gcFixup();
}
#endif

static Scheme_Object *os_wxScrollEvent_class;

os_wxScrollEvent::os_wxScrollEvent CONSTRUCTOR_ARGS((int x0, int x1, int x2, ExactLong x3))
CONSTRUCTOR_INIT(: wxScrollEvent_ext(x0, x1, x2, x3))
{
}

os_wxScrollEvent::~os_wxScrollEvent()
{
    objscheme_destroy(this, (Scheme_Object *) __gc_external);
}

static Scheme_Object *objscheme_wxScrollEvent_GetmoveType(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxScrollEvent_class, "get-event-type in scroll-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-event-type in scroll-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxScrollEvent *)cobj->primdata)->wxScrollEvent::moveType;
  else
    v = ((wxScrollEvent *)cobj->primdata)->moveType;

  return WITH_REMEMBERED_STACK(bundle_symset_scrollMoveType(v));
}

static Scheme_Object *objscheme_wxScrollEvent_SetmoveType(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxScrollEvent_class, "set-event-type in scroll-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-event-type in scroll-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(unbundle_symset_scrollMoveType(p[POFFSET], "set-event-type in scroll-event%"));
  ((wxScrollEvent *)cobj->primdata)->moveType = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxScrollEvent_Getdirection(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxScrollEvent_class, "get-direction in scroll-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-direction in scroll-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxScrollEvent *)cobj->primdata)->wxScrollEvent::direction;
  else
    v = ((wxScrollEvent *)cobj->primdata)->direction;

  return WITH_REMEMBERED_STACK(bundle_symset_orientation(v));
}

static Scheme_Object *objscheme_wxScrollEvent_Setdirection(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxScrollEvent_class, "set-direction in scroll-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-direction in scroll-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(unbundle_symset_orientation(p[POFFSET], "set-direction in scroll-event%"));
  ((wxScrollEvent *)cobj->primdata)->direction = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxScrollEvent_Getpos(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxScrollEvent_class, "get-position in scroll-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-position in scroll-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxScrollEvent *)cobj->primdata)->wxScrollEvent::pos;
  else
    v = ((wxScrollEvent *)cobj->primdata)->pos;

  return scheme_make_integer(v);
}

static Scheme_Object *objscheme_wxScrollEvent_Setpos(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxScrollEvent_class, "set-position in scroll-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-position in scroll-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], 0, 10000, "set-position in scroll-event%"));
  ((wxScrollEvent *)cobj->primdata)->pos = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxScrollEvent_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxScrollEvent *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  int x0;
  int x1;
  int x2;
  ExactLong x3;

  SETUP_VAR_STACK_PRE_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, realobj);

  
  if ((n > (POFFSET+4))) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in scroll-event%", POFFSET+POFFSET, POFFSET+4, n, p, 1));
  if (n > (POFFSET+0)) {
    x0 = WITH_VAR_STACK(unbundle_symset_scrollMoveType(p[POFFSET+0], "initialization in scroll-event%"));
  } else
    x0 = wxEVENT_TYPE_SCROLL_THUMBTRACK;
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(unbundle_symset_orientation(p[POFFSET+1], "initialization in scroll-event%"));
  } else
    x1 = wxVERTICAL;
  if (n > (POFFSET+2)) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 0, 10000, "initialization in scroll-event%"));
  } else
    x2 = 0;
  if (n > (POFFSET+3)) {
    x3 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+3], "initialization in scroll-event%"));
  } else
    x3 = 0;

  
  realobj = WITH_VAR_STACK(new os_wxScrollEvent CONSTRUCTOR_ARGS((x0, x1, x2, x3)));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxScrollEvent_ext(x0, x1, x2, x3));
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxScrollEvent(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxScrollEvent_class);

  os_wxScrollEvent_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "scroll-event%", "event%", (Scheme_Method_Prim *)os_wxScrollEvent_ConstructScheme, 6));


  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxScrollEvent_class,"get-event-type" " method", (Scheme_Method_Prim *)objscheme_wxScrollEvent_GetmoveType, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxScrollEvent_class,"set-event-type" " method", (Scheme_Method_Prim *)objscheme_wxScrollEvent_SetmoveType, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxScrollEvent_class,"get-direction" " method", (Scheme_Method_Prim *)objscheme_wxScrollEvent_Getdirection, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxScrollEvent_class,"set-direction" " method", (Scheme_Method_Prim *)objscheme_wxScrollEvent_Setdirection, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxScrollEvent_class,"get-position" " method", (Scheme_Method_Prim *)objscheme_wxScrollEvent_Getpos, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxScrollEvent_class,"set-position" " method", (Scheme_Method_Prim *)objscheme_wxScrollEvent_Setpos, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxScrollEvent_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxScrollEvent(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (objscheme_is_a(obj,  os_wxScrollEvent_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "scroll-event% object or " XC_NULL_STR: "scroll-event% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxScrollEvent(class wxScrollEvent *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxScrollEvent_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  return (Scheme_Object *)obj;
}

class wxScrollEvent *objscheme_unbundle_wxScrollEvent(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxScrollEvent(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxScrollEvent *)o->primdata;
  else
    return (wxScrollEvent *)o->primdata;
}



static Scheme_Object *keyCode_WXK_ESCAPE_sym = NULL;
static Scheme_Object *keyCode_WXK_START_sym = NULL;
static Scheme_Object *keyCode_WXK_CANCEL_sym = NULL;
static Scheme_Object *keyCode_WXK_CLEAR_sym = NULL;
static Scheme_Object *keyCode_WXK_SHIFT_sym = NULL;
static Scheme_Object *keyCode_WXK_CONTROL_sym = NULL;
static Scheme_Object *keyCode_WXK_MENU_sym = NULL;
static Scheme_Object *keyCode_WXK_PAUSE_sym = NULL;
static Scheme_Object *keyCode_WXK_CAPITAL_sym = NULL;
static Scheme_Object *keyCode_WXK_PRIOR_sym = NULL;
static Scheme_Object *keyCode_WXK_NEXT_sym = NULL;
static Scheme_Object *keyCode_WXK_END_sym = NULL;
static Scheme_Object *keyCode_WXK_HOME_sym = NULL;
static Scheme_Object *keyCode_WXK_LEFT_sym = NULL;
static Scheme_Object *keyCode_WXK_UP_sym = NULL;
static Scheme_Object *keyCode_WXK_RIGHT_sym = NULL;
static Scheme_Object *keyCode_WXK_DOWN_sym = NULL;
static Scheme_Object *keyCode_WXK_SELECT_sym = NULL;
static Scheme_Object *keyCode_WXK_PRINT_sym = NULL;
static Scheme_Object *keyCode_WXK_EXECUTE_sym = NULL;
static Scheme_Object *keyCode_WXK_SNAPSHOT_sym = NULL;
static Scheme_Object *keyCode_WXK_INSERT_sym = NULL;
static Scheme_Object *keyCode_WXK_HELP_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD0_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD1_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD2_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD3_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD4_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD5_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD6_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD7_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD8_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMPAD9_sym = NULL;
static Scheme_Object *keyCode_3_sym = NULL;
static Scheme_Object *keyCode_WXK_MULTIPLY_sym = NULL;
static Scheme_Object *keyCode_WXK_ADD_sym = NULL;
static Scheme_Object *keyCode_WXK_SEPARATOR_sym = NULL;
static Scheme_Object *keyCode_WXK_SUBTRACT_sym = NULL;
static Scheme_Object *keyCode_WXK_DECIMAL_sym = NULL;
static Scheme_Object *keyCode_WXK_DIVIDE_sym = NULL;
static Scheme_Object *keyCode_WXK_F1_sym = NULL;
static Scheme_Object *keyCode_WXK_F2_sym = NULL;
static Scheme_Object *keyCode_WXK_F3_sym = NULL;
static Scheme_Object *keyCode_WXK_F4_sym = NULL;
static Scheme_Object *keyCode_WXK_F5_sym = NULL;
static Scheme_Object *keyCode_WXK_F6_sym = NULL;
static Scheme_Object *keyCode_WXK_F7_sym = NULL;
static Scheme_Object *keyCode_WXK_F8_sym = NULL;
static Scheme_Object *keyCode_WXK_F9_sym = NULL;
static Scheme_Object *keyCode_WXK_F10_sym = NULL;
static Scheme_Object *keyCode_WXK_F11_sym = NULL;
static Scheme_Object *keyCode_WXK_F12_sym = NULL;
static Scheme_Object *keyCode_WXK_F13_sym = NULL;
static Scheme_Object *keyCode_WXK_F14_sym = NULL;
static Scheme_Object *keyCode_WXK_F15_sym = NULL;
static Scheme_Object *keyCode_WXK_F16_sym = NULL;
static Scheme_Object *keyCode_WXK_F17_sym = NULL;
static Scheme_Object *keyCode_WXK_F18_sym = NULL;
static Scheme_Object *keyCode_WXK_F19_sym = NULL;
static Scheme_Object *keyCode_WXK_F20_sym = NULL;
static Scheme_Object *keyCode_WXK_F21_sym = NULL;
static Scheme_Object *keyCode_WXK_F22_sym = NULL;
static Scheme_Object *keyCode_WXK_F23_sym = NULL;
static Scheme_Object *keyCode_WXK_F24_sym = NULL;
static Scheme_Object *keyCode_WXK_NUMLOCK_sym = NULL;
static Scheme_Object *keyCode_WXK_SCROLL_sym = NULL;
static Scheme_Object *keyCode_WXK_WHEEL_UP_sym = NULL;
static Scheme_Object *keyCode_WXK_WHEEL_DOWN_sym = NULL;
static Scheme_Object *keyCode_WXK_PRESS_sym = NULL;
static Scheme_Object *keyCode_WXK_RELEASE_sym = NULL;

static void init_symset_keyCode(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(keyCode_WXK_ESCAPE_sym);
  keyCode_WXK_ESCAPE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("escape"));
  wxREGGLOB(keyCode_WXK_START_sym);
  keyCode_WXK_START_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start"));
  wxREGGLOB(keyCode_WXK_CANCEL_sym);
  keyCode_WXK_CANCEL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("cancel"));
  wxREGGLOB(keyCode_WXK_CLEAR_sym);
  keyCode_WXK_CLEAR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("clear"));
  wxREGGLOB(keyCode_WXK_SHIFT_sym);
  keyCode_WXK_SHIFT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("shift"));
  wxREGGLOB(keyCode_WXK_CONTROL_sym);
  keyCode_WXK_CONTROL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("control"));
  wxREGGLOB(keyCode_WXK_MENU_sym);
  keyCode_WXK_MENU_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("menu"));
  wxREGGLOB(keyCode_WXK_PAUSE_sym);
  keyCode_WXK_PAUSE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pause"));
  wxREGGLOB(keyCode_WXK_CAPITAL_sym);
  keyCode_WXK_CAPITAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("capital"));
  wxREGGLOB(keyCode_WXK_PRIOR_sym);
  keyCode_WXK_PRIOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("prior"));
  wxREGGLOB(keyCode_WXK_NEXT_sym);
  keyCode_WXK_NEXT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("next"));
  wxREGGLOB(keyCode_WXK_END_sym);
  keyCode_WXK_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end"));
  wxREGGLOB(keyCode_WXK_HOME_sym);
  keyCode_WXK_HOME_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("home"));
  wxREGGLOB(keyCode_WXK_LEFT_sym);
  keyCode_WXK_LEFT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("left"));
  wxREGGLOB(keyCode_WXK_UP_sym);
  keyCode_WXK_UP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("up"));
  wxREGGLOB(keyCode_WXK_RIGHT_sym);
  keyCode_WXK_RIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("right"));
  wxREGGLOB(keyCode_WXK_DOWN_sym);
  keyCode_WXK_DOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("down"));
  wxREGGLOB(keyCode_WXK_SELECT_sym);
  keyCode_WXK_SELECT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("select"));
  wxREGGLOB(keyCode_WXK_PRINT_sym);
  keyCode_WXK_PRINT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("print"));
  wxREGGLOB(keyCode_WXK_EXECUTE_sym);
  keyCode_WXK_EXECUTE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("execute"));
  wxREGGLOB(keyCode_WXK_SNAPSHOT_sym);
  keyCode_WXK_SNAPSHOT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("snapshot"));
  wxREGGLOB(keyCode_WXK_INSERT_sym);
  keyCode_WXK_INSERT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert"));
  wxREGGLOB(keyCode_WXK_HELP_sym);
  keyCode_WXK_HELP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("help"));
  wxREGGLOB(keyCode_WXK_NUMPAD0_sym);
  keyCode_WXK_NUMPAD0_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad0"));
  wxREGGLOB(keyCode_WXK_NUMPAD1_sym);
  keyCode_WXK_NUMPAD1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad1"));
  wxREGGLOB(keyCode_WXK_NUMPAD2_sym);
  keyCode_WXK_NUMPAD2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad2"));
  wxREGGLOB(keyCode_WXK_NUMPAD3_sym);
  keyCode_WXK_NUMPAD3_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad3"));
  wxREGGLOB(keyCode_WXK_NUMPAD4_sym);
  keyCode_WXK_NUMPAD4_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad4"));
  wxREGGLOB(keyCode_WXK_NUMPAD5_sym);
  keyCode_WXK_NUMPAD5_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad5"));
  wxREGGLOB(keyCode_WXK_NUMPAD6_sym);
  keyCode_WXK_NUMPAD6_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad6"));
  wxREGGLOB(keyCode_WXK_NUMPAD7_sym);
  keyCode_WXK_NUMPAD7_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad7"));
  wxREGGLOB(keyCode_WXK_NUMPAD8_sym);
  keyCode_WXK_NUMPAD8_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad8"));
  wxREGGLOB(keyCode_WXK_NUMPAD9_sym);
  keyCode_WXK_NUMPAD9_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad9"));
  wxREGGLOB(keyCode_3_sym);
  keyCode_3_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numpad-enter"));
  wxREGGLOB(keyCode_WXK_MULTIPLY_sym);
  keyCode_WXK_MULTIPLY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("multiply"));
  wxREGGLOB(keyCode_WXK_ADD_sym);
  keyCode_WXK_ADD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("add"));
  wxREGGLOB(keyCode_WXK_SEPARATOR_sym);
  keyCode_WXK_SEPARATOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("separator"));
  wxREGGLOB(keyCode_WXK_SUBTRACT_sym);
  keyCode_WXK_SUBTRACT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("subtract"));
  wxREGGLOB(keyCode_WXK_DECIMAL_sym);
  keyCode_WXK_DECIMAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("decimal"));
  wxREGGLOB(keyCode_WXK_DIVIDE_sym);
  keyCode_WXK_DIVIDE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("divide"));
  wxREGGLOB(keyCode_WXK_F1_sym);
  keyCode_WXK_F1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f1"));
  wxREGGLOB(keyCode_WXK_F2_sym);
  keyCode_WXK_F2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f2"));
  wxREGGLOB(keyCode_WXK_F3_sym);
  keyCode_WXK_F3_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f3"));
  wxREGGLOB(keyCode_WXK_F4_sym);
  keyCode_WXK_F4_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f4"));
  wxREGGLOB(keyCode_WXK_F5_sym);
  keyCode_WXK_F5_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f5"));
  wxREGGLOB(keyCode_WXK_F6_sym);
  keyCode_WXK_F6_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f6"));
  wxREGGLOB(keyCode_WXK_F7_sym);
  keyCode_WXK_F7_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f7"));
  wxREGGLOB(keyCode_WXK_F8_sym);
  keyCode_WXK_F8_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f8"));
  wxREGGLOB(keyCode_WXK_F9_sym);
  keyCode_WXK_F9_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f9"));
  wxREGGLOB(keyCode_WXK_F10_sym);
  keyCode_WXK_F10_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f10"));
  wxREGGLOB(keyCode_WXK_F11_sym);
  keyCode_WXK_F11_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f11"));
  wxREGGLOB(keyCode_WXK_F12_sym);
  keyCode_WXK_F12_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f12"));
  wxREGGLOB(keyCode_WXK_F13_sym);
  keyCode_WXK_F13_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f13"));
  wxREGGLOB(keyCode_WXK_F14_sym);
  keyCode_WXK_F14_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f14"));
  wxREGGLOB(keyCode_WXK_F15_sym);
  keyCode_WXK_F15_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f15"));
  wxREGGLOB(keyCode_WXK_F16_sym);
  keyCode_WXK_F16_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f16"));
  wxREGGLOB(keyCode_WXK_F17_sym);
  keyCode_WXK_F17_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f17"));
  wxREGGLOB(keyCode_WXK_F18_sym);
  keyCode_WXK_F18_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f18"));
  wxREGGLOB(keyCode_WXK_F19_sym);
  keyCode_WXK_F19_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f19"));
  wxREGGLOB(keyCode_WXK_F20_sym);
  keyCode_WXK_F20_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f20"));
  wxREGGLOB(keyCode_WXK_F21_sym);
  keyCode_WXK_F21_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f21"));
  wxREGGLOB(keyCode_WXK_F22_sym);
  keyCode_WXK_F22_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f22"));
  wxREGGLOB(keyCode_WXK_F23_sym);
  keyCode_WXK_F23_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f23"));
  wxREGGLOB(keyCode_WXK_F24_sym);
  keyCode_WXK_F24_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("f24"));
  wxREGGLOB(keyCode_WXK_NUMLOCK_sym);
  keyCode_WXK_NUMLOCK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("numlock"));
  wxREGGLOB(keyCode_WXK_SCROLL_sym);
  keyCode_WXK_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("scroll"));
  wxREGGLOB(keyCode_WXK_WHEEL_UP_sym);
  keyCode_WXK_WHEEL_UP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("wheel-up"));
  wxREGGLOB(keyCode_WXK_WHEEL_DOWN_sym);
  keyCode_WXK_WHEEL_DOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("wheel-down"));
  wxREGGLOB(keyCode_WXK_PRESS_sym);
  keyCode_WXK_PRESS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("press"));
  wxREGGLOB(keyCode_WXK_RELEASE_sym);
  keyCode_WXK_RELEASE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("release"));
}

static int unbundle_symset_keyCode(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!keyCode_WXK_RELEASE_sym) WITH_VAR_STACK(init_symset_keyCode());
  if (0) { }
  else if (SCHEME_CHARP(v)) { READY_TO_RETURN; return SCHEME_CHAR_VAL(v); }
  else if (v == keyCode_WXK_ESCAPE_sym) { READY_TO_RETURN; return WXK_ESCAPE; }
  else if (v == keyCode_WXK_START_sym) { READY_TO_RETURN; return WXK_START; }
  else if (v == keyCode_WXK_CANCEL_sym) { READY_TO_RETURN; return WXK_CANCEL; }
  else if (v == keyCode_WXK_CLEAR_sym) { READY_TO_RETURN; return WXK_CLEAR; }
  else if (v == keyCode_WXK_SHIFT_sym) { READY_TO_RETURN; return WXK_SHIFT; }
  else if (v == keyCode_WXK_CONTROL_sym) { READY_TO_RETURN; return WXK_CONTROL; }
  else if (v == keyCode_WXK_MENU_sym) { READY_TO_RETURN; return WXK_MENU; }
  else if (v == keyCode_WXK_PAUSE_sym) { READY_TO_RETURN; return WXK_PAUSE; }
  else if (v == keyCode_WXK_CAPITAL_sym) { READY_TO_RETURN; return WXK_CAPITAL; }
  else if (v == keyCode_WXK_PRIOR_sym) { READY_TO_RETURN; return WXK_PRIOR; }
  else if (v == keyCode_WXK_NEXT_sym) { READY_TO_RETURN; return WXK_NEXT; }
  else if (v == keyCode_WXK_END_sym) { READY_TO_RETURN; return WXK_END; }
  else if (v == keyCode_WXK_HOME_sym) { READY_TO_RETURN; return WXK_HOME; }
  else if (v == keyCode_WXK_LEFT_sym) { READY_TO_RETURN; return WXK_LEFT; }
  else if (v == keyCode_WXK_UP_sym) { READY_TO_RETURN; return WXK_UP; }
  else if (v == keyCode_WXK_RIGHT_sym) { READY_TO_RETURN; return WXK_RIGHT; }
  else if (v == keyCode_WXK_DOWN_sym) { READY_TO_RETURN; return WXK_DOWN; }
  else if (v == keyCode_WXK_SELECT_sym) { READY_TO_RETURN; return WXK_SELECT; }
  else if (v == keyCode_WXK_PRINT_sym) { READY_TO_RETURN; return WXK_PRINT; }
  else if (v == keyCode_WXK_EXECUTE_sym) { READY_TO_RETURN; return WXK_EXECUTE; }
  else if (v == keyCode_WXK_SNAPSHOT_sym) { READY_TO_RETURN; return WXK_SNAPSHOT; }
  else if (v == keyCode_WXK_INSERT_sym) { READY_TO_RETURN; return WXK_INSERT; }
  else if (v == keyCode_WXK_HELP_sym) { READY_TO_RETURN; return WXK_HELP; }
  else if (v == keyCode_WXK_NUMPAD0_sym) { READY_TO_RETURN; return WXK_NUMPAD0; }
  else if (v == keyCode_WXK_NUMPAD1_sym) { READY_TO_RETURN; return WXK_NUMPAD1; }
  else if (v == keyCode_WXK_NUMPAD2_sym) { READY_TO_RETURN; return WXK_NUMPAD2; }
  else if (v == keyCode_WXK_NUMPAD3_sym) { READY_TO_RETURN; return WXK_NUMPAD3; }
  else if (v == keyCode_WXK_NUMPAD4_sym) { READY_TO_RETURN; return WXK_NUMPAD4; }
  else if (v == keyCode_WXK_NUMPAD5_sym) { READY_TO_RETURN; return WXK_NUMPAD5; }
  else if (v == keyCode_WXK_NUMPAD6_sym) { READY_TO_RETURN; return WXK_NUMPAD6; }
  else if (v == keyCode_WXK_NUMPAD7_sym) { READY_TO_RETURN; return WXK_NUMPAD7; }
  else if (v == keyCode_WXK_NUMPAD8_sym) { READY_TO_RETURN; return WXK_NUMPAD8; }
  else if (v == keyCode_WXK_NUMPAD9_sym) { READY_TO_RETURN; return WXK_NUMPAD9; }
  else if (v == keyCode_3_sym) { READY_TO_RETURN; return 3; }
  else if (v == keyCode_WXK_MULTIPLY_sym) { READY_TO_RETURN; return WXK_MULTIPLY; }
  else if (v == keyCode_WXK_ADD_sym) { READY_TO_RETURN; return WXK_ADD; }
  else if (v == keyCode_WXK_SEPARATOR_sym) { READY_TO_RETURN; return WXK_SEPARATOR; }
  else if (v == keyCode_WXK_SUBTRACT_sym) { READY_TO_RETURN; return WXK_SUBTRACT; }
  else if (v == keyCode_WXK_DECIMAL_sym) { READY_TO_RETURN; return WXK_DECIMAL; }
  else if (v == keyCode_WXK_DIVIDE_sym) { READY_TO_RETURN; return WXK_DIVIDE; }
  else if (v == keyCode_WXK_F1_sym) { READY_TO_RETURN; return WXK_F1; }
  else if (v == keyCode_WXK_F2_sym) { READY_TO_RETURN; return WXK_F2; }
  else if (v == keyCode_WXK_F3_sym) { READY_TO_RETURN; return WXK_F3; }
  else if (v == keyCode_WXK_F4_sym) { READY_TO_RETURN; return WXK_F4; }
  else if (v == keyCode_WXK_F5_sym) { READY_TO_RETURN; return WXK_F5; }
  else if (v == keyCode_WXK_F6_sym) { READY_TO_RETURN; return WXK_F6; }
  else if (v == keyCode_WXK_F7_sym) { READY_TO_RETURN; return WXK_F7; }
  else if (v == keyCode_WXK_F8_sym) { READY_TO_RETURN; return WXK_F8; }
  else if (v == keyCode_WXK_F9_sym) { READY_TO_RETURN; return WXK_F9; }
  else if (v == keyCode_WXK_F10_sym) { READY_TO_RETURN; return WXK_F10; }
  else if (v == keyCode_WXK_F11_sym) { READY_TO_RETURN; return WXK_F11; }
  else if (v == keyCode_WXK_F12_sym) { READY_TO_RETURN; return WXK_F12; }
  else if (v == keyCode_WXK_F13_sym) { READY_TO_RETURN; return WXK_F13; }
  else if (v == keyCode_WXK_F14_sym) { READY_TO_RETURN; return WXK_F14; }
  else if (v == keyCode_WXK_F15_sym) { READY_TO_RETURN; return WXK_F15; }
  else if (v == keyCode_WXK_F16_sym) { READY_TO_RETURN; return WXK_F16; }
  else if (v == keyCode_WXK_F17_sym) { READY_TO_RETURN; return WXK_F17; }
  else if (v == keyCode_WXK_F18_sym) { READY_TO_RETURN; return WXK_F18; }
  else if (v == keyCode_WXK_F19_sym) { READY_TO_RETURN; return WXK_F19; }
  else if (v == keyCode_WXK_F20_sym) { READY_TO_RETURN; return WXK_F20; }
  else if (v == keyCode_WXK_F21_sym) { READY_TO_RETURN; return WXK_F21; }
  else if (v == keyCode_WXK_F22_sym) { READY_TO_RETURN; return WXK_F22; }
  else if (v == keyCode_WXK_F23_sym) { READY_TO_RETURN; return WXK_F23; }
  else if (v == keyCode_WXK_F24_sym) { READY_TO_RETURN; return WXK_F24; }
  else if (v == keyCode_WXK_NUMLOCK_sym) { READY_TO_RETURN; return WXK_NUMLOCK; }
  else if (v == keyCode_WXK_SCROLL_sym) { READY_TO_RETURN; return WXK_SCROLL; }
  else if (v == keyCode_WXK_WHEEL_UP_sym) { READY_TO_RETURN; return WXK_WHEEL_UP; }
  else if (v == keyCode_WXK_WHEEL_DOWN_sym) { READY_TO_RETURN; return WXK_WHEEL_DOWN; }
  else if (v == keyCode_WXK_PRESS_sym) { READY_TO_RETURN; return WXK_PRESS; }
  else if (v == keyCode_WXK_RELEASE_sym) { READY_TO_RETURN; return WXK_RELEASE; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "keyCode symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_keyCode(int v) {
  if (!keyCode_WXK_RELEASE_sym) init_symset_keyCode();
  switch (v) {
  case WXK_ESCAPE: return keyCode_WXK_ESCAPE_sym;
  case WXK_START: return keyCode_WXK_START_sym;
  case WXK_CANCEL: return keyCode_WXK_CANCEL_sym;
  case WXK_CLEAR: return keyCode_WXK_CLEAR_sym;
  case WXK_SHIFT: return keyCode_WXK_SHIFT_sym;
  case WXK_CONTROL: return keyCode_WXK_CONTROL_sym;
  case WXK_MENU: return keyCode_WXK_MENU_sym;
  case WXK_PAUSE: return keyCode_WXK_PAUSE_sym;
  case WXK_CAPITAL: return keyCode_WXK_CAPITAL_sym;
  case WXK_PRIOR: return keyCode_WXK_PRIOR_sym;
  case WXK_NEXT: return keyCode_WXK_NEXT_sym;
  case WXK_END: return keyCode_WXK_END_sym;
  case WXK_HOME: return keyCode_WXK_HOME_sym;
  case WXK_LEFT: return keyCode_WXK_LEFT_sym;
  case WXK_UP: return keyCode_WXK_UP_sym;
  case WXK_RIGHT: return keyCode_WXK_RIGHT_sym;
  case WXK_DOWN: return keyCode_WXK_DOWN_sym;
  case WXK_SELECT: return keyCode_WXK_SELECT_sym;
  case WXK_PRINT: return keyCode_WXK_PRINT_sym;
  case WXK_EXECUTE: return keyCode_WXK_EXECUTE_sym;
  case WXK_SNAPSHOT: return keyCode_WXK_SNAPSHOT_sym;
  case WXK_INSERT: return keyCode_WXK_INSERT_sym;
  case WXK_HELP: return keyCode_WXK_HELP_sym;
  case WXK_NUMPAD0: return keyCode_WXK_NUMPAD0_sym;
  case WXK_NUMPAD1: return keyCode_WXK_NUMPAD1_sym;
  case WXK_NUMPAD2: return keyCode_WXK_NUMPAD2_sym;
  case WXK_NUMPAD3: return keyCode_WXK_NUMPAD3_sym;
  case WXK_NUMPAD4: return keyCode_WXK_NUMPAD4_sym;
  case WXK_NUMPAD5: return keyCode_WXK_NUMPAD5_sym;
  case WXK_NUMPAD6: return keyCode_WXK_NUMPAD6_sym;
  case WXK_NUMPAD7: return keyCode_WXK_NUMPAD7_sym;
  case WXK_NUMPAD8: return keyCode_WXK_NUMPAD8_sym;
  case WXK_NUMPAD9: return keyCode_WXK_NUMPAD9_sym;
  case 3: return keyCode_3_sym;
  case WXK_MULTIPLY: return keyCode_WXK_MULTIPLY_sym;
  case WXK_ADD: return keyCode_WXK_ADD_sym;
  case WXK_SEPARATOR: return keyCode_WXK_SEPARATOR_sym;
  case WXK_SUBTRACT: return keyCode_WXK_SUBTRACT_sym;
  case WXK_DECIMAL: return keyCode_WXK_DECIMAL_sym;
  case WXK_DIVIDE: return keyCode_WXK_DIVIDE_sym;
  case WXK_F1: return keyCode_WXK_F1_sym;
  case WXK_F2: return keyCode_WXK_F2_sym;
  case WXK_F3: return keyCode_WXK_F3_sym;
  case WXK_F4: return keyCode_WXK_F4_sym;
  case WXK_F5: return keyCode_WXK_F5_sym;
  case WXK_F6: return keyCode_WXK_F6_sym;
  case WXK_F7: return keyCode_WXK_F7_sym;
  case WXK_F8: return keyCode_WXK_F8_sym;
  case WXK_F9: return keyCode_WXK_F9_sym;
  case WXK_F10: return keyCode_WXK_F10_sym;
  case WXK_F11: return keyCode_WXK_F11_sym;
  case WXK_F12: return keyCode_WXK_F12_sym;
  case WXK_F13: return keyCode_WXK_F13_sym;
  case WXK_F14: return keyCode_WXK_F14_sym;
  case WXK_F15: return keyCode_WXK_F15_sym;
  case WXK_F16: return keyCode_WXK_F16_sym;
  case WXK_F17: return keyCode_WXK_F17_sym;
  case WXK_F18: return keyCode_WXK_F18_sym;
  case WXK_F19: return keyCode_WXK_F19_sym;
  case WXK_F20: return keyCode_WXK_F20_sym;
  case WXK_F21: return keyCode_WXK_F21_sym;
  case WXK_F22: return keyCode_WXK_F22_sym;
  case WXK_F23: return keyCode_WXK_F23_sym;
  case WXK_F24: return keyCode_WXK_F24_sym;
  case WXK_NUMLOCK: return keyCode_WXK_NUMLOCK_sym;
  case WXK_SCROLL: return keyCode_WXK_SCROLL_sym;
  case WXK_WHEEL_UP: return keyCode_WXK_WHEEL_UP_sym;
  case WXK_WHEEL_DOWN: return keyCode_WXK_WHEEL_DOWN_sym;
  case WXK_PRESS: return keyCode_WXK_PRESS_sym;
  case WXK_RELEASE: return keyCode_WXK_RELEASE_sym;
  default: return scheme_make_char_or_nul(v);
  }
}


static long GetOtherKey(wxKeyEvent *k) { return k->otherKeyCode; }
static void SetOtherKey(wxKeyEvent *k, long c) { k->otherKeyCode = c; }






class os_wxKeyEvent : public wxKeyEvent_ext {
 public:

  os_wxKeyEvent CONSTRUCTOR_ARGS((int x0 = 0, Bool x1 = 0, Bool x2 = 0, Bool x3 = 0, Bool x4 = 0, int x5 = 0, int x6 = 0, ExactLong x7 = 0));
  ~os_wxKeyEvent();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxKeyEvent::gcMark() {
  wxKeyEvent_ext::gcMark();
}
void os_wxKeyEvent::gcFixup() {
  wxKeyEvent_ext::gcFixup();
}
#endif

static Scheme_Object *os_wxKeyEvent_class;

os_wxKeyEvent::os_wxKeyEvent CONSTRUCTOR_ARGS((int x0, Bool x1, Bool x2, Bool x3, Bool x4, int x5, int x6, ExactLong x7))
CONSTRUCTOR_INIT(: wxKeyEvent_ext(x0, x1, x2, x3, x4, x5, x6, x7))
{
}

os_wxKeyEvent::~os_wxKeyEvent()
{
    objscheme_destroy(this, (Scheme_Object *) __gc_external);
}

static Scheme_Object *os_wxKeyEventSetOtherKey(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  objscheme_check_valid(os_wxKeyEvent_class, "set-other-shift-key-code in key-event%", n, p);
  long x0 INIT_NULLED_OUT;

  SETUP_VAR_STACK_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, x0);

  
  x0 = (SCHEME_FALSEP(p[POFFSET+0]) ? 0 : unbundle_symset_keyCode(p[POFFSET+0], METHODNAME("key-event%","get-other-shift-key-code")));

  
  WITH_VAR_STACK(SetOtherKey(((wxKeyEvent *)((Scheme_Class_Object *)p[0])->primdata), x0));

  
  
  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxKeyEventGetOtherKey(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  long r;
  objscheme_check_valid(os_wxKeyEvent_class, "get-other-shift-key-code in key-event%", n, p);

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  

  
  r = WITH_VAR_STACK(GetOtherKey(((wxKeyEvent *)((Scheme_Class_Object *)p[0])->primdata)));

  
  
  READY_TO_RETURN;
  return (r ? bundle_symset_keyCode(r) : scheme_false);
}

static Scheme_Object *objscheme_wxKeyEvent_GetkeyCode(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-key-code in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-key-code in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::keyCode;
  else
    v = ((wxKeyEvent *)cobj->primdata)->keyCode;

  return WITH_REMEMBERED_STACK(bundle_symset_keyCode(v));
}

static Scheme_Object *objscheme_wxKeyEvent_SetkeyCode(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-key-code in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-key-code in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(unbundle_symset_keyCode(p[POFFSET], "set-key-code in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->keyCode = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_GetkeyUpCode(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-key-release-code in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-key-release-code in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::keyUpCode;
  else
    v = ((wxKeyEvent *)cobj->primdata)->keyUpCode;

  return WITH_REMEMBERED_STACK(bundle_symset_keyCode(v));
}

static Scheme_Object *objscheme_wxKeyEvent_SetkeyUpCode(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-key-release-code in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-key-release-code in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(unbundle_symset_keyCode(p[POFFSET], "set-key-release-code in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->keyUpCode = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_GetshiftDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-shift-down in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-shift-down in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::shiftDown;
  else
    v = ((wxKeyEvent *)cobj->primdata)->shiftDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxKeyEvent_SetshiftDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-shift-down in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-shift-down in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-shift-down in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->shiftDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_GetcontrolDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-control-down in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-control-down in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::controlDown;
  else
    v = ((wxKeyEvent *)cobj->primdata)->controlDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxKeyEvent_SetcontrolDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-control-down in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-control-down in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-control-down in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->controlDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_GetmetaDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-meta-down in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-meta-down in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::metaDown;
  else
    v = ((wxKeyEvent *)cobj->primdata)->metaDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxKeyEvent_SetmetaDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-meta-down in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-meta-down in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-meta-down in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->metaDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_GetaltDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-alt-down in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-alt-down in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::altDown;
  else
    v = ((wxKeyEvent *)cobj->primdata)->altDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxKeyEvent_SetaltDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-alt-down in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-alt-down in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-alt-down in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->altDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_Getx(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-x in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-x in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::x;
  else
    v = ((wxKeyEvent *)cobj->primdata)->x;

  return scheme_make_integer(v);
}

static Scheme_Object *objscheme_wxKeyEvent_Setx(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-x in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-x in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET], "set-x in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->x = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxKeyEvent_Gety(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxKeyEvent_class, "get-y in key-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-y in key-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxKeyEvent *)cobj->primdata)->wxKeyEvent::y;
  else
    v = ((wxKeyEvent *)cobj->primdata)->y;

  return scheme_make_integer(v);
}

static Scheme_Object *objscheme_wxKeyEvent_Sety(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxKeyEvent_class, "set-y in key-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-y in key-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET], "set-y in key-event%"));
  ((wxKeyEvent *)cobj->primdata)->y = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxKeyEvent_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxKeyEvent *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  int x0;
  Bool x1;
  Bool x2;
  Bool x3;
  Bool x4;
  int x5;
  int x6;
  ExactLong x7;

  SETUP_VAR_STACK_PRE_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, realobj);

  
  if ((n > (POFFSET+8))) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in key-event%", POFFSET+POFFSET, POFFSET+8, n, p, 1));
  if (n > (POFFSET+0)) {
    x0 = WITH_VAR_STACK(unbundle_symset_keyCode(p[POFFSET+0], "initialization in key-event%"));
  } else
    x0 = 0;
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "initialization in key-event%"));
  } else
    x1 = 0;
  if (n > (POFFSET+2)) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "initialization in key-event%"));
  } else
    x2 = 0;
  if (n > (POFFSET+3)) {
    x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "initialization in key-event%"));
  } else
    x3 = 0;
  if (n > (POFFSET+4)) {
    x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "initialization in key-event%"));
  } else
    x4 = 0;
  if (n > (POFFSET+5)) {
    x5 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+5], "initialization in key-event%"));
  } else
    x5 = 0;
  if (n > (POFFSET+6)) {
    x6 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+6], "initialization in key-event%"));
  } else
    x6 = 0;
  if (n > (POFFSET+7)) {
    x7 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+7], "initialization in key-event%"));
  } else
    x7 = 0;

  
  realobj = WITH_VAR_STACK(new os_wxKeyEvent CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6, x7)));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxKeyEvent_ext(x0, x1, x2, x3, x4, x5, x6, x7));
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxKeyEvent(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxKeyEvent_class);

  os_wxKeyEvent_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "key-event%", "event%", (Scheme_Method_Prim *)os_wxKeyEvent_ConstructScheme, 18));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class, "set-other-shift-key-code" " method", (Scheme_Method_Prim *)os_wxKeyEventSetOtherKey, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class, "get-other-shift-key-code" " method", (Scheme_Method_Prim *)os_wxKeyEventGetOtherKey, 0, 0));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-key-code" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_GetkeyCode, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-key-code" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_SetkeyCode, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-key-release-code" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_GetkeyUpCode, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-key-release-code" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_SetkeyUpCode, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-shift-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_GetshiftDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-shift-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_SetshiftDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-control-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_GetcontrolDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-control-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_SetcontrolDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-meta-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_GetmetaDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-meta-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_SetmetaDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-alt-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_GetaltDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-alt-down" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_SetaltDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-x" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_Getx, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-x" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_Setx, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"get-y" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_Gety, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeyEvent_class,"set-y" " method", (Scheme_Method_Prim *)objscheme_wxKeyEvent_Sety, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxKeyEvent_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxKeyEvent(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (objscheme_is_a(obj,  os_wxKeyEvent_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "key-event% object or " XC_NULL_STR: "key-event% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxKeyEvent_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  return (Scheme_Object *)obj;
}

class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxKeyEvent(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxKeyEvent *)o->primdata;
  else
    return (wxKeyEvent *)o->primdata;
}


static int wxKeySymbolToInteger(int v) { return v; }



static Scheme_Object *wxKeyEventGlobalwxKeySymbolToInteger(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  int r;
  int x0;

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  
  x0 = WITH_VAR_STACK(unbundle_symset_keyCode(p[0+0], NULL));

  
  r = WITH_VAR_STACK(wxKeySymbolToInteger(x0));

  
  
  READY_TO_RETURN;
  return scheme_make_integer(r);
}

void objscheme_setup_wxKeyEventGlobal(Scheme_Env *env)
{
  Scheme_Object *functmp INIT_NULLED_OUT;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);
  functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxKeyEventGlobalwxKeySymbolToInteger, "key-symbol-to-integer", 1, 1));
  WITH_VAR_STACK(scheme_install_xc_global("key-symbol-to-integer", functmp, env));
  READY_TO_RETURN;
}


static Scheme_Object *mouseEventType_wxEVENT_TYPE_LEFT_DOWN_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_LEFT_UP_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_MIDDLE_DOWN_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_MIDDLE_UP_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_RIGHT_DOWN_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_RIGHT_UP_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_MOTION_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_ENTER_WINDOW_sym = NULL;
static Scheme_Object *mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym = NULL;

static void init_symset_mouseEventType(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_LEFT_DOWN_sym);
  mouseEventType_wxEVENT_TYPE_LEFT_DOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("left-down"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_LEFT_UP_sym);
  mouseEventType_wxEVENT_TYPE_LEFT_UP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("left-up"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_MIDDLE_DOWN_sym);
  mouseEventType_wxEVENT_TYPE_MIDDLE_DOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("middle-down"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_MIDDLE_UP_sym);
  mouseEventType_wxEVENT_TYPE_MIDDLE_UP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("middle-up"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_RIGHT_DOWN_sym);
  mouseEventType_wxEVENT_TYPE_RIGHT_DOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("right-down"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_RIGHT_UP_sym);
  mouseEventType_wxEVENT_TYPE_RIGHT_UP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("right-up"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_MOTION_sym);
  mouseEventType_wxEVENT_TYPE_MOTION_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("motion"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_ENTER_WINDOW_sym);
  mouseEventType_wxEVENT_TYPE_ENTER_WINDOW_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("enter"));
  wxREGGLOB(mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym);
  mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("leave"));
}

static int unbundle_symset_mouseEventType(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym) WITH_VAR_STACK(init_symset_mouseEventType());
  if (0) { }
  else if (v == mouseEventType_wxEVENT_TYPE_LEFT_DOWN_sym) { READY_TO_RETURN; return wxEVENT_TYPE_LEFT_DOWN; }
  else if (v == mouseEventType_wxEVENT_TYPE_LEFT_UP_sym) { READY_TO_RETURN; return wxEVENT_TYPE_LEFT_UP; }
  else if (v == mouseEventType_wxEVENT_TYPE_MIDDLE_DOWN_sym) { READY_TO_RETURN; return wxEVENT_TYPE_MIDDLE_DOWN; }
  else if (v == mouseEventType_wxEVENT_TYPE_MIDDLE_UP_sym) { READY_TO_RETURN; return wxEVENT_TYPE_MIDDLE_UP; }
  else if (v == mouseEventType_wxEVENT_TYPE_RIGHT_DOWN_sym) { READY_TO_RETURN; return wxEVENT_TYPE_RIGHT_DOWN; }
  else if (v == mouseEventType_wxEVENT_TYPE_RIGHT_UP_sym) { READY_TO_RETURN; return wxEVENT_TYPE_RIGHT_UP; }
  else if (v == mouseEventType_wxEVENT_TYPE_MOTION_sym) { READY_TO_RETURN; return wxEVENT_TYPE_MOTION; }
  else if (v == mouseEventType_wxEVENT_TYPE_ENTER_WINDOW_sym) { READY_TO_RETURN; return wxEVENT_TYPE_ENTER_WINDOW; }
  else if (v == mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym) { READY_TO_RETURN; return wxEVENT_TYPE_LEAVE_WINDOW; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "mouseEventType symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}

static Scheme_Object *bundle_symset_mouseEventType(int v) {
  if (!mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym) init_symset_mouseEventType();
  switch (v) {
  case wxEVENT_TYPE_LEFT_DOWN: return mouseEventType_wxEVENT_TYPE_LEFT_DOWN_sym;
  case wxEVENT_TYPE_LEFT_UP: return mouseEventType_wxEVENT_TYPE_LEFT_UP_sym;
  case wxEVENT_TYPE_MIDDLE_DOWN: return mouseEventType_wxEVENT_TYPE_MIDDLE_DOWN_sym;
  case wxEVENT_TYPE_MIDDLE_UP: return mouseEventType_wxEVENT_TYPE_MIDDLE_UP_sym;
  case wxEVENT_TYPE_RIGHT_DOWN: return mouseEventType_wxEVENT_TYPE_RIGHT_DOWN_sym;
  case wxEVENT_TYPE_RIGHT_UP: return mouseEventType_wxEVENT_TYPE_RIGHT_UP_sym;
  case wxEVENT_TYPE_MOTION: return mouseEventType_wxEVENT_TYPE_MOTION_sym;
  case wxEVENT_TYPE_ENTER_WINDOW: return mouseEventType_wxEVENT_TYPE_ENTER_WINDOW_sym;
  case wxEVENT_TYPE_LEAVE_WINDOW: return mouseEventType_wxEVENT_TYPE_LEAVE_WINDOW_sym;
  default: return NULL;
  }
}


#define NEGATIVE_ONE (-1)
static Scheme_Object *buttonId_NEGATIVE_ONE_sym = NULL;
static Scheme_Object *buttonId_1_sym = NULL;
static Scheme_Object *buttonId_2_sym = NULL;
static Scheme_Object *buttonId_3_sym = NULL;

static void init_symset_buttonId(void) {
  REMEMBER_VAR_STACK();
  wxREGGLOB(buttonId_NEGATIVE_ONE_sym);
  buttonId_NEGATIVE_ONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("any"));
  wxREGGLOB(buttonId_1_sym);
  buttonId_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("left"));
  wxREGGLOB(buttonId_2_sym);
  buttonId_2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("middle"));
  wxREGGLOB(buttonId_3_sym);
  buttonId_3_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("right"));
}

static int unbundle_symset_buttonId(Scheme_Object *v, const char *where) {
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, v);
  if (!buttonId_3_sym) WITH_VAR_STACK(init_symset_buttonId());
  if (0) { }
  else if (v == buttonId_NEGATIVE_ONE_sym) { READY_TO_RETURN; return NEGATIVE_ONE; }
  else if (v == buttonId_1_sym) { READY_TO_RETURN; return 1; }
  else if (v == buttonId_2_sym) { READY_TO_RETURN; return 2; }
  else if (v == buttonId_3_sym) { READY_TO_RETURN; return 3; }
  if (where) WITH_VAR_STACK(scheme_wrong_type(where, "buttonId symbol", -1, 0, &v));
  READY_TO_RETURN;
  return 0;
}






class os_wxMouseEvent : public wxMouseEvent_ext {
 public:

  os_wxMouseEvent CONSTRUCTOR_ARGS((int x0, Bool x1 = 0, Bool x2 = 0, Bool x3 = 0, int x4 = 0, int x5 = 0, Bool x6 = 0, Bool x7 = 0, Bool x8 = 0, Bool x9 = 0, ExactLong x10 = 0));
  ~os_wxMouseEvent();
#ifdef MZ_PRECISE_GC
  void gcMark();
  void gcFixup();
#endif
};

#ifdef MZ_PRECISE_GC
void os_wxMouseEvent::gcMark() {
  wxMouseEvent_ext::gcMark();
}
void os_wxMouseEvent::gcFixup() {
  wxMouseEvent_ext::gcFixup();
}
#endif

static Scheme_Object *os_wxMouseEvent_class;

os_wxMouseEvent::os_wxMouseEvent CONSTRUCTOR_ARGS((int x0, Bool x1, Bool x2, Bool x3, int x4, int x5, Bool x6, Bool x7, Bool x8, Bool x9, ExactLong x10))
CONSTRUCTOR_INIT(: wxMouseEvent_ext(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10))
{
}

os_wxMouseEvent::~os_wxMouseEvent()
{
    objscheme_destroy(this, (Scheme_Object *) __gc_external);
}

static Scheme_Object *os_wxMouseEventMoving(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "moving? in mouse-event%", n, p);

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->Moving());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxMouseEventLeaving(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "leaving? in mouse-event%", n, p);

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->Leaving());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxMouseEventEntering(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "entering? in mouse-event%", n, p);

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->Entering());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxMouseEventDragging(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "dragging? in mouse-event%", n, p);

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->Dragging());

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxMouseEventButtonUp(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "button-up? in mouse-event%", n, p);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  
  if (n > (POFFSET+0)) {
    x0 = WITH_VAR_STACK(unbundle_symset_buttonId(p[POFFSET+0], "button-up? in mouse-event%"));
  } else
    x0 = -1;

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->ButtonUp(x0));

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxMouseEventButtonDown(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "button-down? in mouse-event%", n, p);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  
  if (n > (POFFSET+0)) {
    x0 = WITH_VAR_STACK(unbundle_symset_buttonId(p[POFFSET+0], "button-down? in mouse-event%"));
  } else
    x0 = -1;

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->ButtonDown(x0));

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *os_wxMouseEventButton(int n,  Scheme_Object *p[])
{
  WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
  REMEMBER_VAR_STACK();
  Bool r;
  objscheme_check_valid(os_wxMouseEvent_class, "button-changed? in mouse-event%", n, p);
  int x0;

  SETUP_VAR_STACK_REMEMBERED(1);
  VAR_STACK_PUSH(0, p);

  
  if (n > (POFFSET+0)) {
    x0 = WITH_VAR_STACK(unbundle_symset_buttonId(p[POFFSET+0], "button-changed? in mouse-event%"));
  } else
    x0 = -1;

  
  r = WITH_VAR_STACK(((wxMouseEvent *)((Scheme_Class_Object *)p[0])->primdata)->Button(x0));

  
  
  READY_TO_RETURN;
  return (r ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_GeteventType(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-event-type in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-event-type in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::eventType;
  else
    v = ((wxMouseEvent *)cobj->primdata)->eventType;

  return WITH_REMEMBERED_STACK(bundle_symset_mouseEventType(v));
}

static Scheme_Object *objscheme_wxMouseEvent_SeteventType(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-event-type in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-event-type in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(unbundle_symset_mouseEventType(p[POFFSET], "set-event-type in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->eventType = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetleftDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-left-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-left-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::leftDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->leftDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetleftDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-left-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-left-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-left-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->leftDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetmiddleDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-middle-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-middle-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::middleDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->middleDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetmiddleDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-middle-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-middle-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-middle-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->middleDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetrightDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-right-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-right-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::rightDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->rightDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetrightDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-right-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-right-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-right-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->rightDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetshiftDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-shift-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-shift-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::shiftDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->shiftDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetshiftDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-shift-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-shift-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-shift-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->shiftDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetcontrolDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-control-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-control-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::controlDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->controlDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetcontrolDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-control-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-control-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-control-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->controlDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetmetaDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-meta-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-meta-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::metaDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->metaDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetmetaDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-meta-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-meta-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-meta-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->metaDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_GetaltDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  Bool v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-alt-down in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-alt-down in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::altDown;
  else
    v = ((wxMouseEvent *)cobj->primdata)->altDown;

  return (v ? scheme_true : scheme_false);
}

static Scheme_Object *objscheme_wxMouseEvent_SetaltDown(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  Bool v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-alt-down in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-alt-down in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-alt-down in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->altDown = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_Getx(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-x in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-x in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::x;
  else
    v = ((wxMouseEvent *)cobj->primdata)->x;

  return scheme_make_integer(v);
}

static Scheme_Object *objscheme_wxMouseEvent_Setx(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-x in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-x in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET], "set-x in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->x = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *objscheme_wxMouseEvent_Gety(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj INIT_NULLED_OUT;
  int v;
  REMEMBER_VAR_STACK();

  objscheme_check_valid(os_wxMouseEvent_class, "get-y in mouse-event%", n, p);
  if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-y in mouse-event%", POFFSET, POFFSET, n, p, 1));
  cobj = (Scheme_Class_Object *)p[0];
  if (cobj->primflag)
    v = ((os_wxMouseEvent *)cobj->primdata)->wxMouseEvent::y;
  else
    v = ((wxMouseEvent *)cobj->primdata)->y;

  return scheme_make_integer(v);
}

static Scheme_Object *objscheme_wxMouseEvent_Sety(int n,  Scheme_Object *p[])
{
  Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
  int v;
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, cobj);

  WITH_VAR_STACK(objscheme_check_valid(os_wxMouseEvent_class, "set-y in mouse-event%", n, p));
  if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-y in mouse-event%", POFFSET+1, POFFSET+1, n, p, 1));

  v = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET], "set-y in mouse-event%"));
  ((wxMouseEvent *)cobj->primdata)->y = v;

  READY_TO_RETURN;
  return scheme_void;
}

static Scheme_Object *os_wxMouseEvent_ConstructScheme(int n,  Scheme_Object *p[])
{
  SETUP_PRE_VAR_STACK(1);
  PRE_VAR_STACK_PUSH(0, p);
  os_wxMouseEvent *realobj INIT_NULLED_OUT;
  REMEMBER_VAR_STACK();
  int x0;
  Bool x1;
  Bool x2;
  Bool x3;
  int x4;
  int x5;
  Bool x6;
  Bool x7;
  Bool x8;
  Bool x9;
  ExactLong x10;

  SETUP_VAR_STACK_PRE_REMEMBERED(2);
  VAR_STACK_PUSH(0, p);
  VAR_STACK_PUSH(1, realobj);

  
  if ((n < (POFFSET+1)) || (n > (POFFSET+11))) 
    WITH_VAR_STACK(scheme_wrong_count_m("initialization in mouse-event%", POFFSET+1, POFFSET+11, n, p, 1));
  x0 = WITH_VAR_STACK(unbundle_symset_mouseEventType(p[POFFSET+0], "initialization in mouse-event%"));
  if (n > (POFFSET+1)) {
    x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "initialization in mouse-event%"));
  } else
    x1 = 0;
  if (n > (POFFSET+2)) {
    x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "initialization in mouse-event%"));
  } else
    x2 = 0;
  if (n > (POFFSET+3)) {
    x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "initialization in mouse-event%"));
  } else
    x3 = 0;
  if (n > (POFFSET+4)) {
    x4 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+4], "initialization in mouse-event%"));
  } else
    x4 = 0;
  if (n > (POFFSET+5)) {
    x5 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+5], "initialization in mouse-event%"));
  } else
    x5 = 0;
  if (n > (POFFSET+6)) {
    x6 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+6], "initialization in mouse-event%"));
  } else
    x6 = 0;
  if (n > (POFFSET+7)) {
    x7 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+7], "initialization in mouse-event%"));
  } else
    x7 = 0;
  if (n > (POFFSET+8)) {
    x8 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+8], "initialization in mouse-event%"));
  } else
    x8 = 0;
  if (n > (POFFSET+9)) {
    x9 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+9], "initialization in mouse-event%"));
  } else
    x9 = 0;
  if (n > (POFFSET+10)) {
    x10 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+10], "initialization in mouse-event%"));
  } else
    x10 = 0;

  
  realobj = WITH_VAR_STACK(new os_wxMouseEvent CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)));
#ifdef MZ_PRECISE_GC
  WITH_VAR_STACK(realobj->gcInit_wxMouseEvent_ext(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10));
#endif
  realobj->__gc_external = (void *)p[0];
  
  
  READY_TO_RETURN;
  ((Scheme_Class_Object *)p[0])->primdata = realobj;
  ((Scheme_Class_Object *)p[0])->primflag = 1;
  return scheme_void;
}

void objscheme_setup_wxMouseEvent(Scheme_Env *env)
{
  SETUP_VAR_STACK(1);
  VAR_STACK_PUSH(0, env);

  wxREGGLOB(os_wxMouseEvent_class);

  os_wxMouseEvent_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "mouse-event%", "event%", (Scheme_Method_Prim *)os_wxMouseEvent_ConstructScheme, 27));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "moving?" " method", (Scheme_Method_Prim *)os_wxMouseEventMoving, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "leaving?" " method", (Scheme_Method_Prim *)os_wxMouseEventLeaving, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "entering?" " method", (Scheme_Method_Prim *)os_wxMouseEventEntering, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "dragging?" " method", (Scheme_Method_Prim *)os_wxMouseEventDragging, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "button-up?" " method", (Scheme_Method_Prim *)os_wxMouseEventButtonUp, 0, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "button-down?" " method", (Scheme_Method_Prim *)os_wxMouseEventButtonDown, 0, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class, "button-changed?" " method", (Scheme_Method_Prim *)os_wxMouseEventButton, 0, 1));

  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-event-type" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GeteventType, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-event-type" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SeteventType, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-left-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetleftDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-left-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetleftDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-middle-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetmiddleDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-middle-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetmiddleDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-right-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetrightDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-right-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetrightDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-shift-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetshiftDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-shift-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetshiftDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-control-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetcontrolDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-control-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetcontrolDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-meta-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetmetaDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-meta-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetmetaDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-alt-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_GetaltDown, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-alt-down" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_SetaltDown, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-x" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_Getx, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-x" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_Setx, 1, 1));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"get-y" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_Gety, 0, 0));
  WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMouseEvent_class,"set-y" " method", (Scheme_Method_Prim *)objscheme_wxMouseEvent_Sety, 1, 1));

  WITH_VAR_STACK(scheme_made_class(os_wxMouseEvent_class));


  READY_TO_RETURN;
}

int objscheme_istype_wxMouseEvent(Scheme_Object *obj, const char *stop, int nullOK)
{
  REMEMBER_VAR_STACK();
  if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
  if (objscheme_is_a(obj,  os_wxMouseEvent_class))
    return 1;
  else {
    if (!stop)
       return 0;
    WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "mouse-event% object or " XC_NULL_STR: "mouse-event% object", -1, 0, &obj));
    return 0;
  }
}

Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *realobj)
{
  Scheme_Class_Object *obj INIT_NULLED_OUT;
  Scheme_Object *sobj INIT_NULLED_OUT;

  if (!realobj) return XC_SCHEME_NULL;

  if (realobj->__gc_external)
    return (Scheme_Object *)realobj->__gc_external;

  SETUP_VAR_STACK(2);
  VAR_STACK_PUSH(0, obj);
  VAR_STACK_PUSH(1, realobj);

  if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
    { READY_TO_RETURN; return sobj; }
  obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMouseEvent_class));

  obj->primdata = realobj;
  obj->primflag = 0;

  realobj->__gc_external = (void *)obj;
  READY_TO_RETURN;
  return (Scheme_Object *)obj;
}

class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *obj, const char *where, int nullOK)
{
  if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;

  REMEMBER_VAR_STACK();

  (void)objscheme_istype_wxMouseEvent(obj, where, nullOK);
  Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
  WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
  if (o->primflag)
    return (os_wxMouseEvent *)o->primdata;
  else
    return (wxMouseEvent *)o->primdata;
}

