ext/wxFileDialog.cpp in rwx-0.0.1.dev vs ext/wxFileDialog.cpp in rwx-0.0.1.1.dev

- old
+ new

@@ -100,10 +100,12 @@ macro_attr_with_func(Wildcard,wrap,unwrapWildCard) macro_attr(Message,wxString) macro_attr(Path,wxString) singlereturn(GetFilterIndex) +singlereturn_array(GetFilenames, wxArrayString) +singlereturn_array(GetPaths, wxArrayString) VALUE _setFilterIndex(VALUE self,VALUE other) { rb_check_frozen(self); @@ -113,26 +115,10 @@ _self->SetFilterIndex(filter); return other; } - -DLL_LOCAL VALUE _getFilenames(VALUE self) -{ - wxArrayString result; - _self->GetFilenames(result); - return wrap(result); -} - -DLL_LOCAL VALUE _getPaths(VALUE self) -{ - wxArrayString result; - _self->GetPaths(result); - return wrap(result); -} - - DLL_LOCAL VALUE _saveFileSelector(int argc,VALUE *argv,VALUE self) { VALUE what,extension,default_name,parent; rb_scan_args(argc, argv, "22",&what,&extension,&default_name,&parent); app_protected(); @@ -174,10 +160,16 @@ * the message of the FileDialog. String */ /* Document-attr: path * the path of the FileDialog. String */ +/* Document-attr: filenames + * the filenamex of the FileDialog. Array<String> + */ +/* Document-attr: paths + * the paths of the FileDialog. Array<String> + */ /* Document-const: OPEN * This is an open dialog; usually this means that the default button's label of the dialog is "Open". */ @@ -216,34 +208,37 @@ rb_mWX = rb_define_module("WX"); rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject); rb_cWXTopLevel = rb_define_class_under(rb_mWX,"TopLevel",rb_cWXWindow); rb_cWXDialog = rb_define_class_under(rb_mWX,"Dialog",rb_cWXTopLevel); +#endif +#if wxUSE_FILEDLG + using namespace RubyWX::FileDialog; + rb_cWXFileDialog = rb_define_class_under(rb_mWX,"FileDialog",rb_cWXDialog); + rb_define_alloc_func(rb_cWXFileDialog,_alloc); + rb_define_method(rb_cWXFileDialog,"initialize",RUBY_METHOD_FUNC(_initialize),-1); + +#if 0 rb_define_attr(rb_cWXFileDialog,"directory",1,1); rb_define_attr(rb_cWXFileDialog,"filename",1,1); rb_define_attr(rb_cWXFileDialog,"filter_index",1,1); rb_define_attr(rb_cWXFileDialog,"wildcard",1,1); rb_define_attr(rb_cWXFileDialog,"message",1,1); rb_define_attr(rb_cWXFileDialog,"path",1,1); - + rb_define_attr(rb_cWXFileDialog,"filenames",1,0); + rb_define_attr(rb_cWXFileDialog,"paths",1,0); #endif -#if wxUSE_FILEDLG - using namespace RubyWX::FileDialog; - rb_cWXFileDialog = rb_define_class_under(rb_mWX,"FileDialog",rb_cWXDialog); - rb_define_alloc_func(rb_cWXFileDialog,_alloc); - rb_define_method(rb_cWXFileDialog,"initialize",RUBY_METHOD_FUNC(_initialize),-1); - rb_define_attr_method(rb_cWXFileDialog,"directory",_getDirectory,_setDirectory); rb_define_attr_method(rb_cWXFileDialog,"filename",_getFilename,_setFilename); rb_define_attr_method(rb_cWXFileDialog,"wildcard",_getWildcard,_setWildcard); rb_define_attr_method(rb_cWXFileDialog,"filter_index",_GetFilterIndex,_setFilterIndex); rb_define_attr_method(rb_cWXFileDialog,"message",_getMessage,_setMessage); rb_define_attr_method(rb_cWXFileDialog,"path",_getPath,_setPath); - rb_define_method(rb_cWXFileDialog,"filenames",RUBY_METHOD_FUNC(_getFilenames),0); - rb_define_method(rb_cWXFileDialog,"paths",RUBY_METHOD_FUNC(_getPaths),0); + rb_define_attr_method(rb_cWXFileDialog,"filenames",_GetFilenames,NULL); + rb_define_attr_method(rb_cWXFileDialog,"paths",_GetPaths,NULL); rb_define_module_function(rb_mWX,"load_dialog",RUBY_METHOD_FUNC(_loadFileSelector),-1); rb_define_module_function(rb_mWX,"save_dialog",RUBY_METHOD_FUNC(_saveFileSelector),-1); rb_define_const(rb_cWXFileDialog,"OPEN",INT2NUM(wxFD_OPEN));