Back to index

plt-scheme  4.2.1
wxs_menu.cxx
Go to the documentation of this file.
00001 /* DO NOT EDIT THIS FILE. */
00002 /* This file was generated by xctocc from "wxs_menu.xc". */
00003 
00004 
00005 #if defined(_MSC_VER)
00006 # include "wx.h"
00007 #endif
00008 #if defined(OS_X)
00009 # include "common.h"
00010 #endif
00011 
00012 #include "wx_menu.h"
00013 
00014 #include "wxscheme.h"
00015 #include "wxs_menu.h"
00016 
00017 #ifdef MZ_PRECISE_GC
00018 START_XFORM_SKIP;
00019 #endif
00020 
00021 
00022 
00023 
00024 #ifdef wx_x
00025 # define BM_SELECTED(map) ((map)->selectedTo)
00026 #endif
00027 #if defined(wx_mac) || defined(wx_msw)
00028 # define BM_SELECTED(map) ((map)->selectedInto)
00029 #endif
00030 # define BM_IN_USE(map) ((map)->selectedIntoDC)
00031 
00032 
00033 
00034 
00035 #define ESCAPE_NO_RET_VAL /*empty*/
00036 
00037 
00038 #ifdef wx_mac
00039 # define MAC_UNUSED(x) 
00040 #else
00041 # define MAC_UNUSED(x) x
00042 #endif
00043 #ifdef wx_xt
00044 # define WINMAC_UNUSED(x) x
00045 #else
00046 # define WINMAC_UNUSED(x) 
00047 #endif
00048 
00049 static void menuSelect(wxMenu *MAC_UNUSED(m), wxMenuBar *WINMAC_UNUSED(mb))
00050 {
00051 #ifdef wx_msw
00052   m->SelectMenu();
00053 #endif
00054 #ifdef wx_xt
00055   mb->SelectAMenu(m);
00056 #endif
00057 }
00058 
00059 // @CLASSBASE wxMenuItem "menu-item" : "object"
00060 // @END
00061 
00062 // wxMenu is really derived from wxItem
00063 //  but that makes no sense. Enforce different hierarchy here
00064 
00065 
00066 #define CB_FUNCTYPE wxFunction 
00067 
00068 
00069 #undef CALLBACKCLASS
00070 #undef CB_REALCLASS
00071 #undef CB_UNBUNDLE
00072 #undef CB_USER
00073 
00074 #define CALLBACKCLASS os_wxMenu
00075 #define CB_REALCLASS wxMenu
00076 #define CB_UNBUNDLE objscheme_unbundle_wxMenu
00077 #define CB_USER METHODNAME("menu%","initialization")
00078 
00079 #undef CB_TOSCHEME
00080 #undef CB_TOC
00081 #define CB_TOSCHEME wxMenuCallbackToScheme
00082 #define CB_TOC wxMenuCallbackToC
00083 
00084 
00085 class CALLBACKCLASS;
00086 
00087 
00088 
00089 
00090 
00091 extern wxCommandEvent *objscheme_unbundle_wxCommandEvent(Scheme_Object *,const char *,int);
00092 extern Scheme_Object *objscheme_bundle_wxCommandEvent(wxCommandEvent *);
00093 
00094 static void CB_TOSCHEME(CB_REALCLASS *obj, wxCommandEvent *event);
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 class os_wxMenu : public wxMenu {
00104  public:
00105   Scheme_Object *callback_closure;
00106 
00107   os_wxMenu CONSTRUCTOR_ARGS((nstring x0 = NULL, wxFunction x1 = NULL, class wxFont* x2 = NULL));
00108   ~os_wxMenu();
00109 #ifdef MZ_PRECISE_GC
00110   void gcMark();
00111   void gcFixup();
00112 #endif
00113 };
00114 
00115 #ifdef MZ_PRECISE_GC
00116 void os_wxMenu::gcMark() {
00117   wxMenu::gcMark();
00118   gcMARK_TYPED(Scheme_Object *, callback_closure);
00119 }
00120 void os_wxMenu::gcFixup() {
00121   wxMenu::gcFixup();
00122   gcFIXUP_TYPED(Scheme_Object *, callback_closure);
00123 }
00124 #endif
00125 
00126 static Scheme_Object *os_wxMenu_class;
00127 
00128 os_wxMenu::os_wxMenu CONSTRUCTOR_ARGS((nstring x0, wxFunction x1, class wxFont* x2))
00129 CONSTRUCTOR_INIT(: wxMenu(x0, x1, x2))
00130 {
00131 }
00132 
00133 os_wxMenu::~os_wxMenu()
00134 {
00135     objscheme_destroy(this, (Scheme_Object *) __gc_external);
00136 }
00137 
00138 static Scheme_Object *os_wxMenumenuSelect(int n,  Scheme_Object *p[])
00139 {
00140   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00141   REMEMBER_VAR_STACK();
00142   objscheme_check_valid(os_wxMenu_class, "select in menu%", n, p);
00143   class wxMenuBar* x0 INIT_NULLED_OUT;
00144 
00145   SETUP_VAR_STACK_REMEMBERED(2);
00146   VAR_STACK_PUSH(0, p);
00147   VAR_STACK_PUSH(1, x0);
00148 
00149   
00150   x0 = WITH_VAR_STACK(objscheme_unbundle_wxMenuBar(p[POFFSET+0], "select in menu%", 1));
00151 
00152   
00153   WITH_VAR_STACK(menuSelect(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata), x0));
00154 
00155   
00156   
00157   READY_TO_RETURN;
00158   return scheme_void;
00159 }
00160 
00161 static Scheme_Object *os_wxMenuGetFont(int n,  Scheme_Object *p[])
00162 {
00163   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00164   REMEMBER_VAR_STACK();
00165   class wxFont* r;
00166   objscheme_check_valid(os_wxMenu_class, "get-font in menu%", n, p);
00167 
00168   SETUP_VAR_STACK_REMEMBERED(1);
00169   VAR_STACK_PUSH(0, p);
00170 
00171   
00172 
00173   
00174   r = WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->GetFont());
00175 
00176   
00177   
00178   READY_TO_RETURN;
00179   return WITH_REMEMBERED_STACK(objscheme_bundle_wxFont(r));
00180 }
00181 
00182 static Scheme_Object *os_wxMenuSetWidth(int n,  Scheme_Object *p[])
00183 {
00184   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00185   REMEMBER_VAR_STACK();
00186   objscheme_check_valid(os_wxMenu_class, "set-width in menu%", n, p);
00187   int x0;
00188 
00189   SETUP_VAR_STACK_REMEMBERED(1);
00190   VAR_STACK_PUSH(0, p);
00191 
00192   
00193   x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "set-width in menu%"));
00194 
00195   
00196   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->SetWidth(x0));
00197 
00198   
00199   
00200   READY_TO_RETURN;
00201   return scheme_void;
00202 }
00203 
00204 static Scheme_Object *os_wxMenuSetTitle(int n,  Scheme_Object *p[])
00205 {
00206   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00207   REMEMBER_VAR_STACK();
00208   objscheme_check_valid(os_wxMenu_class, "set-title in menu%", n, p);
00209   string x0 INIT_NULLED_OUT;
00210 
00211   SETUP_VAR_STACK_REMEMBERED(2);
00212   VAR_STACK_PUSH(0, p);
00213   VAR_STACK_PUSH(1, x0);
00214 
00215   
00216   x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-title in menu%"));
00217 
00218   
00219   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->SetTitle(x0));
00220 
00221   
00222   
00223   READY_TO_RETURN;
00224   return scheme_void;
00225 }
00226 
00227 static Scheme_Object *os_wxMenuSetLabel(int n,  Scheme_Object *p[])
00228 {
00229   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00230   REMEMBER_VAR_STACK();
00231   objscheme_check_valid(os_wxMenu_class, "set-label in menu%", n, p);
00232   ExactLong x0;
00233   string x1 INIT_NULLED_OUT;
00234 
00235   SETUP_VAR_STACK_REMEMBERED(2);
00236   VAR_STACK_PUSH(0, p);
00237   VAR_STACK_PUSH(1, x1);
00238 
00239   
00240   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "set-label in menu%"));
00241   x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "set-label in menu%"));
00242 
00243   
00244   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->SetLabel(x0, x1));
00245 
00246   
00247   
00248   READY_TO_RETURN;
00249   return scheme_void;
00250 }
00251 
00252 static Scheme_Object *os_wxMenuSetHelpString(int n,  Scheme_Object *p[])
00253 {
00254   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00255   REMEMBER_VAR_STACK();
00256   objscheme_check_valid(os_wxMenu_class, "set-help-string in menu%", n, p);
00257   ExactLong x0;
00258   nstring x1 INIT_NULLED_OUT;
00259 
00260   SETUP_VAR_STACK_REMEMBERED(2);
00261   VAR_STACK_PUSH(0, p);
00262   VAR_STACK_PUSH(1, x1);
00263 
00264   
00265   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "set-help-string in menu%"));
00266   x1 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[POFFSET+1], "set-help-string in menu%"));
00267 
00268   
00269   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->SetHelpString(x0, x1));
00270 
00271   
00272   
00273   READY_TO_RETURN;
00274   return scheme_void;
00275 }
00276 
00277 static Scheme_Object *os_wxMenuNumber(int n,  Scheme_Object *p[])
00278 {
00279   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00280   REMEMBER_VAR_STACK();
00281   int r;
00282   objscheme_check_valid(os_wxMenu_class, "number in menu%", n, p);
00283 
00284   SETUP_VAR_STACK_REMEMBERED(1);
00285   VAR_STACK_PUSH(0, p);
00286 
00287   
00288 
00289   
00290   r = WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Number());
00291 
00292   
00293   
00294   READY_TO_RETURN;
00295   return scheme_make_integer(r);
00296 }
00297 
00298 static Scheme_Object *os_wxMenuEnable(int n,  Scheme_Object *p[])
00299 {
00300   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00301   REMEMBER_VAR_STACK();
00302   objscheme_check_valid(os_wxMenu_class, "enable in menu%", n, p);
00303   ExactLong x0;
00304   Bool x1;
00305 
00306   SETUP_VAR_STACK_REMEMBERED(1);
00307   VAR_STACK_PUSH(0, p);
00308 
00309   
00310   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "enable in menu%"));
00311   x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "enable in menu%"));
00312 
00313   
00314   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Enable(x0, x1));
00315 
00316   
00317   
00318   READY_TO_RETURN;
00319   return scheme_void;
00320 }
00321 
00322 static Scheme_Object *os_wxMenuCheck(int n,  Scheme_Object *p[])
00323 {
00324   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00325   REMEMBER_VAR_STACK();
00326   objscheme_check_valid(os_wxMenu_class, "check in menu%", n, p);
00327   ExactLong x0;
00328   Bool x1;
00329 
00330   SETUP_VAR_STACK_REMEMBERED(1);
00331   VAR_STACK_PUSH(0, p);
00332 
00333   
00334   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "check in menu%"));
00335   x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "check in menu%"));
00336 
00337   
00338   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Check(x0, x1));
00339 
00340   
00341   
00342   READY_TO_RETURN;
00343   return scheme_void;
00344 }
00345 
00346 static Scheme_Object *os_wxMenuChecked(int n,  Scheme_Object *p[])
00347 {
00348   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00349   REMEMBER_VAR_STACK();
00350   Bool r;
00351   objscheme_check_valid(os_wxMenu_class, "checked? in menu%", n, p);
00352   ExactLong x0;
00353 
00354   SETUP_VAR_STACK_REMEMBERED(1);
00355   VAR_STACK_PUSH(0, p);
00356 
00357   
00358   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "checked? in menu%"));
00359 
00360   
00361   r = WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Checked(x0));
00362 
00363   
00364   
00365   READY_TO_RETURN;
00366   return (r ? scheme_true : scheme_false);
00367 }
00368 
00369 static Scheme_Object *os_wxMenuAppendSeparator(int n,  Scheme_Object *p[])
00370 {
00371   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00372   REMEMBER_VAR_STACK();
00373   objscheme_check_valid(os_wxMenu_class, "append-separator in menu%", n, p);
00374 
00375   SETUP_VAR_STACK_REMEMBERED(1);
00376   VAR_STACK_PUSH(0, p);
00377 
00378   
00379 
00380   
00381   WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->AppendSeparator());
00382 
00383   
00384   
00385   READY_TO_RETURN;
00386   return scheme_void;
00387 }
00388 
00389 static Scheme_Object *os_wxMenuDeleteByPosition(int n,  Scheme_Object *p[])
00390 {
00391   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00392   REMEMBER_VAR_STACK();
00393   Bool r;
00394   objscheme_check_valid(os_wxMenu_class, "delete-by-position in menu%", n, p);
00395   int x0;
00396 
00397   SETUP_VAR_STACK_REMEMBERED(1);
00398   VAR_STACK_PUSH(0, p);
00399 
00400   
00401   x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "delete-by-position in menu%"));
00402 
00403   
00404   r = WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->DeleteByPosition(x0));
00405 
00406   
00407   
00408   READY_TO_RETURN;
00409   return (r ? scheme_true : scheme_false);
00410 }
00411 
00412 static Scheme_Object *os_wxMenuDelete(int n,  Scheme_Object *p[])
00413 {
00414   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00415   REMEMBER_VAR_STACK();
00416   Bool r;
00417   objscheme_check_valid(os_wxMenu_class, "delete in menu%", n, p);
00418   ExactLong x0;
00419 
00420   SETUP_VAR_STACK_REMEMBERED(1);
00421   VAR_STACK_PUSH(0, p);
00422 
00423   
00424   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "delete in menu%"));
00425 
00426   
00427   r = WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Delete(x0));
00428 
00429   
00430   
00431   READY_TO_RETURN;
00432   return (r ? scheme_true : scheme_false);
00433 }
00434 
00435 static Scheme_Object *os_wxMenuAppend(int n,  Scheme_Object *p[])
00436 {
00437   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00438   SETUP_PRE_VAR_STACK(1);
00439   PRE_VAR_STACK_PUSH(0, p);
00440   REMEMBER_VAR_STACK();
00441   objscheme_check_valid(os_wxMenu_class, "append in menu%", n, p);
00442   if ((n >= (POFFSET+3)) && WITH_REMEMBERED_STACK(objscheme_istype_ExactLong(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[POFFSET+1], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_wxMenu(p[POFFSET+2], NULL, 0))) {
00443     ExactLong x0;
00444     string x1 INIT_NULLED_OUT;
00445     class wxMenu* x2 INIT_NULLED_OUT;
00446     nstring x3 INIT_NULLED_OUT;
00447 
00448     SETUP_VAR_STACK_PRE_REMEMBERED(4);
00449     VAR_STACK_PUSH(0, p);
00450     VAR_STACK_PUSH(1, x1);
00451     VAR_STACK_PUSH(2, x2);
00452     VAR_STACK_PUSH(3, x3);
00453 
00454     
00455     if ((n < (POFFSET+3)) || (n > (POFFSET+4))) 
00456       WITH_VAR_STACK(scheme_wrong_count_m("append in menu% (submenu case)", POFFSET+3, POFFSET+4, n, p, 1));
00457     x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "append in menu% (submenu case)"));
00458     x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "append in menu% (submenu case)"));
00459     x2 = WITH_VAR_STACK(objscheme_unbundle_wxMenu(p[POFFSET+2], "append in menu% (submenu case)", 0));
00460     if (n > (POFFSET+3)) {
00461       x3 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[POFFSET+3], "append in menu% (submenu case)"));
00462     } else
00463       x3 = NULL;
00464 
00465     
00466     WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Append(x0, x1, x2, x3));
00467 
00468     
00469     
00470     READY_TO_PRE_RETURN;
00471   } else  {
00472     ExactLong x0;
00473     string x1 INIT_NULLED_OUT;
00474     nstring x2 INIT_NULLED_OUT;
00475     Bool x3;
00476 
00477     SETUP_VAR_STACK_PRE_REMEMBERED(3);
00478     VAR_STACK_PUSH(0, p);
00479     VAR_STACK_PUSH(1, x1);
00480     VAR_STACK_PUSH(2, x2);
00481 
00482     
00483     if ((n < (POFFSET+2)) || (n > (POFFSET+4))) 
00484       WITH_VAR_STACK(scheme_wrong_count_m("append in menu% (string item case)", POFFSET+2, POFFSET+4, n, p, 1));
00485     x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "append in menu% (string item case)"));
00486     x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "append in menu% (string item case)"));
00487     if (n > (POFFSET+2)) {
00488       x2 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[POFFSET+2], "append in menu% (string item case)"));
00489     } else
00490       x2 = NULL;
00491     if (n > (POFFSET+3)) {
00492       x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "append in menu% (string item case)"));
00493     } else
00494       x3 = FALSE;
00495 
00496     
00497     WITH_VAR_STACK(((wxMenu *)((Scheme_Class_Object *)p[0])->primdata)->Append(x0, x1, x2, x3));
00498 
00499     
00500     
00501     READY_TO_PRE_RETURN;
00502   }
00503 
00504   return scheme_void;
00505 }
00506 
00507 static Scheme_Object *os_wxMenu_ConstructScheme(int n,  Scheme_Object *p[])
00508 {
00509   SETUP_PRE_VAR_STACK(1);
00510   PRE_VAR_STACK_PUSH(0, p);
00511   os_wxMenu *realobj INIT_NULLED_OUT;
00512   REMEMBER_VAR_STACK();
00513   nstring x0 INIT_NULLED_OUT;
00514   wxFunction x1;
00515   class wxFont* x2 INIT_NULLED_OUT;
00516 
00517   SETUP_VAR_STACK_PRE_REMEMBERED(4);
00518   VAR_STACK_PUSH(0, p);
00519   VAR_STACK_PUSH(1, realobj);
00520   VAR_STACK_PUSH(2, x0);
00521   VAR_STACK_PUSH(3, x2);
00522 
00523   int cb_pos = 0;
00524   if ((n > (POFFSET+3))) 
00525     WITH_VAR_STACK(scheme_wrong_count_m("initialization in menu%", POFFSET+POFFSET, POFFSET+3, n, p, 1));
00526   if (n > (POFFSET+0)) {
00527     x0 = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[POFFSET+0], "initialization in menu%"));
00528   } else
00529     x0 = NULL;
00530   if (n > (POFFSET+1)) {
00531     x1 = (SCHEME_NULLP(p[POFFSET+1]) ? NULL : (WITH_REMEMBERED_STACK(objscheme_istype_proc2(p[POFFSET+1], CB_USER)), cb_pos = 1, (CB_FUNCTYPE)CB_TOSCHEME));
00532   } else
00533     x1 = NULL;
00534   if (n > (POFFSET+2)) {
00535     x2 = WITH_VAR_STACK(objscheme_unbundle_wxFont(p[POFFSET+2], "initialization in menu%", 1));
00536   } else
00537     x2 = NULL;
00538 
00539   
00540   realobj = WITH_VAR_STACK(new os_wxMenu CONSTRUCTOR_ARGS((x0, x1, x2)));
00541 #ifdef MZ_PRECISE_GC
00542   WITH_VAR_STACK(realobj->gcInit_wxMenu(x0, x1, x2));
00543 #endif
00544   realobj->__gc_external = (void *)p[0];
00545   
00546   realobj->callback_closure = p[POFFSET+cb_pos];
00547   READY_TO_RETURN;
00548   ((Scheme_Class_Object *)p[0])->primdata = realobj;
00549   ((Scheme_Class_Object *)p[0])->primflag = 1;
00550   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
00551   return scheme_void;
00552 }
00553 
00554 void objscheme_setup_wxMenu(Scheme_Env *env)
00555 {
00556   SETUP_VAR_STACK(1);
00557   VAR_STACK_PUSH(0, env);
00558 
00559   wxREGGLOB(os_wxMenu_class);
00560 
00561   os_wxMenu_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "menu%", "object%", (Scheme_Method_Prim *)os_wxMenu_ConstructScheme, 14));
00562 
00563   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "select" " method", (Scheme_Method_Prim *)os_wxMenumenuSelect, 1, 1));
00564   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "get-font" " method", (Scheme_Method_Prim *)os_wxMenuGetFont, 0, 0));
00565   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "set-width" " method", (Scheme_Method_Prim *)os_wxMenuSetWidth, 1, 1));
00566   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "set-title" " method", (Scheme_Method_Prim *)os_wxMenuSetTitle, 1, 1));
00567   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "set-label" " method", (Scheme_Method_Prim *)os_wxMenuSetLabel, 2, 2));
00568   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "set-help-string" " method", (Scheme_Method_Prim *)os_wxMenuSetHelpString, 2, 2));
00569   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "number" " method", (Scheme_Method_Prim *)os_wxMenuNumber, 0, 0));
00570   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "enable" " method", (Scheme_Method_Prim *)os_wxMenuEnable, 2, 2));
00571   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "check" " method", (Scheme_Method_Prim *)os_wxMenuCheck, 2, 2));
00572   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "checked?" " method", (Scheme_Method_Prim *)os_wxMenuChecked, 1, 1));
00573   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "append-separator" " method", (Scheme_Method_Prim *)os_wxMenuAppendSeparator, 0, 0));
00574   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "delete-by-position" " method", (Scheme_Method_Prim *)os_wxMenuDeleteByPosition, 1, 1));
00575   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "delete" " method", (Scheme_Method_Prim *)os_wxMenuDelete, 1, 1));
00576   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenu_class, "append" " method", (Scheme_Method_Prim *)os_wxMenuAppend, 2, 4));
00577 
00578 
00579   WITH_VAR_STACK(scheme_made_class(os_wxMenu_class));
00580 
00581 
00582   READY_TO_RETURN;
00583 }
00584 
00585 int objscheme_istype_wxMenu(Scheme_Object *obj, const char *stop, int nullOK)
00586 {
00587   REMEMBER_VAR_STACK();
00588   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
00589   if (objscheme_is_a(obj,  os_wxMenu_class))
00590     return 1;
00591   else {
00592     if (!stop)
00593        return 0;
00594     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "menu% object or " XC_NULL_STR: "menu% object", -1, 0, &obj));
00595     return 0;
00596   }
00597 }
00598 
00599 Scheme_Object *objscheme_bundle_wxMenu(class wxMenu *realobj)
00600 {
00601   Scheme_Class_Object *obj INIT_NULLED_OUT;
00602   Scheme_Object *sobj INIT_NULLED_OUT;
00603 
00604   if (!realobj) return XC_SCHEME_NULL;
00605 
00606   if (realobj->__gc_external)
00607     return (Scheme_Object *)realobj->__gc_external;
00608 
00609   SETUP_VAR_STACK(2);
00610   VAR_STACK_PUSH(0, obj);
00611   VAR_STACK_PUSH(1, realobj);
00612 
00613   if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
00614     { READY_TO_RETURN; return sobj; }
00615   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMenu_class));
00616 
00617   obj->primdata = realobj;
00618   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
00619   obj->primflag = 0;
00620 
00621   realobj->__gc_external = (void *)obj;
00622   READY_TO_RETURN;
00623   return (Scheme_Object *)obj;
00624 }
00625 
00626 class wxMenu *objscheme_unbundle_wxMenu(Scheme_Object *obj, const char *where, int nullOK)
00627 {
00628   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
00629 
00630   REMEMBER_VAR_STACK();
00631 
00632   (void)objscheme_istype_wxMenu(obj, where, nullOK);
00633   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
00634   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
00635   if (o->primflag)
00636     return (os_wxMenu *)o->primdata;
00637   else
00638     return (wxMenu *)o->primdata;
00639 }
00640 
00641 
00642 
00643 static void CB_TOSCHEME(CB_REALCLASS *realobj, wxCommandEvent *event)
00644 {
00645   Scheme_Object *p[2];
00646   Scheme_Class_Object *obj;
00647   mz_jmp_buf savebuf;
00648   Scheme_Thread *thread;
00649   SETUP_VAR_STACK(4);
00650   VAR_STACK_PUSH(0, obj);
00651   VAR_STACK_PUSH(1, event);
00652   VAR_STACK_PUSH(2, p[0]);
00653   VAR_STACK_PUSH(3, p[1]);
00654 
00655   p[0] = NULL;
00656   p[1] = NULL;
00657 
00658   obj = (Scheme_Class_Object *)realobj->__gc_external;
00659 
00660   if (!obj) {
00661     // scheme_signal_error("bad callback object");
00662     return;
00663   }
00664 
00665   p[0] = (Scheme_Object *)obj;
00666   p[1] = WITH_VAR_STACK(objscheme_bundle_wxCommandEvent(event));
00667 
00668   thread = scheme_get_current_thread();
00669   COPY_JMPBUF(savebuf, *(thread->error_buf));
00670 
00671   if (!scheme_setjmp(*(thread->error_buf)))
00672     WITH_VAR_STACK(scheme_apply_multi(((CALLBACKCLASS *)obj->primdata)->callback_closure, 2, p));
00673 
00674   thread = scheme_get_current_thread();
00675   COPY_JMPBUF(*(thread->error_buf), savebuf);
00676 
00677   READY_TO_RETURN;
00678 }
00679 
00680 // wxMenuBar is really derived from wxItem
00681 //  but that makes no sense. Enforce different hierarchy here
00682 
00683 
00684 
00685 
00686 
00687 class os_wxMenuBar : public wxMenuBar {
00688  public:
00689 
00690   os_wxMenuBar CONSTRUCTOR_ARGS(());
00691   ~os_wxMenuBar();
00692 #ifdef MZ_PRECISE_GC
00693   void gcMark();
00694   void gcFixup();
00695 #endif
00696 };
00697 
00698 #ifdef MZ_PRECISE_GC
00699 void os_wxMenuBar::gcMark() {
00700   wxMenuBar::gcMark();
00701 }
00702 void os_wxMenuBar::gcFixup() {
00703   wxMenuBar::gcFixup();
00704 }
00705 #endif
00706 
00707 static Scheme_Object *os_wxMenuBar_class;
00708 
00709 os_wxMenuBar::os_wxMenuBar CONSTRUCTOR_ARGS(())
00710 CONSTRUCTOR_INIT(: wxMenuBar())
00711 {
00712 }
00713 
00714 os_wxMenuBar::~os_wxMenuBar()
00715 {
00716     objscheme_destroy(this, (Scheme_Object *) __gc_external);
00717 }
00718 
00719 static Scheme_Object *os_wxMenuBarSetLabelTop(int n,  Scheme_Object *p[])
00720 {
00721   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00722   REMEMBER_VAR_STACK();
00723   objscheme_check_valid(os_wxMenuBar_class, "set-label-top in menu-bar%", n, p);
00724   int x0;
00725   string x1 INIT_NULLED_OUT;
00726 
00727   SETUP_VAR_STACK_REMEMBERED(2);
00728   VAR_STACK_PUSH(0, p);
00729   VAR_STACK_PUSH(1, x1);
00730 
00731   
00732   x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "set-label-top in menu-bar%"));
00733   x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "set-label-top in menu-bar%"));
00734 
00735   if (x0 < 0) { READY_TO_RETURN; return scheme_void; }
00736   WITH_VAR_STACK(((wxMenuBar *)((Scheme_Class_Object *)p[0])->primdata)->SetLabelTop(x0, x1));
00737 
00738   
00739   
00740   READY_TO_RETURN;
00741   return scheme_void;
00742 }
00743 
00744 static Scheme_Object *os_wxMenuBarNumber(int n,  Scheme_Object *p[])
00745 {
00746   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00747   REMEMBER_VAR_STACK();
00748   int r;
00749   objscheme_check_valid(os_wxMenuBar_class, "number in menu-bar%", n, p);
00750 
00751   SETUP_VAR_STACK_REMEMBERED(1);
00752   VAR_STACK_PUSH(0, p);
00753 
00754   
00755 
00756   
00757   r = WITH_VAR_STACK(((wxMenuBar *)((Scheme_Class_Object *)p[0])->primdata)->Number());
00758 
00759   
00760   
00761   READY_TO_RETURN;
00762   return scheme_make_integer(r);
00763 }
00764 
00765 static Scheme_Object *os_wxMenuBarEnableTop(int n,  Scheme_Object *p[])
00766 {
00767   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00768   REMEMBER_VAR_STACK();
00769   objscheme_check_valid(os_wxMenuBar_class, "enable-top in menu-bar%", n, p);
00770   int x0;
00771   Bool x1;
00772 
00773   SETUP_VAR_STACK_REMEMBERED(1);
00774   VAR_STACK_PUSH(0, p);
00775 
00776   
00777   x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "enable-top in menu-bar%"));
00778   x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "enable-top in menu-bar%"));
00779 
00780   if (x0 < 0) { READY_TO_RETURN; return scheme_void; }
00781   WITH_VAR_STACK(((wxMenuBar *)((Scheme_Class_Object *)p[0])->primdata)->EnableTop(x0, x1));
00782 
00783   
00784   
00785   READY_TO_RETURN;
00786   return scheme_void;
00787 }
00788 
00789 static Scheme_Object *os_wxMenuBarDelete(int n,  Scheme_Object *p[])
00790 {
00791   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00792   REMEMBER_VAR_STACK();
00793   Bool r;
00794   objscheme_check_valid(os_wxMenuBar_class, "delete in menu-bar%", n, p);
00795   class wxMenu* x0 INIT_NULLED_OUT;
00796   int x1;
00797 
00798   SETUP_VAR_STACK_REMEMBERED(2);
00799   VAR_STACK_PUSH(0, p);
00800   VAR_STACK_PUSH(1, x0);
00801 
00802   
00803   x0 = WITH_VAR_STACK(objscheme_unbundle_wxMenu(p[POFFSET+0], "delete in menu-bar%", 1));
00804   if (n > (POFFSET+1)) {
00805     x1 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+1], "delete in menu-bar%"));
00806   } else
00807     x1 = 0;
00808 
00809   
00810   r = WITH_VAR_STACK(((wxMenuBar *)((Scheme_Class_Object *)p[0])->primdata)->Delete(x0, x1));
00811 
00812   
00813   
00814   READY_TO_RETURN;
00815   return (r ? scheme_true : scheme_false);
00816 }
00817 
00818 static Scheme_Object *os_wxMenuBarAppend(int n,  Scheme_Object *p[])
00819 {
00820   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00821   REMEMBER_VAR_STACK();
00822   objscheme_check_valid(os_wxMenuBar_class, "append in menu-bar%", n, p);
00823   class wxMenu* x0 INIT_NULLED_OUT;
00824   string x1 INIT_NULLED_OUT;
00825 
00826   SETUP_VAR_STACK_REMEMBERED(3);
00827   VAR_STACK_PUSH(0, p);
00828   VAR_STACK_PUSH(1, x0);
00829   VAR_STACK_PUSH(2, x1);
00830 
00831   
00832   x0 = WITH_VAR_STACK(objscheme_unbundle_wxMenu(p[POFFSET+0], "append in menu-bar%", 0));
00833   x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "append in menu-bar%"));
00834 
00835   
00836   WITH_VAR_STACK(((wxMenuBar *)((Scheme_Class_Object *)p[0])->primdata)->Append(x0, x1));
00837 
00838   
00839   
00840   READY_TO_RETURN;
00841   return scheme_void;
00842 }
00843 
00844 static Scheme_Object *os_wxMenuBar_ConstructScheme(int n,  Scheme_Object *p[])
00845 {
00846   SETUP_PRE_VAR_STACK(1);
00847   PRE_VAR_STACK_PUSH(0, p);
00848   os_wxMenuBar *realobj INIT_NULLED_OUT;
00849   REMEMBER_VAR_STACK();
00850 
00851   SETUP_VAR_STACK_PRE_REMEMBERED(2);
00852   VAR_STACK_PUSH(0, p);
00853   VAR_STACK_PUSH(1, realobj);
00854 
00855   
00856   if (n != (POFFSET+0)) 
00857     WITH_VAR_STACK(scheme_wrong_count_m("initialization in menu-bar%", POFFSET+0, POFFSET+0, n, p, 1));
00858 
00859   
00860   realobj = WITH_VAR_STACK(new os_wxMenuBar CONSTRUCTOR_ARGS(()));
00861 #ifdef MZ_PRECISE_GC
00862   WITH_VAR_STACK(realobj->gcInit_wxMenuBar());
00863 #endif
00864   realobj->__gc_external = (void *)p[0];
00865   
00866   
00867   READY_TO_RETURN;
00868   ((Scheme_Class_Object *)p[0])->primdata = realobj;
00869   ((Scheme_Class_Object *)p[0])->primflag = 1;
00870   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
00871   return scheme_void;
00872 }
00873 
00874 void objscheme_setup_wxMenuBar(Scheme_Env *env)
00875 {
00876   SETUP_VAR_STACK(1);
00877   VAR_STACK_PUSH(0, env);
00878 
00879   wxREGGLOB(os_wxMenuBar_class);
00880 
00881   os_wxMenuBar_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "menu-bar%", "object%", (Scheme_Method_Prim *)os_wxMenuBar_ConstructScheme, 5));
00882 
00883   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenuBar_class, "set-label-top" " method", (Scheme_Method_Prim *)os_wxMenuBarSetLabelTop, 2, 2));
00884   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenuBar_class, "number" " method", (Scheme_Method_Prim *)os_wxMenuBarNumber, 0, 0));
00885   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenuBar_class, "enable-top" " method", (Scheme_Method_Prim *)os_wxMenuBarEnableTop, 2, 2));
00886   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenuBar_class, "delete" " method", (Scheme_Method_Prim *)os_wxMenuBarDelete, 1, 2));
00887   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMenuBar_class, "append" " method", (Scheme_Method_Prim *)os_wxMenuBarAppend, 2, 2));
00888 
00889 
00890   WITH_VAR_STACK(scheme_made_class(os_wxMenuBar_class));
00891 
00892 
00893   READY_TO_RETURN;
00894 }
00895 
00896 int objscheme_istype_wxMenuBar(Scheme_Object *obj, const char *stop, int nullOK)
00897 {
00898   REMEMBER_VAR_STACK();
00899   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
00900   if (objscheme_is_a(obj,  os_wxMenuBar_class))
00901     return 1;
00902   else {
00903     if (!stop)
00904        return 0;
00905     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "menu-bar% object or " XC_NULL_STR: "menu-bar% object", -1, 0, &obj));
00906     return 0;
00907   }
00908 }
00909 
00910 Scheme_Object *objscheme_bundle_wxMenuBar(class wxMenuBar *realobj)
00911 {
00912   Scheme_Class_Object *obj INIT_NULLED_OUT;
00913   Scheme_Object *sobj INIT_NULLED_OUT;
00914 
00915   if (!realobj) return XC_SCHEME_NULL;
00916 
00917   if (realobj->__gc_external)
00918     return (Scheme_Object *)realobj->__gc_external;
00919 
00920   SETUP_VAR_STACK(2);
00921   VAR_STACK_PUSH(0, obj);
00922   VAR_STACK_PUSH(1, realobj);
00923 
00924   if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
00925     { READY_TO_RETURN; return sobj; }
00926   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMenuBar_class));
00927 
00928   obj->primdata = realobj;
00929   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
00930   obj->primflag = 0;
00931 
00932   realobj->__gc_external = (void *)obj;
00933   READY_TO_RETURN;
00934   return (Scheme_Object *)obj;
00935 }
00936 
00937 class wxMenuBar *objscheme_unbundle_wxMenuBar(Scheme_Object *obj, const char *where, int nullOK)
00938 {
00939   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
00940 
00941   REMEMBER_VAR_STACK();
00942 
00943   (void)objscheme_istype_wxMenuBar(obj, where, nullOK);
00944   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
00945   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
00946   if (o->primflag)
00947     return (os_wxMenuBar *)o->primdata;
00948   else
00949     return (wxMenuBar *)o->primdata;
00950 }
00951 
00952 
00953 #ifdef MZ_PRECISE_GC
00954 END_XFORM_SKIP;
00955 #endif
00956 
00957 class wxsMenuItem : public wxObject
00958 {
00959 #ifdef MZ_PRECISE_GC
00960   void *my_id;
00961 #endif
00962 public:
00963   wxsMenuItem(void);
00964   ~wxsMenuItem();
00965 
00966   ExactLong Id(void) {
00967 #ifdef MZ_PRECISE_GC
00968     return (ExactLong)my_id;
00969 #else
00970     return (ExactLong)this;
00971 #endif
00972   }
00973 };
00974 
00975 wxsMenuItem::wxsMenuItem(void)
00976 #ifndef MZ_PRECISE_GC
00977 : wxObject(WXGC_NO_CLEANUP)
00978 #endif
00979 {
00980 #ifdef MZ_PRECISE_GC
00981   void *mid;
00982   mid = GC_malloc_immobile_box(GC_malloc_weak_box(gcOBJ_TO_PTR(this), NULL, 0));
00983   my_id = mid;
00984 #endif
00985 }
00986 
00987 wxsMenuItem::~wxsMenuItem()
00988 {
00989 #ifdef MZ_PRECISE_GC
00990   GC_free_immobile_box((void **)my_id);
00991 #endif
00992 }
00993 
00994 #ifdef MZ_PRECISE_GC
00995 START_XFORM_SKIP;
00996 #endif
00997 
00998 wxsMenuItem* wxsIdToMenuItem(ExactLong id)
00999 {
01000 #ifdef MZ_PRECISE_GC
01001   if (!id)
01002     return NULL;
01003   else
01004     return (wxsMenuItem *)gcPTR_TO_OBJ(GC_weak_box_val(*(void **)id));
01005 #else
01006   return (wxsMenuItem *)id;
01007 #endif
01008 }
01009 
01010 
01011 
01012 
01013 class os_wxsMenuItem : public wxsMenuItem {
01014  public:
01015 
01016   os_wxsMenuItem CONSTRUCTOR_ARGS(());
01017   ~os_wxsMenuItem();
01018 #ifdef MZ_PRECISE_GC
01019   void gcMark();
01020   void gcFixup();
01021 #endif
01022 };
01023 
01024 #ifdef MZ_PRECISE_GC
01025 void os_wxsMenuItem::gcMark() {
01026   wxsMenuItem::gcMark();
01027 }
01028 void os_wxsMenuItem::gcFixup() {
01029   wxsMenuItem::gcFixup();
01030 }
01031 #endif
01032 
01033 static Scheme_Object *os_wxsMenuItem_class;
01034 
01035 os_wxsMenuItem::os_wxsMenuItem CONSTRUCTOR_ARGS(())
01036 CONSTRUCTOR_INIT(: wxsMenuItem())
01037 {
01038 }
01039 
01040 os_wxsMenuItem::~os_wxsMenuItem()
01041 {
01042     objscheme_destroy(this, (Scheme_Object *) __gc_external);
01043 }
01044 
01045 static Scheme_Object *os_wxsMenuItemId(int n,  Scheme_Object *p[])
01046 {
01047   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01048   REMEMBER_VAR_STACK();
01049   ExactLong r;
01050   objscheme_check_valid(os_wxsMenuItem_class, "id in menu-item%", n, p);
01051 
01052   SETUP_VAR_STACK_REMEMBERED(1);
01053   VAR_STACK_PUSH(0, p);
01054 
01055   
01056 
01057   
01058   r = WITH_VAR_STACK(((wxsMenuItem *)((Scheme_Class_Object *)p[0])->primdata)->Id());
01059 
01060   
01061   
01062   READY_TO_RETURN;
01063   return WITH_REMEMBERED_STACK(scheme_make_integer_value(r));
01064 }
01065 
01066 static Scheme_Object *os_wxsMenuItem_ConstructScheme(int n,  Scheme_Object *p[])
01067 {
01068   SETUP_PRE_VAR_STACK(1);
01069   PRE_VAR_STACK_PUSH(0, p);
01070   os_wxsMenuItem *realobj INIT_NULLED_OUT;
01071   REMEMBER_VAR_STACK();
01072 
01073   SETUP_VAR_STACK_PRE_REMEMBERED(2);
01074   VAR_STACK_PUSH(0, p);
01075   VAR_STACK_PUSH(1, realobj);
01076 
01077   
01078   if (n != (POFFSET+0)) 
01079     WITH_VAR_STACK(scheme_wrong_count_m("initialization in menu-item%", POFFSET+0, POFFSET+0, n, p, 1));
01080 
01081   
01082   realobj = WITH_VAR_STACK(new os_wxsMenuItem CONSTRUCTOR_ARGS(()));
01083 #ifdef MZ_PRECISE_GC
01084   WITH_VAR_STACK(realobj->gcInit_wxsMenuItem());
01085 #endif
01086   realobj->__gc_external = (void *)p[0];
01087   
01088   
01089   READY_TO_RETURN;
01090   ((Scheme_Class_Object *)p[0])->primdata = realobj;
01091   ((Scheme_Class_Object *)p[0])->primflag = 1;
01092   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
01093   return scheme_void;
01094 }
01095 
01096 void objscheme_setup_wxsMenuItem(Scheme_Env *env)
01097 {
01098   SETUP_VAR_STACK(1);
01099   VAR_STACK_PUSH(0, env);
01100 
01101   wxREGGLOB(os_wxsMenuItem_class);
01102 
01103   os_wxsMenuItem_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "menu-item%", "object%", (Scheme_Method_Prim *)os_wxsMenuItem_ConstructScheme, 1));
01104 
01105   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxsMenuItem_class, "id" " method", (Scheme_Method_Prim *)os_wxsMenuItemId, 0, 0));
01106 
01107 
01108   WITH_VAR_STACK(scheme_made_class(os_wxsMenuItem_class));
01109 
01110 
01111   READY_TO_RETURN;
01112 }
01113 
01114 int objscheme_istype_wxsMenuItem(Scheme_Object *obj, const char *stop, int nullOK)
01115 {
01116   REMEMBER_VAR_STACK();
01117   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
01118   if (objscheme_is_a(obj,  os_wxsMenuItem_class))
01119     return 1;
01120   else {
01121     if (!stop)
01122        return 0;
01123     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "menu-item% object or " XC_NULL_STR: "menu-item% object", -1, 0, &obj));
01124     return 0;
01125   }
01126 }
01127 
01128 Scheme_Object *objscheme_bundle_wxsMenuItem(class wxsMenuItem *realobj)
01129 {
01130   Scheme_Class_Object *obj INIT_NULLED_OUT;
01131   Scheme_Object *sobj INIT_NULLED_OUT;
01132 
01133   if (!realobj) return XC_SCHEME_NULL;
01134 
01135   if (realobj->__gc_external)
01136     return (Scheme_Object *)realobj->__gc_external;
01137 
01138   SETUP_VAR_STACK(2);
01139   VAR_STACK_PUSH(0, obj);
01140   VAR_STACK_PUSH(1, realobj);
01141 
01142   if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
01143     { READY_TO_RETURN; return sobj; }
01144   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxsMenuItem_class));
01145 
01146   obj->primdata = realobj;
01147   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
01148   obj->primflag = 0;
01149 
01150   realobj->__gc_external = (void *)obj;
01151   READY_TO_RETURN;
01152   return (Scheme_Object *)obj;
01153 }
01154 
01155 class wxsMenuItem *objscheme_unbundle_wxsMenuItem(Scheme_Object *obj, const char *where, int nullOK)
01156 {
01157   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
01158 
01159   REMEMBER_VAR_STACK();
01160 
01161   (void)objscheme_istype_wxsMenuItem(obj, where, nullOK);
01162   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
01163   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
01164   if (o->primflag)
01165     return (os_wxsMenuItem *)o->primdata;
01166   else
01167     return (wxsMenuItem *)o->primdata;
01168 }
01169 
01170 
01171 
01172 
01173 
01174 static Scheme_Object *wxsMenuItemGlobalwxsIdToMenuItem(int n,  Scheme_Object *p[])
01175 {
01176   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01177   REMEMBER_VAR_STACK();
01178   class wxsMenuItem* r;
01179   ExactLong x0;
01180 
01181   SETUP_VAR_STACK_REMEMBERED(1);
01182   VAR_STACK_PUSH(0, p);
01183 
01184   
01185   x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[0+0], "id-to-menu-item in menu-item%"));
01186 
01187   
01188   r = WITH_VAR_STACK(wxsIdToMenuItem(x0));
01189 
01190   
01191   
01192   READY_TO_RETURN;
01193   return WITH_REMEMBERED_STACK(objscheme_bundle_wxsMenuItem(r));
01194 }
01195 
01196 void objscheme_setup_wxsMenuItemGlobal(Scheme_Env *env)
01197 {
01198   Scheme_Object *functmp INIT_NULLED_OUT;
01199   SETUP_VAR_STACK(1);
01200   VAR_STACK_PUSH(0, env);
01201   functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxsMenuItemGlobalwxsIdToMenuItem, "id-to-menu-item", 1, 1));
01202   WITH_VAR_STACK(scheme_install_xc_global("id-to-menu-item", functmp, env));
01203   READY_TO_RETURN;
01204 }
01205