...so I tried to add it. Below is what I have so far.
I tried putting it in patch format, but I've never tried that before, so
beware of errors on my part.
<PATCH>
*** fltk.cc 2001/11/27 10:02:52 1.70
--- fltk.cc 2001/11/27 18:33:46
***************
*** 786,789 ****
--- 786,816 ----
static FN_GLOBAL_GET_INT_SET_FORMAT_STR3(choice);
+
+ static VALUE rb_fltk_input(int argc, VALUE argv[], VALUE self) {
+ VALUE rlabel, rdefault;
+ const char *result=NULL, *label=NULL, *deflt=NULL;
+
+ rb_scan_args( argc, argv, "11", &rlabel, &rdefault );
+
+ // the case of printf arguments isn't implemented yet.
+ switch(argc){
+ case 2:
+ deflt = (rdefault == Qnil) ? NULL : STR2CSTR(rdefault);
+ // fall thru to get the label data too
+ case 1:
+ label = (rlabel == Qnil) ? "" : STR2CSTR(rlabel);
+ break;
+ default:
+ rb_raise(rb_eArgError, "Illegal number of arguments.");
+ break;
+ };
+ result = fl_input( label, deflt );
+
+ if( result )
+ return rb_tainted_str_new2( result );
+ else
+ return Qnil;
+ };
+
static VALUE rb_fltk_draw_pixmap(int argc, VALUE argv[], VALUE self)
{
***************
*** 1033,1036 ****
--- 1060,1065 ----
DEF_MODULE_FUNC(ask,-1);
DEF_MODULE_FUNC(choice,-1);
+ DEF_MODULE_FUNC(input,-1);
+
DEF_MODULE_FUNC(file_chooser,-1);
DEF_MODULE_FUNC(file_chooser_callback,-1);
</PATCH>
It seems to work nicely, but that is because I've "forgotten" the part
on printf arguments (the ... at the end of the fl_input method
definition) since I don't know which of the strings should be affected.
The fl_password wrapping would be nearly identical, I believe.
--
<[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]>
)____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_(
/"Opinions expressed are mine and not those of my Employer, "\
( "the University, my girlfriend, stray cats, banana fruitflies, " )
\"nor the frontal lobe of my left cerebral hemisphere. "/
|