/* * call-seq: * scale(x, y) -> WX::Size * scale(i) -> WX::Size * * i -> WX::Size * * scale this size and return new size. * ===Arguments * * x, y and i are Float * ===Return value * WX::Size */ DLL_LOCAL VALUE _scale(int argc,VALUE *argv,VALUE self) { VALUE x, y; rb_scan_args(argc, argv, "11", &x, &y); wxSize* result = new wxSize(*_self); result->Scale(NUM2DBL(x), NUM2DBL(NIL_P(y) ? x : y)); return wrapTypedPtr(result, rb_class_of(self)); }
VALUE wrap(wxObject *obj, wxClassInfo *info) { //wxClassInfo *info = obj->GetClassInfo(); VALUE klass = wrapClass(info); if(!NIL_P(klass)) { return wrapTypedPtr(obj,klass); } rb_warn("%s type unknown",wxString(info->GetClassName()).c_str().AsChar()); return Qnil; }
/* * call-seq: * / n -> WX::Size * * devide this size and return new size. * ===Arguments * * n are Float * ===Return value * WX::Size * === Exceptions * [ZeroDivisionError] * * if n is zero */ DLL_LOCAL VALUE _devide(VALUE self, VALUE n) { float d = NUM2DBL(n); if(d == 0) rb_raise(rb_eZeroDivError, "divided by 0"); d = 1.0 / d; wxSize* result = new wxSize(*_self); result->Scale(d, d); return wrapTypedPtr(result, rb_class_of(self)); }
/* * call-seq: * dec_by(x, y) -> WX::Size * dec_by(i) -> WX::Size * dec_by(size) -> WX::Size * - i -> WX::Size * - size -> WX::Size * * decrease this size and return new size. * ===Arguments * * x, y and i are Integer * * size is a WX::Size * ===Return value * WX::Size */ DLL_LOCAL VALUE _decBy(int argc,VALUE *argv,VALUE self) { VALUE x, y; rb_scan_args(argc, argv, "11", &x, &y); wxSize* result = new wxSize(*_self); if(NIL_P(y)) { if(is_wrapable<wxSize>(x)) { result->DecBy(unwrap<wxSize>(x)); } else { result->DecBy(RB_NUM2INT(x)); } } else { result->DecBy(RB_NUM2INT(x), RB_NUM2INT(y)); } return wrapTypedPtr(result, rb_class_of(self)); }
VALUE wrap< wxTextAttr >(wxTextAttr *attr ) { return wrapTypedPtr(attr, rb_cWXTextAttr); }
VALUE wrap< wxCursor >(wxCursor *cursor ) { return wrapTypedPtr(cursor, rb_cWXCursor); }
VALUE wrap< wxAuiPaneInfo >(wxAuiPaneInfo *vinfo) { return wrapTypedPtr(vinfo,rb_cWXAuiPane); }
DLL_LOCAL VALUE _alloc(VALUE self) { return wrapTypedPtr(new RubyGridTable(self),self); }
bool RubyDataViewNotifier::ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) { dynamic_cast<DataViewClientHolder*>(this->GetOwner())->setClientValue(item,new RubyClientData(wrapTypedPtr((void*)(&item),rb_cWXDataViewItem))); return true; }
RubyApp::RubyApp(VALUE klass) { mRuby = wrapTypedPtr(this,klass); }
VALUE wrap< wxSize >(wxSize *size ) { return wrapTypedPtr(size, rb_cWXSize); }