clean up the api
svn path=/trunk/KDE/kdebase/runtime/; revision=1055279
This commit is contained in:
parent
d42ab28719
commit
3cafef2efe
@ -48,6 +48,12 @@ static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||
static QScriptValue bold(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, bold);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setBold(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->bold());
|
||||
}
|
||||
|
||||
@ -66,12 +72,24 @@ static QScriptValue exactMatch(QScriptContext *ctx, QScriptEngine *eng)
|
||||
static QScriptValue family(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, family);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setFamily(arg.toString());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->family());
|
||||
}
|
||||
|
||||
static QScriptValue fixedPitch(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, fixedPitch);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setFixedPitch(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->fixedPitch());
|
||||
}
|
||||
|
||||
@ -81,11 +99,6 @@ static QScriptValue fromString(QScriptContext *ctx, QScriptEngine *eng)
|
||||
return QScriptValue(eng, self->fromString(ctx->argument(0).toString()));
|
||||
}
|
||||
|
||||
static QScriptValue handle(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.prototype.handle is not implemented");
|
||||
}
|
||||
|
||||
static QScriptValue isCopyOf(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, isCopyOf);
|
||||
@ -100,12 +113,24 @@ static QScriptValue isCopyOf(QScriptContext *ctx, QScriptEngine *eng)
|
||||
static QScriptValue italic(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, italic);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setItalic(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->italic());
|
||||
}
|
||||
|
||||
static QScriptValue kerning(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, kerning);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setKerning(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->kerning());
|
||||
}
|
||||
|
||||
@ -130,39 +155,51 @@ static QScriptValue lastResortFont(QScriptContext *ctx, QScriptEngine *eng)
|
||||
static QScriptValue overline(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, overline);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setOverline(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->overline());
|
||||
}
|
||||
|
||||
static QScriptValue pixelSize(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, pixelSize);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setPixelSize(arg.toInt32());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->pixelSize());
|
||||
}
|
||||
|
||||
static QScriptValue pointSize(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, pointSize);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setPointSize(arg.toInt32());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->pointSize());
|
||||
}
|
||||
|
||||
static QScriptValue pointSizeF(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, pointSizeF);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setPointSizeF(arg.toNumber());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->pointSizeF());
|
||||
}
|
||||
|
||||
static QScriptValue rawMode(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, rawMode);
|
||||
return QScriptValue(eng, self->rawMode());
|
||||
}
|
||||
|
||||
static QScriptValue rawName(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, rawName);
|
||||
return QScriptValue(eng, self->rawName());
|
||||
}
|
||||
|
||||
static QScriptValue resolve(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, resolve);
|
||||
@ -174,168 +211,30 @@ static QScriptValue resolve(QScriptContext *ctx, QScriptEngine *eng)
|
||||
return qScriptValueFromValue(eng, self->resolve(*other));
|
||||
}
|
||||
|
||||
static QScriptValue setBold(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setBold);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setBold(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setFamily(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setFamily);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setFamily(arg.toString());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setFixedPitch(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setFixedPitch);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setFixedPitch(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setItalic(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setItalic);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setItalic(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setKerning(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setKerning);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setKerning(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setOverline(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setOverline);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setOverline(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setPixelSize(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setPixelSize);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setPixelSize(arg.toInt32());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setPointSize(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setPointSize);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setPointSize(arg.toInt32());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setPointSizeF(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setPointSizeF);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setPointSizeF(arg.toNumber());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setRawMode(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setRawMode);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setRawMode(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setRawName(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setRawName);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setRawName(arg.toString());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setStretch(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setStretch);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setStretch(arg.toInt32());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setStrikeOut(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setStrikeOut);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setStrikeOut(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setStyle(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.setStyle");
|
||||
}
|
||||
|
||||
static QScriptValue setStyleHint(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.setStyleHint");
|
||||
}
|
||||
|
||||
static QScriptValue setStyleStrategy(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.setStyleStrategy");
|
||||
}
|
||||
|
||||
static QScriptValue setUnderline(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setUnderline);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setUnderline(arg.toBoolean());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue setWeight(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
DECLARE_SELF(QFont, setWeight);
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setWeight(arg.toInt32());
|
||||
return arg;
|
||||
}
|
||||
|
||||
static QScriptValue stretch(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, stretch);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setStretch(arg.toInt32());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->stretch());
|
||||
}
|
||||
|
||||
static QScriptValue strikeOut(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, strikeOut);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setStrikeOut(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->strikeOut());
|
||||
}
|
||||
|
||||
static QScriptValue style(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.prototype.style is not implemented");
|
||||
}
|
||||
|
||||
static QScriptValue styleHint(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.prototype.styleHint is not implemented");
|
||||
}
|
||||
|
||||
static QScriptValue styleStrategy(QScriptContext *ctx, QScriptEngine *)
|
||||
{
|
||||
return ctx->throwError("QFont.prototype.styleStrategy is not implemented");
|
||||
}
|
||||
|
||||
static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, toString);
|
||||
@ -345,12 +244,24 @@ static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
|
||||
static QScriptValue underline(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, underline);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setUnderline(arg.toBoolean());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->underline());
|
||||
}
|
||||
|
||||
static QScriptValue weight(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
DECLARE_SELF(QFont, weight);
|
||||
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QScriptValue arg = ctx->argument(0);
|
||||
self->setWeight(arg.toInt32());
|
||||
}
|
||||
|
||||
return QScriptValue(eng, self->weight());
|
||||
}
|
||||
|
||||
@ -359,52 +270,31 @@ QScriptValue constructFontClass(QScriptEngine *eng)
|
||||
QScriptValue proto = qScriptValueFromValue(eng, QFont());
|
||||
QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
|
||||
QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
|
||||
proto.setProperty("bold", eng->newFunction(bold), getter);
|
||||
proto.setProperty("defaultFamily", eng->newFunction(defaultFamily));
|
||||
proto.setProperty("exactMatch", eng->newFunction(exactMatch));
|
||||
proto.setProperty("family", eng->newFunction(family), getter);
|
||||
proto.setProperty("fixedPitch", eng->newFunction(fixedPitch), getter);
|
||||
proto.setProperty("fromString", eng->newFunction(fromString));
|
||||
proto.setProperty("handle", eng->newFunction(handle));
|
||||
proto.setProperty("isCopyOf", eng->newFunction(isCopyOf));
|
||||
proto.setProperty("italic", eng->newFunction(italic), getter);
|
||||
proto.setProperty("kerning", eng->newFunction(kerning), getter);
|
||||
|
||||
proto.setProperty("key", eng->newFunction(key), getter);
|
||||
proto.setProperty("lastResortFamily", eng->newFunction(lastResortFamily));
|
||||
proto.setProperty("lastResortFont", eng->newFunction(lastResortFont));
|
||||
proto.setProperty("overline", eng->newFunction(overline), getter);
|
||||
proto.setProperty("pixelSize", eng->newFunction(pixelSize), getter);
|
||||
proto.setProperty("pointSize", eng->newFunction(pointSize), getter);
|
||||
proto.setProperty("pointSizeF", eng->newFunction(pointSizeF), getter);
|
||||
proto.setProperty("rawMode", eng->newFunction(rawMode), getter);
|
||||
proto.setProperty("rawName", eng->newFunction(rawName), getter);
|
||||
proto.setProperty("lastResortFamily", eng->newFunction(lastResortFamily), getter);
|
||||
proto.setProperty("lastResortFont", eng->newFunction(lastResortFont), getter);
|
||||
proto.setProperty("defaultFamily", eng->newFunction(defaultFamily), getter);
|
||||
proto.setProperty("exactMatch", eng->newFunction(exactMatch), getter);
|
||||
proto.setProperty("toString", eng->newFunction(toString), getter);
|
||||
|
||||
proto.setProperty("bold", eng->newFunction(bold), getter | setter);
|
||||
proto.setProperty("family", eng->newFunction(family), getter|setter);
|
||||
proto.setProperty("fixedPitch", eng->newFunction(fixedPitch), getter);
|
||||
proto.setProperty("fromString", eng->newFunction(fromString), setter);
|
||||
proto.setProperty("italic", eng->newFunction(italic), getter | setter);
|
||||
proto.setProperty("kerning", eng->newFunction(kerning), getter | setter);
|
||||
proto.setProperty("overline", eng->newFunction(overline), getter | setter);
|
||||
proto.setProperty("pixelSize", eng->newFunction(pixelSize), getter | setter);
|
||||
proto.setProperty("pointSize", eng->newFunction(pointSize), getter | setter);
|
||||
proto.setProperty("pointSizeF", eng->newFunction(pointSizeF), getter | setter);
|
||||
proto.setProperty("strikeOut", eng->newFunction(strikeOut), getter | setter);
|
||||
proto.setProperty("stretch", eng->newFunction(stretch), getter | setter);
|
||||
proto.setProperty("underline", eng->newFunction(underline), getter | setter);
|
||||
proto.setProperty("weight", eng->newFunction(weight), getter | setter);
|
||||
|
||||
proto.setProperty("isCopyOf", eng->newFunction(isCopyOf));
|
||||
proto.setProperty("resolve", eng->newFunction(resolve));
|
||||
proto.setProperty("bold", eng->newFunction(setBold), setter);
|
||||
proto.setProperty("bamily", eng->newFunction(setFamily), setter);
|
||||
proto.setProperty("fixedPitch", eng->newFunction(setFixedPitch), setter);
|
||||
proto.setProperty("italic", eng->newFunction(setItalic), setter);
|
||||
proto.setProperty("kerning", eng->newFunction(setKerning), setter);
|
||||
proto.setProperty("overline", eng->newFunction(setOverline), setter);
|
||||
proto.setProperty("pixelSize", eng->newFunction(setPixelSize), setter);
|
||||
proto.setProperty("pointSize", eng->newFunction(setPointSize), setter);
|
||||
proto.setProperty("pointSizeF", eng->newFunction(setPointSizeF), setter);
|
||||
proto.setProperty("rawMode", eng->newFunction(setRawMode), setter);
|
||||
proto.setProperty("rawName", eng->newFunction(setRawName), setter);
|
||||
proto.setProperty("stretch", eng->newFunction(setStretch), setter);
|
||||
proto.setProperty("strikeOut", eng->newFunction(setStrikeOut), setter);
|
||||
proto.setProperty("setStyle", eng->newFunction(setStyle));
|
||||
proto.setProperty("setStyleHint", eng->newFunction(setStyleHint));
|
||||
proto.setProperty("setStyleStrategy", eng->newFunction(setStyleStrategy));
|
||||
proto.setProperty("underline", eng->newFunction(setUnderline), setter);
|
||||
proto.setProperty("weight", eng->newFunction(setWeight), setter);
|
||||
proto.setProperty("stretch", eng->newFunction(stretch), getter);
|
||||
proto.setProperty("strikeOut", eng->newFunction(strikeOut), getter);
|
||||
proto.setProperty("style", eng->newFunction(style));
|
||||
proto.setProperty("styleHint", eng->newFunction(styleHint));
|
||||
proto.setProperty("styleStrategy", eng->newFunction(styleStrategy));
|
||||
proto.setProperty("toString", eng->newFunction(toString));
|
||||
proto.setProperty("underline", eng->newFunction(underline), getter);
|
||||
proto.setProperty("weight", eng->newFunction(weight), getter);
|
||||
|
||||
eng->setDefaultPrototype(qMetaTypeId<QFont>(), proto);
|
||||
eng->setDefaultPrototype(qMetaTypeId<QFont*>(), proto);
|
||||
|
Loading…
x
Reference in New Issue
Block a user