• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

kjsembed

font.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
00003     Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
00004     Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
00005     Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #include "font.h"
00023 
00024 #include <QtCore/QDebug>
00025 #include <QtGui/QFont>
00026 #include <QtCore/QStringList>
00027 using namespace KJSEmbed;
00028 
00029 const KJS::ClassInfo FontBinding::info = { "QFont", &VariantBinding::info, 0, 0 };
00030 FontBinding::FontBinding( KJS::ExecState *exec, const QFont &value )
00031     : VariantBinding(exec, value )
00032 {
00033     StaticBinding::publish( exec, this, Font::methods() );
00034     StaticBinding::publish( exec, this, VariantFactory::methods() );
00035 }
00036 
00037 namespace FontNS
00038 {
00039 
00040 START_VARIANT_METHOD( callbold, QFont )
00041     bool cppValue = value.bold();
00042     result = KJS::jsBoolean(cppValue);
00043 END_VARIANT_METHOD
00044 
00045 START_VARIANT_METHOD( callexactMatch, QFont )
00046     bool cppValue = value.exactMatch();
00047     result = KJS::jsBoolean(cppValue);
00048 END_VARIANT_METHOD
00049 
00050 START_VARIANT_METHOD( callfamily, QFont )
00051     QString cppValue = value.family();
00052     result = KJS::jsString( cppValue );
00053 END_VARIANT_METHOD
00054 
00055 START_VARIANT_METHOD( callfixedPitch, QFont )
00056     bool cppValue = value.fixedPitch();
00057     result = KJS::jsBoolean(cppValue);
00058 END_VARIANT_METHOD
00059 
00060 START_VARIANT_METHOD( callfromString, QFont )
00061     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00062     bool cppValue = value.fromString(arg0);
00063     result = KJS::jsBoolean(cppValue);
00064 END_VARIANT_METHOD
00065 
00066 START_VARIANT_METHOD( callinsertSubstitution, QFont )
00067     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00068     QString arg1 = KJSEmbed::extractQString(exec, args, 1);
00069     value.insertSubstitution(arg0, arg1);
00070 END_VARIANT_METHOD
00071 
00072 START_VARIANT_METHOD( callinsertSubstitutions, QFont )
00073     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00074     QStringList arg1 = KJSEmbed::extractQStringList(exec,args, 1);
00075     value.insertSubstitutions(arg0, arg1);
00076 END_VARIANT_METHOD
00077 
00078 START_VARIANT_METHOD( callisCopyOf, QFont )
00079     QFont arg0 = KJSEmbed::extractVariant<QFont>(exec,args, 0);
00080     bool cppValue = value.isCopyOf(arg0);
00081     result = KJS::jsBoolean(cppValue);
00082 END_VARIANT_METHOD
00083 
00084 START_VARIANT_METHOD( callitalic, QFont )
00085     bool cppValue = value.italic();
00086     result = KJS::jsBoolean(cppValue);
00087 END_VARIANT_METHOD
00088 
00089 START_VARIANT_METHOD( callkerning, QFont )
00090     bool cppValue = value.kerning();
00091     result = KJS::jsBoolean(cppValue);
00092 END_VARIANT_METHOD
00093 
00094 START_VARIANT_METHOD( callkey, QFont )
00095     QString cppValue = value.key();
00096     result = KJS::jsString( cppValue );
00097 END_VARIANT_METHOD
00098 
00099 START_VARIANT_METHOD( calllastResortFamily, QFont )
00100     QString cppValue = value.lastResortFamily();
00101     result = KJS::jsString( cppValue );
00102 END_VARIANT_METHOD
00103 
00104 START_VARIANT_METHOD( calllastResortFont, QFont )
00105     QString cppValue = value.lastResortFont();
00106     result = KJS::jsString( cppValue );
00107 END_VARIANT_METHOD
00108 
00109 START_VARIANT_METHOD( calloverline, QFont )
00110     bool cppValue = value.overline();
00111     result = KJS::jsBoolean(cppValue);
00112 END_VARIANT_METHOD
00113 
00114 START_VARIANT_METHOD( callpixelSize, QFont )
00115     int cppValue = value.pixelSize();
00116     result = KJS::jsNumber(cppValue);
00117 END_VARIANT_METHOD
00118 
00119 START_VARIANT_METHOD( callpointSize, QFont )
00120     int cppValue = value.pointSize();
00121     result = KJS::jsNumber(cppValue);
00122 END_VARIANT_METHOD
00123 
00124 START_VARIANT_METHOD( callrawMode, QFont )
00125     bool cppValue = value.rawMode();
00126     result = KJS::jsBoolean(cppValue);
00127 END_VARIANT_METHOD
00128 
00129 START_VARIANT_METHOD( callrawName, QFont )
00130     QString cppValue = value.rawName();
00131     result = KJS::jsString( cppValue );
00132 END_VARIANT_METHOD
00133 
00134 START_VARIANT_METHOD( callremoveSubstitution, QFont )
00135     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00136     value.removeSubstitution(arg0);
00137 END_VARIANT_METHOD
00138 
00139 START_VARIANT_METHOD( callresolve, QFont )
00140     QFont arg0 = KJSEmbed::extractVariant<QFont>(exec,args, 0);
00141     QFont cppValue = value.resolve(arg0);
00142     result = KJSEmbed::createVariant(exec, "QFont", cppValue );
00143 END_VARIANT_METHOD
00144 
00145 START_VARIANT_METHOD( callsetBold, QFont )
00146     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00147     value.setBold(arg0);
00148 END_VARIANT_METHOD
00149 
00150 START_VARIANT_METHOD( callsetFamily, QFont )
00151     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00152     value.setFamily(arg0);
00153 END_VARIANT_METHOD
00154 
00155 START_VARIANT_METHOD( callsetFixedPitch, QFont )
00156     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00157     value.setFixedPitch(arg0);
00158 END_VARIANT_METHOD
00159 
00160 START_VARIANT_METHOD( callsetItalic, QFont )
00161     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00162     value.setItalic(arg0);
00163 END_VARIANT_METHOD
00164 
00165 START_VARIANT_METHOD( callsetKerning, QFont )
00166     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00167     value.setKerning(arg0);
00168 END_VARIANT_METHOD
00169 
00170 START_VARIANT_METHOD( callsetOverline, QFont )
00171     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00172     value.setOverline(arg0);
00173 END_VARIANT_METHOD
00174 
00175 START_VARIANT_METHOD( callsetPixelSize, QFont )
00176     int arg0 = KJSEmbed::extractInt(exec, args, 0);
00177     value.setPixelSize(arg0);
00178 END_VARIANT_METHOD
00179 
00180 START_VARIANT_METHOD( callsetPointSize, QFont )
00181     int arg0 = KJSEmbed::extractInt(exec, args, 0);
00182     value.setPointSize(arg0);
00183 END_VARIANT_METHOD
00184 
00185 START_VARIANT_METHOD( callsetRawMode, QFont )
00186     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00187     value.setRawMode(arg0);
00188 END_VARIANT_METHOD
00189 
00190 START_VARIANT_METHOD( callsetRawName, QFont )
00191     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00192     value.setRawName(arg0);
00193 END_VARIANT_METHOD
00194 
00195 START_VARIANT_METHOD( callsetStretch, QFont )
00196     int arg0 = KJSEmbed::extractInt(exec, args, 0);
00197     value.setStretch(arg0);
00198 END_VARIANT_METHOD
00199 
00200 START_VARIANT_METHOD( callsetStrikeOut, QFont )
00201     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00202     value.setStrikeOut(arg0);
00203 END_VARIANT_METHOD
00204 
00205 START_VARIANT_METHOD( callsetStyle, QFont )
00206     QFont::Style arg0 = (QFont::Style) KJSEmbed::extractInt(exec, args, 0);
00207     value.setStyle(arg0);
00208 END_VARIANT_METHOD
00209 
00210 START_VARIANT_METHOD( callsetStyleHint, QFont )
00211     QFont::StyleHint arg0  = (QFont::StyleHint) KJSEmbed::extractInt(exec, args, 0);
00212     QFont::StyleStrategy arg1  = (QFont::StyleStrategy) KJSEmbed::extractInt(exec, args, 1);
00213     value.setStyleHint(arg0, arg1);
00214 END_VARIANT_METHOD
00215 
00216 START_VARIANT_METHOD( callsetStyleStrategy, QFont )
00217     QFont::StyleStrategy arg0  = (QFont::StyleStrategy) KJSEmbed::extractInt(exec, args, 0);
00218     value.setStyleStrategy(arg0);
00219 END_VARIANT_METHOD
00220 
00221 START_VARIANT_METHOD( callsetUnderline, QFont )
00222     bool arg0 = KJSEmbed::extractBool(exec, args, 0);
00223     value.setUnderline(arg0);
00224 END_VARIANT_METHOD
00225 
00226 START_VARIANT_METHOD( callsetWeight, QFont )
00227     int arg0 = KJSEmbed::extractInt(exec, args, 0);
00228     value.setWeight(arg0);
00229 END_VARIANT_METHOD
00230 
00231 START_VARIANT_METHOD( callstretch, QFont )
00232     int cppValue = value.stretch();
00233     result = KJS::jsNumber(cppValue);
00234 END_VARIANT_METHOD
00235 
00236 START_VARIANT_METHOD( callstrikeOut, QFont )
00237     bool cppValue = value.strikeOut();
00238     result = KJS::jsBoolean(cppValue);
00239 END_VARIANT_METHOD
00240 
00241 START_VARIANT_METHOD( callstyle, QFont )
00242     QFont::Style cppValue = value.style();
00243     result = KJS::jsNumber(cppValue);
00244 END_VARIANT_METHOD
00245 
00246 START_VARIANT_METHOD( callstyleHint, QFont )
00247     QFont::StyleHint cppValue = value.styleHint();
00248     result = KJS::jsNumber(cppValue);
00249 END_VARIANT_METHOD
00250 
00251 START_VARIANT_METHOD( callstyleStrategy, QFont )
00252     QFont::StyleStrategy cppValue = value.styleStrategy();
00253     result = KJS::jsNumber(cppValue);
00254 END_VARIANT_METHOD
00255 
00256 START_VARIANT_METHOD( callsubstitute, QFont )
00257     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00258     QString cppValue = value.substitute(arg0);
00259     result = KJS::jsString( cppValue );
00260 END_VARIANT_METHOD
00261 
00262 START_VARIANT_METHOD( callsubstitutes, QFont )
00263     QString arg0 = KJSEmbed::extractQString(exec, args, 0);
00264     QStringList cppValue = value.substitutes(arg0);
00265     result = KJSEmbed::createQStringList(exec, cppValue );
00266 END_VARIANT_METHOD
00267 
00268 START_VARIANT_METHOD( callsubstitutions, QFont )
00269     QStringList cppValue = value.substitutions();
00270     result = KJSEmbed::createQStringList(exec, cppValue );
00271 END_VARIANT_METHOD
00272 
00273 START_VARIANT_METHOD( calltoString, QFont )
00274     QString cppValue = value.toString();
00275     result = KJS::jsString( cppValue );
00276 END_VARIANT_METHOD
00277 
00278 START_VARIANT_METHOD( callunderline, QFont )
00279     bool cppValue = value.underline();
00280     result = KJS::jsBoolean(cppValue);
00281 END_VARIANT_METHOD
00282 
00283 START_VARIANT_METHOD( callweight, QFont )
00284     int cppValue = value.weight();
00285     result = KJS::jsNumber(cppValue);
00286 END_VARIANT_METHOD
00287 }
00288 
00289 START_METHOD_LUT( Font )
00290     {"bold", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callbold},
00291     {"exactMatch", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callexactMatch},
00292     {"family", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callfamily},
00293     {"fixedPitch", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callfixedPitch},
00294     {"fromString", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callfromString},
00295     {"insertSubstitution", 1, KJS::DontDelete|KJS::ReadOnly, &FontNS::callinsertSubstitution},
00296     {"insertSubstitutions", 1, KJS::DontDelete|KJS::ReadOnly, &FontNS::callinsertSubstitutions},
00297     {"isCopyOf", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callisCopyOf},
00298     {"italic", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callitalic},
00299     {"kerning", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callkerning},
00300     {"key", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callkey},
00301     {"lastResortFamily", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::calllastResortFamily},
00302     {"lastResortFont", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::calllastResortFont},
00303     {"overline", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::calloverline},
00304     {"pixelSize", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callpixelSize},
00305     {"pointSize", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callpointSize},
00306     {"rawMode", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callrawMode},
00307     {"rawName", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callrawName},
00308     {"removeSubstitution", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callremoveSubstitution},
00309     {"resolve", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callresolve},
00310     {"setBold", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetBold},
00311     {"setFamily", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetFamily},
00312     {"setFixedPitch", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetFixedPitch},
00313     {"setItalic", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetItalic},
00314     {"setKerning", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetKerning},
00315     {"setOverline", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetOverline},
00316     {"setPixelSize", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetPixelSize},
00317     {"setPointSize", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetPointSize},
00318     {"setRawMode", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetRawMode},
00319     {"setRawName", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetRawName},
00320     {"setStretch", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetStretch},
00321     {"setStrikeOut", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetStrikeOut},
00322     {"setStyle", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetStyle},
00323     {"setStyleHint", 1, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetStyleHint},
00324     {"setStyleStrategy", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetStyleStrategy},
00325     {"setUnderline", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetUnderline},
00326     {"setWeight", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsetWeight},
00327     {"stretch", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callstretch},
00328     {"strikeOut", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callstrikeOut},
00329     {"style", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callstyle},
00330     {"styleHint", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callstyleHint},
00331     {"styleStrategy", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callstyleStrategy},
00332     {"substitute", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsubstitute},
00333     {"substitutes", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsubstitutes},
00334     {"substitutions", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callsubstitutions},
00335     {"toString", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::calltoString},
00336     {"underline", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callunderline},
00337     {"weight", 0, KJS::DontDelete|KJS::ReadOnly, &FontNS::callweight}
00338 END_METHOD_LUT
00339 
00340 NO_ENUMS( Font )
00341 NO_STATICS( Font )
00342 
00343 START_CTOR( Font, QFont, 0)
00344     if( args.size() == 0 )
00345     {
00346         return new KJSEmbed::FontBinding( exec, QFont() );
00347     }
00348     return new KJSEmbed::FontBinding( exec, QFont() );
00349 END_CTOR
00350 
00351 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;

kjsembed

Skip menu "kjsembed"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal