Sha256: 3163614c050224b8f532ba8e2e793219609de8cde154ab281352ce7210753913

Contents?: true

Size: 1.7 KB

Versions: 8

Compression:

Stored size: 1.7 KB

Contents

#include "reflex/ruby/event.h"


#include "reflex/ruby/view.h"
#include "defs.h"


RUCY_DEFINE_VALUE_FROM_TO(Reflex::FocusEvent)

#define THIS  to<Reflex::FocusEvent*>(self)

#define CHECK RUCY_CHECK_OBJ(Reflex::FocusEvent, self)


static
RUCY_DEF_ALLOC(alloc, klass)
{
	return new_type<Reflex::FocusEvent>(klass);
}
RUCY_END

static
RUCY_DEF3(initialize, type, current, last)
{
	CHECK;

	THIS->type    = (Reflex::FocusEvent::Type) to<uint>(type);
	THIS->current = to<Reflex::View*>(current);
	THIS->last    = to<Reflex::View*>(last);

	return rb_call_super(0, NULL);
}
RUCY_END

static
RUCY_DEF1(initialize_copy, obj)
{
	CHECK;
	*THIS = to<Reflex::FocusEvent&>(obj);
	return self;
}
RUCY_END

static
RUCY_DEF0(type)
{
	CHECK;
	return value(THIS->type);
}
RUCY_END

static
RUCY_DEF0(current)
{
	CHECK;
	return THIS->current ? value(THIS->current) : nil();
}
RUCY_END

static
RUCY_DEF0(last)
{
	CHECK;
	return THIS->last ? value(THIS->last) : nil();
}
RUCY_END


static Class cFocusEvent;

void
Init_focus_event ()
{
	Module mReflex = define_module("Reflex");

	cFocusEvent = mReflex.define_class("FocusEvent", Reflex::event_class());
	cFocusEvent.define_alloc_func(alloc);
	cFocusEvent.define_private_method("initialize",      initialize);
	cFocusEvent.define_private_method("initialize_copy", initialize_copy);
	cFocusEvent.define_method("type", type);
	cFocusEvent.define_method("current", current);
	cFocusEvent.define_method("last", last);
	cFocusEvent.define_const("TYPE_NONE",  Reflex::FocusEvent::NONE);
	cFocusEvent.define_const("TYPE_FOCUS", Reflex::FocusEvent::FOCUS);
	cFocusEvent.define_const("TYPE_BLUR",  Reflex::FocusEvent::BLUR);
}


namespace Reflex
{


	Class
	focus_event_class ()
	{
		return cFocusEvent;
	}


}// Reflex

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reflexion-0.1.21 ext/reflex/focus_event.cpp
reflexion-0.1.20 ext/reflex/focus_event.cpp
reflexion-0.1.19 ext/reflex/focus_event.cpp
reflexion-0.1.17 ext/reflex/focus_event.cpp
reflexion-0.1.16 ext/reflex/focus_event.cpp
reflexion-0.1.15 ext/reflex/focus_event.cpp
reflexion-0.1.14 ext/reflex/focus_event.cpp
reflexion-0.1.13 ext/reflex/focus_event.cpp