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

kjsembed

  • sources
  • kde-4.12
  • kdelibs
  • kjsembed
  • kjsembed
point.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
3  Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
4  Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
5  Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #include "point.h"
23 
24 #include <QtCore/QDebug>
25 #include <QtCore/QPoint>
26 
27 using namespace KJSEmbed;
28 
29 const KJS::ClassInfo PointBinding::info = { "QPoint", &VariantBinding::info, 0, 0 };
30 PointBinding::PointBinding( KJS::ExecState *exec, const QPoint &value )
31  : VariantBinding(exec, value )
32 {
33  StaticBinding::publish( exec, this, Point::methods() );
34  StaticBinding::publish( exec, this, VariantFactory::methods() );
35 }
36 
37 namespace PointNS
38 {
39 
40 START_VARIANT_METHOD( callisNull, QPoint )
41  bool cppValue = value.isNull();
42  result = KJS::jsBoolean(cppValue);
43 END_VARIANT_METHOD
44 
45 START_VARIANT_METHOD( callmanhattanLength, QPoint )
46  int cppValue = value.manhattanLength();
47  result = KJS::jsNumber(cppValue);
48 END_VARIANT_METHOD
49 
50 START_VARIANT_METHOD( callrx, QPoint )
51  int cppValue = value.rx();
52  result = KJS::jsNumber(cppValue);
53 END_VARIANT_METHOD
54 
55 START_VARIANT_METHOD( callry, QPoint )
56  int cppValue = value.ry();
57  result = KJS::jsNumber(cppValue);
58 END_VARIANT_METHOD
59 
60 START_VARIANT_METHOD( callsetX, QPoint )
61  int arg0 = KJSEmbed::extractInt(exec, args, 0);
62  value.setX(arg0);
63 END_VARIANT_METHOD
64 
65 START_VARIANT_METHOD( callsetY, QPoint )
66  int arg0 = KJSEmbed::extractInt(exec, args, 0);
67  value.setY(arg0);
68 END_VARIANT_METHOD
69 
70 START_VARIANT_METHOD( callx, QPoint )
71  int cppValue = value.x();
72  result = KJS::jsNumber(cppValue);
73 END_VARIANT_METHOD
74 
75 START_VARIANT_METHOD( cally, QPoint )
76  int cppValue = value.y();
77  result = KJS::jsNumber(cppValue);
78 END_VARIANT_METHOD
79 
80 }
81 
82 START_METHOD_LUT( Point )
83  {"isNull", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callisNull},
84  {"manhattanLength", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callmanhattanLength},
85  {"rx", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callrx},
86  {"ry", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callry},
87  {"setX", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callsetX},
88  {"setY", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callsetY},
89  {"x", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::callx},
90  {"y", 0, KJS::DontDelete|KJS::ReadOnly, &PointNS::cally}
91 END_METHOD_LUT
92 
93 NO_ENUMS( Point )
94 NO_STATICS( Point )
95 
96 START_CTOR( Point, QPoint, 0 )
97  if( args.size() == 2 )
98  {
99  return new KJSEmbed::PointBinding(exec,
100  QPoint( KJSEmbed::extractInt( exec, args, 0 ),
101  KJSEmbed::extractInt( exec, args, 1 )
102  ) );
103  }
104 
105  return new KJSEmbed::PointBinding( exec, QPoint() );
106 END_CTOR
107 
108 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
109 
KJSEmbed::PointBinding
Definition: point.h:35
KJSEmbed::VariantBinding::info
static const KJS::ClassInfo info
Definition: variant_binding.h:123
KJSEmbed::PointBinding::PointBinding
PointBinding(KJS::ExecState *exec, const QPoint &value)
Definition: point.cpp:30
KJSEmbed::StaticBinding::publish
static void publish(KJS::ExecState *exec, KJS::JSObject *object, const Method *methods)
Publishes an array of Methods to an object.
Definition: static_binding.cpp:60
KJSEmbed::VariantBinding
QVariant based binding.
Definition: variant_binding.h:88
point.h
END_CTOR
#define END_CTOR
Definition: binding_support.h:166
PointNS::setY
value setY(arg0)
KJSEmbed::extractInt
int KJSEMBED_EXPORT extractInt(KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue=0)
Extracts an integer from an argument list.
Definition: binding_support.cpp:72
DomDocumentNS::if
if(!success)
Definition: dom.cpp:363
WidgetNS::x
int x
Definition: qwidget_binding.cpp:71
START_CTOR
#define START_CTOR(TYPE, JSNAME, ARGS)
Definition: binding_support.h:157
KJSEmbed::PointBinding::info
static const KJS::ClassInfo info
Definition: point.h:40
NO_ENUMS
#define NO_ENUMS(TYPE)
Definition: binding_support.h:147
WidgetNS::y
int y
Definition: qwidget_binding.cpp:71
END_METHOD_LUT
#define END_METHOD_LUT
Definition: binding_support.h:135
PointNS::result
result
Definition: point.cpp:42
KJSEmbed::VariantFactory::methods
static const Method * methods()
Definition: variant_binding.h:251
cppValue
END_OBJECT_METHOD QBrush cppValue
Definition: qpainter_binding.cpp:97
END_VARIANT_METHOD
#define END_VARIANT_METHOD
End a variant method started by START_VARIANT_METHOD.
Definition: variant_binding.h:56
arg0
END_OBJECT_METHOD QPolygon arg0
Definition: qpainter_binding.cpp:179
START_METHOD_LUT
START_METHOD_LUT(Point)
Definition: point.cpp:82
START_VARIANT_METHOD
#define START_VARIANT_METHOD(METHODNAME, TYPE)
A simple variant syle method.
Definition: variant_binding.h:42
value
QVariant value
Definition: settings.cpp:35
NO_STATICS
#define NO_STATICS(TYPE)
Definition: binding_support.h:153
PointNS::setX
value setX(arg0)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kjsembed

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal