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

kjsembed

point.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 "point.h"
00023 
00024 #include <QtCore/QDebug>
00025 #include <QtCore/QPoint>
00026 
00027 using namespace KJSEmbed;
00028 
00029 const KJS::ClassInfo PointBinding::info = { "QPoint", &VariantBinding::info, 0, 0 };
00030 PointBinding::PointBinding( KJS::ExecState *exec, const QPoint &value )
00031     : VariantBinding(exec, value )
00032 {
00033     StaticBinding::publish( exec, this, Point::methods() );
00034     StaticBinding::publish( exec, this, VariantFactory::methods() );
00035 }
00036 
00037 namespace PointNS
00038 {
00039 
00040 START_VARIANT_METHOD( callisNull, QPoint )
00041     bool cppValue = value.isNull();
00042     result = KJS::jsBoolean(cppValue);
00043 END_VARIANT_METHOD
00044 
00045 START_VARIANT_METHOD( callmanhattanLength, QPoint )
00046     int cppValue = value.manhattanLength();
00047     result = KJS::jsNumber(cppValue);
00048 END_VARIANT_METHOD
00049 
00050 START_VARIANT_METHOD( callrx, QPoint )
00051     int cppValue = value.rx();
00052     result = KJS::jsNumber(cppValue);
00053 END_VARIANT_METHOD
00054 
00055 START_VARIANT_METHOD( callry, QPoint )
00056     int cppValue = value.ry();
00057     result = KJS::jsNumber(cppValue);
00058 END_VARIANT_METHOD
00059 
00060 START_VARIANT_METHOD( callsetX, QPoint )
00061     int arg0 = KJSEmbed::extractInt(exec, args, 0);
00062     value.setX(arg0);
00063 END_VARIANT_METHOD
00064 
00065 START_VARIANT_METHOD( callsetY, QPoint )
00066     int arg0 = KJSEmbed::extractInt(exec, args, 0);
00067     value.setY(arg0);
00068 END_VARIANT_METHOD
00069 
00070 START_VARIANT_METHOD( callx, QPoint )
00071     int cppValue = value.x();
00072     result = KJS::jsNumber(cppValue);
00073 END_VARIANT_METHOD
00074 
00075 START_VARIANT_METHOD( cally, QPoint )
00076     int cppValue = value.y();
00077     result = KJS::jsNumber(cppValue);
00078 END_VARIANT_METHOD
00079 
00080 }
00081 
00082 START_METHOD_LUT( Point )
00083     {"isNull", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callisNull},
00084     {"manhattanLength", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callmanhattanLength},
00085     {"rx", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callrx},
00086     {"ry", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callry},
00087     {"setX", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callsetX},
00088     {"setY", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callsetY},
00089     {"x", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callx},
00090     {"y", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::cally}
00091 END_METHOD_LUT
00092 
00093 NO_ENUMS( Point )
00094 NO_STATICS( Point )
00095 
00096 START_CTOR( Point, QPoint, 0 )
00097     if( args.size() == 2 )
00098     {
00099         return new KJSEmbed::PointBinding(exec,
00100                                 QPoint( KJSEmbed::extractInt( exec, args, 0 ),
00101                                         KJSEmbed::extractInt( exec, args, 1 )
00102                                         ) );
00103     }
00104 
00105     return new KJSEmbed::PointBinding( exec, QPoint() );
00106 END_CTOR
00107 
00108 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
00109 

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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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