27 using namespace KJSEmbed;
29 const KJS::ClassInfo ColorBinding::info = {
"QColor", &VariantBinding::info,
nullptr,
nullptr };
37 START_VARIANT_METHOD(callSetAlpha,
QColor)
38 value.setAlpha(KJSEmbed::extractInt(exec, args, 0));
41 START_VARIANT_METHOD(callSetBlue,
QColor)
42 value.setBlue(KJSEmbed::extractInt(exec, args, 0));
45 START_VARIANT_METHOD(callSetGreen,
QColor)
46 value.setGreen(KJSEmbed::extractInt(exec, args, 0));
49 START_VARIANT_METHOD(callSetRed,
QColor)
50 value.setRed(KJSEmbed::extractInt(exec, args, 0));
53 START_VARIANT_METHOD(callSetRgb,
QColor)
54 value.setRgb(KJSEmbed::extractInt(exec, args, 0),
55 KJSEmbed::extractInt(exec, args, 1),
56 KJSEmbed::extractInt(exec, args, 2),
57 KJSEmbed::extractInt(exec, args, 3, 255));
60 START_VARIANT_METHOD(callSetCmyk,
QColor)
61 value.setCmyk(KJSEmbed::extractInt(exec, args, 0),
62 KJSEmbed::extractInt(exec, args, 1),
63 KJSEmbed::extractInt(exec, args, 2),
64 KJSEmbed::extractInt(exec, args, 3),
65 KJSEmbed::extractInt(exec, args, 4, 255));
68 START_VARIANT_METHOD(callSetHsv,
QColor)
69 value.setHsv(KJSEmbed::extractInt(exec, args, 0),
70 KJSEmbed::extractInt(exec, args, 1),
71 KJSEmbed::extractInt(exec, args, 2),
72 KJSEmbed::extractInt(exec, args, 3, 255));
75 START_VARIANT_METHOD(callSetNamedColor,
QColor)
76 value.setNamedColor(KJSEmbed::extractQString(exec, args, 0));
79 START_VARIANT_METHOD(callAlpha,
QColor)
80 value.setAlpha(KJSEmbed::extractInt(exec, args, 0));
83 START_VARIANT_METHOD(callBlue,
QColor)
84 result = KJSEmbed::createInt(exec, value.blue());
87 START_VARIANT_METHOD(callCyan,
QColor)
88 result = KJSEmbed::createInt(exec, value.cyan());
91 START_VARIANT_METHOD(callGreen,
QColor)
92 result = KJSEmbed::createInt(exec, value.green());
95 START_VARIANT_METHOD(callHue,
QColor)
96 result = KJSEmbed::createInt(exec, value.hue());
99 START_VARIANT_METHOD(callMagenta,
QColor)
100 result = KJSEmbed::createInt(exec, value.magenta());
103 START_VARIANT_METHOD(callRed,
QColor)
104 result = KJSEmbed::createInt(exec, value.red());
107 START_VARIANT_METHOD(callYellow,
QColor)
108 result = KJSEmbed::createInt(exec, value.yellow());
111 START_VARIANT_METHOD(callSaturation,
QColor)
112 result = KJSEmbed::createInt(exec, value.saturation());
115 START_VARIANT_METHOD(callDark,
QColor)
116 QColor darkColor = value.darker(KJSEmbed::extractInt(exec, args, 0, 200));
117 result = KJSEmbed::createVariant(exec,
"QColor", darkColor);
120 START_VARIANT_METHOD(callLight,
QColor)
121 QColor darkColor = value.lighter(KJSEmbed::extractInt(exec, args, 0, 200));
122 result = KJSEmbed::createVariant(exec,
"QColor", darkColor);
125 START_VARIANT_METHOD(callConvertTo,
QColor)
126 QColor otherColor = value.convertTo((
QColor::Spec)KJSEmbed::extractInt(exec, args, 0));
127 result = KJSEmbed::createVariant(exec,
"QColor", otherColor);
130 START_VARIANT_METHOD(callSpec,
QColor)
131 result = KJS::jsNumber(value.spec());
134 START_METHOD_LUT(Color)
135 {
"setAlpha", 1, KJS::DontDelete | KJS::ReadOnly, &callSetAlpha},
136 {
"setBlue", 1, KJS::DontDelete | KJS::ReadOnly, &callSetBlue},
137 {
"setGreen", 1, KJS::DontDelete | KJS::ReadOnly, &callSetGreen},
138 {
"setRed", 1, KJS::DontDelete | KJS::ReadOnly, &callSetRed},
139 {
"setRgb", 4, KJS::DontDelete | KJS::ReadOnly, &callSetRgb},
140 {
"setCmyk", 5, KJS::DontDelete | KJS::ReadOnly, &callSetCmyk},
141 {
"setHsv", 4, KJS::DontDelete | KJS::ReadOnly, &callSetHsv},
142 {
"setNamedColor", 1, KJS::DontDelete | KJS::ReadOnly, &callSetNamedColor},
143 {
"alpha", 0, KJS::DontDelete | KJS::ReadOnly, &callAlpha},
144 {
"blue", 0, KJS::DontDelete | KJS::ReadOnly, &callBlue},
145 {
"cyan", 0, KJS::DontDelete | KJS::ReadOnly, &callCyan},
146 {
"green", 0, KJS::DontDelete | KJS::ReadOnly, &callGreen},
147 {
"hue", 0, KJS::DontDelete | KJS::ReadOnly, &callHue},
148 {
"magenta", 0, KJS::DontDelete | KJS::ReadOnly, &callMagenta},
149 {
"red", 0, KJS::DontDelete | KJS::ReadOnly, &callRed},
150 {
"saturation", 0, KJS::DontDelete | KJS::ReadOnly, &callSaturation},
151 {
"yellow", 0, KJS::DontDelete | KJS::ReadOnly, &callYellow},
152 {
"light", 1, KJS::DontDelete | KJS::ReadOnly, &callLight},
153 {
"dark", 1, KJS::DontDelete | KJS::ReadOnly, &callDark},
154 {
"convertTo", 1, KJS::DontDelete | KJS::ReadOnly, &callConvertTo},
155 {
"spec", 0, KJS::DontDelete | KJS::ReadOnly, &callSpec}
158 START_ENUM_LUT(Color)
167 START_CTOR(Color,
QColor, 0)
168 if (args.size() == 1)
171 }
else if (args.size() >= 3)
174 QColor(KJSEmbed::extractInt(exec, args, 0),
175 KJSEmbed::extractInt(exec, args, 1),
176 KJSEmbed::extractInt(exec, args, 2)));
179 if (args.size() == 4)
182 QColor(KJSEmbed::extractInt(exec, args, 0),
183 KJSEmbed::extractInt(exec, args, 1),
184 KJSEmbed::extractInt(exec, args, 2),
185 KJSEmbed::extractInt(exec, args, 3)));