Exemplo n.º 1
0
Arquivo: main.cpp Projeto: Hanmac/rwx
DLL_LOCAL void not_valid(VALUE val, VALUE klass)
{
	rb_raise(
		rb_eTypeError,
		"%" PRIsVALUE " is not valid %" PRIsVALUE,
		RB_OBJ_STRING(val), RB_CLASSNAME(klass)
	);
}
Exemplo n.º 2
0
Arquivo: main.cpp Projeto: Hanmac/rwx
bool check_class(VALUE obj, VALUE klass)
{
	bool result = rb_obj_is_kind_of(obj, klass);
	if(!result)
		rb_raise(rb_eTypeError,
			"Expected %" PRIsVALUE " got %" PRIsVALUE "!",
			RB_CLASSNAME(klass),
			RB_OBJ_CLASSNAME(obj)
		);
	return result;
}
Exemplo n.º 3
0
Arquivo: main.cpp Projeto: Hanmac/rwx
VALUE wrapTypedPtr(void *arg,VALUE klass, bool allowNull)
{
	if(arg || allowNull){
		rb_data_type_t* datatype = unwrapDataType(klass);
		if(!datatype)
			rb_fatal("%" PRIsVALUE " unknown datatype", RB_CLASSNAME(klass));

		return TypedData_Wrap_Struct(klass, datatype, arg);
	}
	return Qnil;
}
Exemplo n.º 4
0
bool check_negative_size(const int &width, const int &height)
{

	if(height <= 0 || width <= 0)
	{
		rb_raise(rb_eArgError,
			"%" PRIsVALUE "(%d, %d) does have invalid size.",
			RB_CLASSNAME(rb_cWXSize),
			width, height
		);
		return false;
	}
	return true;
}
Exemplo n.º 5
0
/*
 * call-seq:
 *   get_page_image(pos) -> Integer
 *
 * returns the image idx of the given page.
 * ===Arguments
 * * pos is a Integer
 *
 * ===Return value
 * Integer
 * === Exceptions
 * [IndexError]
 * * pos is greater than the count of pages
*/
DLL_LOCAL VALUE _get_page_image(VALUE self,VALUE idx)
{
#if wxUSE_AUI
	//TODO should be fixed in wx
	if(rb_obj_is_kind_of(self,rb_cWXAuiNotebook))
		rb_raise(
			rb_eArgError,"get_page_image is not supported for %" PRIsVALUE,
			RB_CLASSNAME(rb_cWXAuiNotebook)
		);
#endif
	int cidx(NUM2INT(idx));
	if(check_index(cidx,_self->GetPageCount()))
		return INT2NUM(_self->GetPageImage(cidx));
	return Qnil;
}
Exemplo n.º 6
0
void app_protected()
{
	if(!ruby_app_inited)
		rb_raise(rb_eArgError,"%" PRIsVALUE " is not running.",RB_CLASSNAME(rb_cWXApp));
}