Пример #1
0
/*
 * 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));
}
Пример #2
0
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;
}
Пример #3
0
/*
 * 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));
}
Пример #4
0
/*
 * 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));
}
Пример #5
0
VALUE wrap< wxTextAttr >(wxTextAttr *attr )
{
	return wrapTypedPtr(attr, rb_cWXTextAttr);
}
Пример #6
0
VALUE wrap< wxCursor >(wxCursor *cursor )
{
    return wrapTypedPtr(cursor, rb_cWXCursor);
}
Пример #7
0
VALUE wrap< wxAuiPaneInfo >(wxAuiPaneInfo *vinfo)
{
	return wrapTypedPtr(vinfo,rb_cWXAuiPane);
}
Пример #8
0
DLL_LOCAL VALUE _alloc(VALUE self)
{
	return wrapTypedPtr(new RubyGridTable(self),self);
}
Пример #9
0
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;
}
Пример #10
0
RubyApp::RubyApp(VALUE klass)
{
	mRuby = wrapTypedPtr(this,klass);
}
Пример #11
0
VALUE wrap< wxSize >(wxSize *size )
{
	return wrapTypedPtr(size, rb_cWXSize);
}