Back to index

plt-scheme  4.2.1
wxs_butn.cxx
Go to the documentation of this file.
00001 /* DO NOT EDIT THIS FILE. */
00002 /* This file was generated by xctocc from "wxs_butn.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_buttn.h"
00013 
00014 
00015 
00016 
00017 #ifdef wx_x
00018 # define BM_SELECTED(map) ((map)->selectedTo)
00019 #endif
00020 #if defined(wx_mac) || defined(wx_msw)
00021 # define BM_SELECTED(map) ((map)->selectedInto)
00022 #endif
00023 # define BM_IN_USE(map) ((map)->selectedIntoDC)
00024 
00025 
00026 
00027 
00028 #define ESCAPE_NO_RET_VAL /*empty*/
00029 
00030 
00031 #include "wxscheme.h"
00032 #include "wxs_butn.h"
00033 
00034 #ifdef MZ_PRECISE_GC
00035 START_XFORM_SKIP;
00036 #endif
00037 
00038 static Scheme_Object *buttonStyle_1_sym = NULL;
00039 static Scheme_Object *buttonStyle_wxINVISIBLE_sym = NULL;
00040 
00041 static void init_symset_buttonStyle(void) {
00042   REMEMBER_VAR_STACK();
00043   wxREGGLOB(buttonStyle_1_sym);
00044   buttonStyle_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("border"));
00045   wxREGGLOB(buttonStyle_wxINVISIBLE_sym);
00046   buttonStyle_wxINVISIBLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("deleted"));
00047 }
00048 
00049 static int unbundle_symset_buttonStyle(Scheme_Object *v, const char *where) {
00050   SETUP_VAR_STACK(1);
00051   VAR_STACK_PUSH(0, v);
00052   if (!buttonStyle_wxINVISIBLE_sym) WITH_VAR_STACK(init_symset_buttonStyle());
00053   Scheme_Object *i INIT_NULLED_OUT, *l = v;
00054   long result = 0;
00055   while (SCHEME_PAIRP(l)) {
00056   i = SCHEME_CAR(l);
00057   if (0) { }
00058   else if (i == buttonStyle_1_sym) { result = result | 1; }
00059   else if (i == buttonStyle_wxINVISIBLE_sym) { result = result | wxINVISIBLE; }
00060   else { break; } 
00061   l = SCHEME_CDR(l);
00062   }
00063   if (SCHEME_NULLP(l)) { READY_TO_RETURN; return result; }
00064   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "buttonStyle symbol list", -1, 0, &v));
00065   READY_TO_RETURN;
00066   return 0;
00067 }
00068 
00069 
00070 void ButtonSetBorder(wxButton *b, Bool on)
00071 {
00072 #ifdef wx_mac
00073 #else
00074   b->SetBorder(on);
00075 #endif
00076 }
00077 
00078 
00079 
00080 
00081 #define CB_FUNCTYPE wxFunction 
00082 
00083 
00084 #undef CALLBACKCLASS
00085 #undef CB_REALCLASS
00086 #undef CB_UNBUNDLE
00087 #undef CB_USER
00088 
00089 #define CALLBACKCLASS os_wxButton
00090 #define CB_REALCLASS wxButton
00091 #define CB_UNBUNDLE objscheme_unbundle_wxButton
00092 #define CB_USER METHODNAME("button%","initialization")
00093 
00094 #undef CB_TOSCHEME
00095 #undef CB_TOC
00096 #define CB_TOSCHEME wxButtonCallbackToScheme
00097 #define CB_TOC wxButtonCallbackToC
00098 
00099 
00100 class CALLBACKCLASS;
00101 
00102 
00103 
00104 
00105 
00106 extern wxCommandEvent *objscheme_unbundle_wxCommandEvent(Scheme_Object *,const char *,int);
00107 extern Scheme_Object *objscheme_bundle_wxCommandEvent(wxCommandEvent *);
00108 
00109 static void CB_TOSCHEME(CB_REALCLASS *obj, wxCommandEvent *event);
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 class os_wxButton : public wxButton {
00122  public:
00123   Scheme_Object *callback_closure;
00124 
00125   os_wxButton CONSTRUCTOR_ARGS((class wxPanel* x0, wxFunction x1, string x2, int x3 = -1, int x4 = -1, int x5 = -1, int x6 = -1, int x7 = 0, class wxFont* x8 = NULL, string x9 = "button"));
00126 #ifndef MZ_PRECISE_GC
00127   os_wxButton CONSTRUCTOR_ARGS((class wxPanel* x0, wxFunction x1, class wxBitmap* x2, int x3 = -1, int x4 = -1, int x5 = -1, int x6 = -1, int x7 = 0, class wxFont* x8 = NULL, string x9 = "button"));
00128 #endif
00129   ~os_wxButton();
00130   void OnDropFile(epathname x0);
00131   Bool PreOnEvent(class wxWindow* x0, class wxMouseEvent* x1);
00132   Bool PreOnChar(class wxWindow* x0, class wxKeyEvent* x1);
00133   void OnSize(int x0, int x1);
00134   void OnSetFocus();
00135   void OnKillFocus();
00136 #ifdef MZ_PRECISE_GC
00137   void gcMark();
00138   void gcFixup();
00139 #endif
00140 };
00141 
00142 #ifdef MZ_PRECISE_GC
00143 void os_wxButton::gcMark() {
00144   wxButton::gcMark();
00145   gcMARK_TYPED(Scheme_Object *, callback_closure);
00146 }
00147 void os_wxButton::gcFixup() {
00148   wxButton::gcFixup();
00149   gcFIXUP_TYPED(Scheme_Object *, callback_closure);
00150 }
00151 #endif
00152 
00153 static Scheme_Object *os_wxButton_class;
00154 
00155 os_wxButton::os_wxButton CONSTRUCTOR_ARGS((class wxPanel* x0, wxFunction x1, string x2, int x3, int x4, int x5, int x6, int x7, class wxFont* x8, string x9))
00156 CONSTRUCTOR_INIT(: wxButton(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9))
00157 {
00158 }
00159 
00160 #ifndef MZ_PRECISE_GC
00161 os_wxButton::os_wxButton CONSTRUCTOR_ARGS((class wxPanel* x0, wxFunction x1, class wxBitmap* x2, int x3, int x4, int x5, int x6, int x7, class wxFont* x8, string x9))
00162 CONSTRUCTOR_INIT(: wxButton(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9))
00163 {
00164 }
00165 #endif
00166 
00167 os_wxButton::~os_wxButton()
00168 {
00169     objscheme_destroy(this, (Scheme_Object *) __gc_external);
00170 }
00171 
00172 static Scheme_Object *os_wxButtonOnDropFile(int n, Scheme_Object *p[]);
00173 
00174 void os_wxButton::OnDropFile(epathname x0)
00175 {
00176   Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT });
00177   Scheme_Object *v;
00178   Scheme_Object *method INIT_NULLED_OUT;
00179 #ifdef MZ_PRECISE_GC
00180   os_wxButton *sElF = this;
00181 #endif
00182   static void *mcache = 0;
00183 
00184   SETUP_VAR_STACK(6);
00185   VAR_STACK_PUSH(0, method);
00186   VAR_STACK_PUSH(1, sElF);
00187   VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1);
00188   VAR_STACK_PUSH(5, x0);
00189   SET_VAR_STACK();
00190 
00191   method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxButton_class, "on-drop-file", &mcache);
00192   if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxButtonOnDropFile)) {
00193     SET_VAR_STACK();
00194     READY_TO_RETURN; ASSELF wxButton::OnDropFile(x0);
00195   } else {
00196   mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread;
00197   p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0));
00198   ESCAPE_BLOCK(ESCAPE_NO_RET_VAL)
00199   p[0] = (Scheme_Object *) ASSELF __gc_external;
00200 
00201   v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p));
00202   { thread = scheme_get_current_thread(); thread->error_buf = savebuf; }
00203   
00204      READY_TO_RETURN;
00205   }
00206 }
00207 
00208 static Scheme_Object *os_wxButtonPreOnEvent(int n, Scheme_Object *p[]);
00209 
00210 Bool os_wxButton::PreOnEvent(class wxWindow* x0, class wxMouseEvent* x1)
00211 {
00212   Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT });
00213   Scheme_Object *v;
00214   Scheme_Object *method INIT_NULLED_OUT;
00215 #ifdef MZ_PRECISE_GC
00216   os_wxButton *sElF = this;
00217 #endif
00218   static void *mcache = 0;
00219 
00220   SETUP_VAR_STACK(7);
00221   VAR_STACK_PUSH(0, method);
00222   VAR_STACK_PUSH(1, sElF);
00223   VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2);
00224   VAR_STACK_PUSH(5, x0);
00225   VAR_STACK_PUSH(6, x1);
00226   SET_VAR_STACK();
00227 
00228   method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxButton_class, "pre-on-event", &mcache);
00229   if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxButtonPreOnEvent)) {
00230     SET_VAR_STACK();
00231     return FALSE;
00232   } else {
00233   mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread;
00234   p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxWindow(x0));
00235   p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x1));
00236   ESCAPE_BLOCK(1)
00237   p[0] = (Scheme_Object *) ASSELF __gc_external;
00238 
00239   v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p));
00240   { thread = scheme_get_current_thread(); thread->error_buf = savebuf; }
00241   
00242   {
00243      Bool resval;
00244      resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "pre-on-event in button%"", extracting return value"));
00245      READY_TO_RETURN;
00246      return resval;
00247   }
00248   }
00249 }
00250 
00251 static Scheme_Object *os_wxButtonPreOnChar(int n, Scheme_Object *p[]);
00252 
00253 Bool os_wxButton::PreOnChar(class wxWindow* x0, class wxKeyEvent* x1)
00254 {
00255   Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT });
00256   Scheme_Object *v;
00257   Scheme_Object *method INIT_NULLED_OUT;
00258 #ifdef MZ_PRECISE_GC
00259   os_wxButton *sElF = this;
00260 #endif
00261   static void *mcache = 0;
00262 
00263   SETUP_VAR_STACK(7);
00264   VAR_STACK_PUSH(0, method);
00265   VAR_STACK_PUSH(1, sElF);
00266   VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2);
00267   VAR_STACK_PUSH(5, x0);
00268   VAR_STACK_PUSH(6, x1);
00269   SET_VAR_STACK();
00270 
00271   method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxButton_class, "pre-on-char", &mcache);
00272   if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxButtonPreOnChar)) {
00273     SET_VAR_STACK();
00274     return FALSE;
00275   } else {
00276   mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread;
00277   p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxWindow(x0));
00278   p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x1));
00279   ESCAPE_BLOCK(1)
00280   p[0] = (Scheme_Object *) ASSELF __gc_external;
00281 
00282   v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p));
00283   { thread = scheme_get_current_thread(); thread->error_buf = savebuf; }
00284   
00285   {
00286      Bool resval;
00287      resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "pre-on-char in button%"", extracting return value"));
00288      READY_TO_RETURN;
00289      return resval;
00290   }
00291   }
00292 }
00293 
00294 static Scheme_Object *os_wxButtonOnSize(int n, Scheme_Object *p[]);
00295 
00296 void os_wxButton::OnSize(int x0, int x1)
00297 {
00298   Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT });
00299   Scheme_Object *v;
00300   Scheme_Object *method INIT_NULLED_OUT;
00301 #ifdef MZ_PRECISE_GC
00302   os_wxButton *sElF = this;
00303 #endif
00304   static void *mcache = 0;
00305 
00306   SETUP_VAR_STACK(5);
00307   VAR_STACK_PUSH(0, method);
00308   VAR_STACK_PUSH(1, sElF);
00309   VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2);
00310   SET_VAR_STACK();
00311 
00312   method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxButton_class, "on-size", &mcache);
00313   if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxButtonOnSize)) {
00314     SET_VAR_STACK();
00315     READY_TO_RETURN; ASSELF wxButton::OnSize(x0, x1);
00316   } else {
00317   
00318   p[POFFSET+0] = scheme_make_integer(x0);
00319   p[POFFSET+1] = scheme_make_integer(x1);
00320   
00321   p[0] = (Scheme_Object *) ASSELF __gc_external;
00322 
00323   v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p));
00324   
00325   
00326      READY_TO_RETURN;
00327   }
00328 }
00329 
00330 static Scheme_Object *os_wxButtonOnSetFocus(int n, Scheme_Object *p[]);
00331 
00332 void os_wxButton::OnSetFocus()
00333 {
00334   Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT });
00335   Scheme_Object *v;
00336   Scheme_Object *method INIT_NULLED_OUT;
00337 #ifdef MZ_PRECISE_GC
00338   os_wxButton *sElF = this;
00339 #endif
00340   static void *mcache = 0;
00341 
00342   SETUP_VAR_STACK(5);
00343   VAR_STACK_PUSH(0, method);
00344   VAR_STACK_PUSH(1, sElF);
00345   VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0);
00346   SET_VAR_STACK();
00347 
00348   method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxButton_class, "on-set-focus", &mcache);
00349   if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxButtonOnSetFocus)) {
00350     SET_VAR_STACK();
00351     READY_TO_RETURN; ASSELF wxButton::OnSetFocus();
00352   } else {
00353   mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread;
00354   ESCAPE_BLOCK(ESCAPE_NO_RET_VAL)
00355   p[0] = (Scheme_Object *) ASSELF __gc_external;
00356 
00357   v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p));
00358   { thread = scheme_get_current_thread(); thread->error_buf = savebuf; }
00359   
00360      READY_TO_RETURN;
00361   }
00362 }
00363 
00364 static Scheme_Object *os_wxButtonOnKillFocus(int n, Scheme_Object *p[]);
00365 
00366 void os_wxButton::OnKillFocus()
00367 {
00368   Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT });
00369   Scheme_Object *v;
00370   Scheme_Object *method INIT_NULLED_OUT;
00371 #ifdef MZ_PRECISE_GC
00372   os_wxButton *sElF = this;
00373 #endif
00374   static void *mcache = 0;
00375 
00376   SETUP_VAR_STACK(5);
00377   VAR_STACK_PUSH(0, method);
00378   VAR_STACK_PUSH(1, sElF);
00379   VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0);
00380   SET_VAR_STACK();
00381 
00382   method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxButton_class, "on-kill-focus", &mcache);
00383   if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxButtonOnKillFocus)) {
00384     SET_VAR_STACK();
00385     READY_TO_RETURN; ASSELF wxButton::OnKillFocus();
00386   } else {
00387   mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread;
00388   ESCAPE_BLOCK(ESCAPE_NO_RET_VAL)
00389   p[0] = (Scheme_Object *) ASSELF __gc_external;
00390 
00391   v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p));
00392   { thread = scheme_get_current_thread(); thread->error_buf = savebuf; }
00393   
00394      READY_TO_RETURN;
00395   }
00396 }
00397 
00398 static Scheme_Object *os_wxButtonButtonSetBorder(int n,  Scheme_Object *p[])
00399 {
00400   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00401   REMEMBER_VAR_STACK();
00402   objscheme_check_valid(os_wxButton_class, "set-border in button%", n, p);
00403   Bool x0;
00404 
00405   SETUP_VAR_STACK_REMEMBERED(1);
00406   VAR_STACK_PUSH(0, p);
00407 
00408   
00409   x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-border in button%"));
00410 
00411   
00412   WITH_VAR_STACK(ButtonSetBorder(((wxButton *)((Scheme_Class_Object *)p[0])->primdata), x0));
00413 
00414   
00415   
00416   READY_TO_RETURN;
00417   return scheme_void;
00418 }
00419 
00420 static Scheme_Object *os_wxButtonSetLabel(int n,  Scheme_Object *p[])
00421 {
00422   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00423   SETUP_PRE_VAR_STACK(1);
00424   PRE_VAR_STACK_PUSH(0, p);
00425   REMEMBER_VAR_STACK();
00426   objscheme_check_valid(os_wxButton_class, "set-label in button%", n, p);
00427   if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxBitmap(p[POFFSET+0], NULL, 0))) {
00428     class wxBitmap* x0 INIT_NULLED_OUT;
00429 
00430     SETUP_VAR_STACK_PRE_REMEMBERED(2);
00431     VAR_STACK_PUSH(0, p);
00432     VAR_STACK_PUSH(1, x0);
00433 
00434     
00435     if (n != (POFFSET+1)) 
00436       WITH_VAR_STACK(scheme_wrong_count_m("set-label in button% (bitmap label case)", POFFSET+1, POFFSET+1, n, p, 1));
00437     x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "set-label in button% (bitmap label case)", 0));
00438 
00439     { if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("button%","set-label"), "bad bitmap: ", p[POFFSET+0])); if (x0 && BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("button%","set-label"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+0])); }
00440     WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->SetLabel(x0));
00441 
00442     
00443     
00444     READY_TO_PRE_RETURN;
00445   } else  {
00446     string x0 INIT_NULLED_OUT;
00447 
00448     SETUP_VAR_STACK_PRE_REMEMBERED(2);
00449     VAR_STACK_PUSH(0, p);
00450     VAR_STACK_PUSH(1, x0);
00451 
00452     
00453     if (n != (POFFSET+1)) 
00454       WITH_VAR_STACK(scheme_wrong_count_m("set-label in button% (string label case)", POFFSET+1, POFFSET+1, n, p, 1));
00455     x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-label in button% (string label case)"));
00456 
00457     
00458     WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->SetLabel(x0));
00459 
00460     
00461     
00462     READY_TO_PRE_RETURN;
00463   }
00464 
00465   return scheme_void;
00466 }
00467 
00468 static Scheme_Object *os_wxButtonOnDropFile(int n,  Scheme_Object *p[])
00469 {
00470   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00471   REMEMBER_VAR_STACK();
00472   objscheme_check_valid(os_wxButton_class, "on-drop-file in button%", n, p);
00473   epathname x0 INIT_NULLED_OUT;
00474 
00475   SETUP_VAR_STACK_REMEMBERED(2);
00476   VAR_STACK_PUSH(0, p);
00477   VAR_STACK_PUSH(1, x0);
00478 
00479   
00480   x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "on-drop-file in button%"));
00481 
00482   
00483   if (((Scheme_Class_Object *)p[0])->primflag)
00484     WITH_VAR_STACK(((os_wxButton *)((Scheme_Class_Object *)p[0])->primdata)->wxButton::OnDropFile(x0));
00485   else
00486     WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->OnDropFile(x0));
00487 
00488   
00489   
00490   READY_TO_RETURN;
00491   return scheme_void;
00492 }
00493 
00494 static Scheme_Object *os_wxButtonPreOnEvent(int n,  Scheme_Object *p[])
00495 {
00496   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00497   REMEMBER_VAR_STACK();
00498   Bool r;
00499   objscheme_check_valid(os_wxButton_class, "pre-on-event in button%", n, p);
00500   class wxWindow* x0 INIT_NULLED_OUT;
00501   class wxMouseEvent* x1 INIT_NULLED_OUT;
00502 
00503   SETUP_VAR_STACK_REMEMBERED(3);
00504   VAR_STACK_PUSH(0, p);
00505   VAR_STACK_PUSH(1, x0);
00506   VAR_STACK_PUSH(2, x1);
00507 
00508   
00509   x0 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+0], "pre-on-event in button%", 0));
00510   x1 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+1], "pre-on-event in button%", 0));
00511 
00512   
00513   if (((Scheme_Class_Object *)p[0])->primflag)
00514     r = WITH_VAR_STACK(((os_wxButton *)((Scheme_Class_Object *)p[0])->primdata)-> wxWindow::PreOnEvent(x0, x1));
00515   else
00516     r = WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->PreOnEvent(x0, x1));
00517 
00518   
00519   
00520   READY_TO_RETURN;
00521   return (r ? scheme_true : scheme_false);
00522 }
00523 
00524 static Scheme_Object *os_wxButtonPreOnChar(int n,  Scheme_Object *p[])
00525 {
00526   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00527   REMEMBER_VAR_STACK();
00528   Bool r;
00529   objscheme_check_valid(os_wxButton_class, "pre-on-char in button%", n, p);
00530   class wxWindow* x0 INIT_NULLED_OUT;
00531   class wxKeyEvent* x1 INIT_NULLED_OUT;
00532 
00533   SETUP_VAR_STACK_REMEMBERED(3);
00534   VAR_STACK_PUSH(0, p);
00535   VAR_STACK_PUSH(1, x0);
00536   VAR_STACK_PUSH(2, x1);
00537 
00538   
00539   x0 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+0], "pre-on-char in button%", 0));
00540   x1 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+1], "pre-on-char in button%", 0));
00541 
00542   
00543   if (((Scheme_Class_Object *)p[0])->primflag)
00544     r = WITH_VAR_STACK(((os_wxButton *)((Scheme_Class_Object *)p[0])->primdata)-> wxWindow::PreOnChar(x0, x1));
00545   else
00546     r = WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->PreOnChar(x0, x1));
00547 
00548   
00549   
00550   READY_TO_RETURN;
00551   return (r ? scheme_true : scheme_false);
00552 }
00553 
00554 static Scheme_Object *os_wxButtonOnSize(int n,  Scheme_Object *p[])
00555 {
00556   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00557   REMEMBER_VAR_STACK();
00558   objscheme_check_valid(os_wxButton_class, "on-size in button%", n, p);
00559   int x0;
00560   int x1;
00561 
00562   SETUP_VAR_STACK_REMEMBERED(1);
00563   VAR_STACK_PUSH(0, p);
00564 
00565   
00566   x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "on-size in button%"));
00567   x1 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+1], "on-size in button%"));
00568 
00569   
00570   if (((Scheme_Class_Object *)p[0])->primflag)
00571     WITH_VAR_STACK(((os_wxButton *)((Scheme_Class_Object *)p[0])->primdata)->wxButton::OnSize(x0, x1));
00572   else
00573     WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->OnSize(x0, x1));
00574 
00575   
00576   
00577   READY_TO_RETURN;
00578   return scheme_void;
00579 }
00580 
00581 static Scheme_Object *os_wxButtonOnSetFocus(int n,  Scheme_Object *p[])
00582 {
00583   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00584   REMEMBER_VAR_STACK();
00585   objscheme_check_valid(os_wxButton_class, "on-set-focus in button%", n, p);
00586 
00587   SETUP_VAR_STACK_REMEMBERED(1);
00588   VAR_STACK_PUSH(0, p);
00589 
00590   
00591 
00592   
00593   if (((Scheme_Class_Object *)p[0])->primflag)
00594     WITH_VAR_STACK(((os_wxButton *)((Scheme_Class_Object *)p[0])->primdata)->wxButton::OnSetFocus());
00595   else
00596     WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->OnSetFocus());
00597 
00598   
00599   
00600   READY_TO_RETURN;
00601   return scheme_void;
00602 }
00603 
00604 static Scheme_Object *os_wxButtonOnKillFocus(int n,  Scheme_Object *p[])
00605 {
00606   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00607   REMEMBER_VAR_STACK();
00608   objscheme_check_valid(os_wxButton_class, "on-kill-focus in button%", n, p);
00609 
00610   SETUP_VAR_STACK_REMEMBERED(1);
00611   VAR_STACK_PUSH(0, p);
00612 
00613   
00614 
00615   
00616   if (((Scheme_Class_Object *)p[0])->primflag)
00617     WITH_VAR_STACK(((os_wxButton *)((Scheme_Class_Object *)p[0])->primdata)->wxButton::OnKillFocus());
00618   else
00619     WITH_VAR_STACK(((wxButton *)((Scheme_Class_Object *)p[0])->primdata)->OnKillFocus());
00620 
00621   
00622   
00623   READY_TO_RETURN;
00624   return scheme_void;
00625 }
00626 
00627 static Scheme_Object *os_wxButton_ConstructScheme(int n,  Scheme_Object *p[])
00628 {
00629   SETUP_PRE_VAR_STACK(1);
00630   PRE_VAR_STACK_PUSH(0, p);
00631   os_wxButton *realobj INIT_NULLED_OUT;
00632   REMEMBER_VAR_STACK();
00633   if ((n >= (POFFSET+3)) && WITH_REMEMBERED_STACK(objscheme_istype_wxPanel(p[POFFSET+0], NULL, 0)) && (SCHEME_NULLP(p[POFFSET+1]) || WITH_REMEMBERED_STACK(objscheme_istype_proc2(p[POFFSET+1], NULL))) && WITH_REMEMBERED_STACK(objscheme_istype_wxBitmap(p[POFFSET+2], NULL, 0))) {
00634     class wxPanel* x0 INIT_NULLED_OUT;
00635     wxFunction x1;
00636     class wxBitmap* x2 INIT_NULLED_OUT;
00637     int x3;
00638     int x4;
00639     int x5;
00640     int x6;
00641     int x7;
00642     class wxFont* x8 INIT_NULLED_OUT;
00643     string x9 INIT_NULLED_OUT;
00644 
00645     SETUP_VAR_STACK_PRE_REMEMBERED(6);
00646     VAR_STACK_PUSH(0, p);
00647     VAR_STACK_PUSH(1, realobj);
00648     VAR_STACK_PUSH(2, x0);
00649     VAR_STACK_PUSH(3, x2);
00650     VAR_STACK_PUSH(4, x8);
00651     VAR_STACK_PUSH(5, x9);
00652 
00653     int cb_pos = 0;
00654     if ((n < (POFFSET+3)) || (n > (POFFSET+10))) 
00655       WITH_VAR_STACK(scheme_wrong_count_m("initialization in button% (bitmap label case)", POFFSET+3, POFFSET+10, n, p, 1));
00656     x0 = WITH_VAR_STACK(objscheme_unbundle_wxPanel(p[POFFSET+0], "initialization in button% (bitmap label case)", 0));
00657     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));
00658     x2 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+2], "initialization in button% (bitmap label case)", 0));
00659     if (n > (POFFSET+3)) {
00660       x3 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+3], "initialization in button% (bitmap label case)"));
00661     } else
00662       x3 = -1;
00663     if (n > (POFFSET+4)) {
00664       x4 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+4], "initialization in button% (bitmap label case)"));
00665     } else
00666       x4 = -1;
00667     if (n > (POFFSET+5)) {
00668       x5 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+5], "initialization in button% (bitmap label case)"));
00669     } else
00670       x5 = -1;
00671     if (n > (POFFSET+6)) {
00672       x6 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+6], "initialization in button% (bitmap label case)"));
00673     } else
00674       x6 = -1;
00675     if (n > (POFFSET+7)) {
00676       x7 = WITH_VAR_STACK(unbundle_symset_buttonStyle(p[POFFSET+7], "initialization in button% (bitmap label case)"));
00677     } else
00678       x7 = 0;
00679     if (n > (POFFSET+8)) {
00680       x8 = WITH_VAR_STACK(objscheme_unbundle_wxFont(p[POFFSET+8], "initialization in button% (bitmap label case)", 1));
00681     } else
00682       x8 = NULL;
00683     if (n > (POFFSET+9)) {
00684       x9 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+9], "initialization in button% (bitmap label case)"));
00685     } else
00686       x9 = "button";
00687 
00688     { if (x2 && !x2->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("button%","initialization"), "bad bitmap: ", p[POFFSET+2])); if (x2 && BM_SELECTED(x2)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("button%","initialization"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+2])); }if (!x5) x5 = -1;if (!x6) x6 = -1;
00689     realobj = WITH_VAR_STACK(new os_wxButton CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)));
00690 #ifdef MZ_PRECISE_GC
00691     WITH_VAR_STACK(realobj->gcInit_wxButton(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9));
00692 #endif
00693     realobj->__gc_external = (void *)p[0];
00694     
00695     realobj->callback_closure = p[POFFSET+cb_pos];
00696     READY_TO_PRE_RETURN;
00697   } else  {
00698     class wxPanel* x0 INIT_NULLED_OUT;
00699     wxFunction x1;
00700     string x2 INIT_NULLED_OUT;
00701     int x3;
00702     int x4;
00703     int x5;
00704     int x6;
00705     int x7;
00706     class wxFont* x8 INIT_NULLED_OUT;
00707     string x9 INIT_NULLED_OUT;
00708 
00709     SETUP_VAR_STACK_PRE_REMEMBERED(6);
00710     VAR_STACK_PUSH(0, p);
00711     VAR_STACK_PUSH(1, realobj);
00712     VAR_STACK_PUSH(2, x0);
00713     VAR_STACK_PUSH(3, x2);
00714     VAR_STACK_PUSH(4, x8);
00715     VAR_STACK_PUSH(5, x9);
00716 
00717     int cb_pos = 0;
00718     if ((n < (POFFSET+3)) || (n > (POFFSET+10))) 
00719       WITH_VAR_STACK(scheme_wrong_count_m("initialization in button% (string label case)", POFFSET+3, POFFSET+10, n, p, 1));
00720     x0 = WITH_VAR_STACK(objscheme_unbundle_wxPanel(p[POFFSET+0], "initialization in button% (string label case)", 0));
00721     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));
00722     x2 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+2], "initialization in button% (string label case)"));
00723     if (n > (POFFSET+3)) {
00724       x3 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+3], "initialization in button% (string label case)"));
00725     } else
00726       x3 = -1;
00727     if (n > (POFFSET+4)) {
00728       x4 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+4], "initialization in button% (string label case)"));
00729     } else
00730       x4 = -1;
00731     if (n > (POFFSET+5)) {
00732       x5 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+5], "initialization in button% (string label case)"));
00733     } else
00734       x5 = -1;
00735     if (n > (POFFSET+6)) {
00736       x6 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+6], "initialization in button% (string label case)"));
00737     } else
00738       x6 = -1;
00739     if (n > (POFFSET+7)) {
00740       x7 = WITH_VAR_STACK(unbundle_symset_buttonStyle(p[POFFSET+7], "initialization in button% (string label case)"));
00741     } else
00742       x7 = 0;
00743     if (n > (POFFSET+8)) {
00744       x8 = WITH_VAR_STACK(objscheme_unbundle_wxFont(p[POFFSET+8], "initialization in button% (string label case)", 1));
00745     } else
00746       x8 = NULL;
00747     if (n > (POFFSET+9)) {
00748       x9 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+9], "initialization in button% (string label case)"));
00749     } else
00750       x9 = "button";
00751 
00752     if (!x5) x5 = -1;if (!x6) x6 = -1;
00753     realobj = WITH_VAR_STACK(new os_wxButton CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)));
00754 #ifdef MZ_PRECISE_GC
00755     WITH_VAR_STACK(realobj->gcInit_wxButton(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9));
00756 #endif
00757     realobj->__gc_external = (void *)p[0];
00758     
00759     realobj->callback_closure = p[POFFSET+cb_pos];
00760     READY_TO_PRE_RETURN;
00761   }
00762 
00763   ((Scheme_Class_Object *)p[0])->primdata = realobj;
00764   ((Scheme_Class_Object *)p[0])->primflag = 1;
00765   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
00766   return scheme_void;
00767 }
00768 
00769 void objscheme_setup_wxButton(Scheme_Env *env)
00770 {
00771   SETUP_VAR_STACK(1);
00772   VAR_STACK_PUSH(0, env);
00773 
00774   wxREGGLOB(os_wxButton_class);
00775 
00776   os_wxButton_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "button%", "item%", (Scheme_Method_Prim *)os_wxButton_ConstructScheme, 8));
00777 
00778   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "set-border" " method", (Scheme_Method_Prim *)os_wxButtonButtonSetBorder, 1, 1));
00779   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "set-label" " method", (Scheme_Method_Prim *)os_wxButtonSetLabel, 1, 1));
00780   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "on-drop-file" " method", (Scheme_Method_Prim *)os_wxButtonOnDropFile, 1, 1));
00781   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "pre-on-event" " method", (Scheme_Method_Prim *)os_wxButtonPreOnEvent, 2, 2));
00782   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "pre-on-char" " method", (Scheme_Method_Prim *)os_wxButtonPreOnChar, 2, 2));
00783   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "on-size" " method", (Scheme_Method_Prim *)os_wxButtonOnSize, 2, 2));
00784   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "on-set-focus" " method", (Scheme_Method_Prim *)os_wxButtonOnSetFocus, 0, 0));
00785   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxButton_class, "on-kill-focus" " method", (Scheme_Method_Prim *)os_wxButtonOnKillFocus, 0, 0));
00786 
00787 
00788   WITH_VAR_STACK(scheme_made_class(os_wxButton_class));
00789 
00790   WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxButton, wxTYPE_BUTTON));
00791 
00792   READY_TO_RETURN;
00793 }
00794 
00795 int objscheme_istype_wxButton(Scheme_Object *obj, const char *stop, int nullOK)
00796 {
00797   REMEMBER_VAR_STACK();
00798   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
00799   if (objscheme_is_a(obj,  os_wxButton_class))
00800     return 1;
00801   else {
00802     if (!stop)
00803        return 0;
00804     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "button% object or " XC_NULL_STR: "button% object", -1, 0, &obj));
00805     return 0;
00806   }
00807 }
00808 
00809 Scheme_Object *objscheme_bundle_wxButton(class wxButton *realobj)
00810 {
00811   Scheme_Class_Object *obj INIT_NULLED_OUT;
00812   Scheme_Object *sobj INIT_NULLED_OUT;
00813 
00814   if (!realobj) return XC_SCHEME_NULL;
00815 
00816   if (realobj->__gc_external)
00817     return (Scheme_Object *)realobj->__gc_external;
00818 
00819   SETUP_VAR_STACK(2);
00820   VAR_STACK_PUSH(0, obj);
00821   VAR_STACK_PUSH(1, realobj);
00822 
00823   if ((realobj->__type != wxTYPE_BUTTON) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
00824     { READY_TO_RETURN; return sobj; }
00825   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxButton_class));
00826 
00827   obj->primdata = realobj;
00828   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
00829   obj->primflag = 0;
00830 
00831   realobj->__gc_external = (void *)obj;
00832   READY_TO_RETURN;
00833   return (Scheme_Object *)obj;
00834 }
00835 
00836 class wxButton *objscheme_unbundle_wxButton(Scheme_Object *obj, const char *where, int nullOK)
00837 {
00838   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
00839 
00840   REMEMBER_VAR_STACK();
00841 
00842   (void)objscheme_istype_wxButton(obj, where, nullOK);
00843   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
00844   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
00845   if (o->primflag)
00846     return (os_wxButton *)o->primdata;
00847   else
00848     return (wxButton *)o->primdata;
00849 }
00850 
00851 
00852 
00853 static void CB_TOSCHEME(CB_REALCLASS *realobj, wxCommandEvent *event)
00854 {
00855   Scheme_Object *p[2];
00856   Scheme_Class_Object *obj;
00857   mz_jmp_buf savebuf;
00858   Scheme_Thread *thread;
00859   SETUP_VAR_STACK(4);
00860   VAR_STACK_PUSH(0, obj);
00861   VAR_STACK_PUSH(1, event);
00862   VAR_STACK_PUSH(2, p[0]);
00863   VAR_STACK_PUSH(3, p[1]);
00864 
00865   p[0] = NULL;
00866   p[1] = NULL;
00867 
00868   obj = (Scheme_Class_Object *)realobj->__gc_external;
00869 
00870   if (!obj) {
00871     // scheme_signal_error("bad callback object");
00872     return;
00873   }
00874 
00875   p[0] = (Scheme_Object *)obj;
00876   p[1] = WITH_VAR_STACK(objscheme_bundle_wxCommandEvent(event));
00877 
00878   thread = scheme_get_current_thread();
00879   COPY_JMPBUF(savebuf, *(thread->error_buf));
00880 
00881   if (!scheme_setjmp(*(thread->error_buf)))
00882     WITH_VAR_STACK(scheme_apply_multi(((CALLBACKCLASS *)obj->primdata)->callback_closure, 2, p));
00883 
00884   thread = scheme_get_current_thread();
00885   COPY_JMPBUF(*(thread->error_buf), savebuf);
00886 
00887   READY_TO_RETURN;
00888 }