Esempio n. 1
0
/* ECMAScript constructor */
Handle<Value> Text::New(const Arguments& args)
{
    HandleScope scope;
    static ClutterColor color;

    if (!args.IsConstructCall()) {
        return ThrowException(Exception::TypeError(
                                  String::New("Use the new operator to create instances of this object."))
                             );
    }

    // Creates a new instance object of this type and wraps it.
    Text* obj = new Text();
    obj->Wrap(args.This());

    /* Set color */
    if (args.Length() > 0) {
        ClutterActor *instance = obj->_actor;

        if (args[0]->IsString())
            clutter_text_set_text(CLUTTER_TEXT(instance), *String::Utf8Value(args[0]->ToString()));
    }

    return scope.Close(args.This());
}