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

KJSEmbed

bind_qlcdnumber.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 "bind_qlcdnumber.h"
00023 
00024 #include <QtCore/QDebug>
00025 
00026 #include "object_binding.h"
00027 #include "variant_binding.h"
00028 #include <kjs/object.h>
00029 
00030 using namespace KJSEmbed;
00031 
00032 namespace LCDNumberNS {
00033 
00034 START_QOBJECT_METHOD( checkOverflow, QLCDNumber )
00035     double arg0 = KJSEmbed::extractDouble( exec, args, 0 );
00036     bool b = object->checkOverflow( arg0 );
00037     result = KJS::jsBoolean( b );
00038 END_QOBJECT_METHOD
00039 
00040 START_QOBJECT_METHOD( intValue, QLCDNumber )
00041     int i = object->intValue();
00042     result = KJS::jsNumber( i );
00043 END_QOBJECT_METHOD
00044 
00045 START_QOBJECT_METHOD( mode, QLCDNumber )
00046     int i = (int) object->mode();
00047     result = KJS::jsNumber( i );
00048 END_QOBJECT_METHOD
00049 
00050 START_QOBJECT_METHOD( numDigits, QLCDNumber )
00051     int i = (int) object->numDigits();
00052     result = KJS::jsNumber( i );
00053 END_QOBJECT_METHOD
00054 
00055 START_QOBJECT_METHOD( segmentStyle, QLCDNumber )
00056     int i = (int) object->segmentStyle();
00057     result = KJS::jsNumber( i );
00058 END_QOBJECT_METHOD
00059 
00060 START_QOBJECT_METHOD( setMode, QLCDNumber )
00061     int arg0 = KJSEmbed::extractInt( exec, args, 0 );
00062     object->setMode( (QLCDNumber::Mode) arg0 );
00063 END_QOBJECT_METHOD
00064 
00065 START_QOBJECT_METHOD( setNumDigits, QLCDNumber )
00066     int arg0 = KJSEmbed::extractInt( exec, args, 0 );
00067     object->setNumDigits( arg0 );
00068 END_QOBJECT_METHOD
00069 
00070 START_QOBJECT_METHOD( setSegmentStyle, QLCDNumber )
00071     int arg0 = KJSEmbed::extractInt( exec, args, 0 );
00072     object->setSegmentStyle( (QLCDNumber::SegmentStyle) arg0 );
00073 END_QOBJECT_METHOD
00074 
00075 START_QOBJECT_METHOD( smallDecimalPoint, QLCDNumber )
00076     bool b = object->smallDecimalPoint();
00077     result = KJS::jsBoolean( b );
00078 END_QOBJECT_METHOD
00079 
00080 START_QOBJECT_METHOD( value, QLCDNumber )
00081     double d = object->value();
00082     result = KJS::jsNumber( d );
00083 END_QOBJECT_METHOD
00084 
00085 START_QOBJECT_METHOD( display, QLCDNumber )
00086     qDebug() << "reached the custom function";
00087     // Overload on type
00088     if ( args[0]->type() == KJS::NumberType ) {
00089         double d = extractDouble( exec, args, 0 );
00090         object->display( d );
00091     }
00092     else {
00093         QString s = extractQString( exec, args, 0 );
00094         object->display( s );
00095     }
00096 END_QOBJECT_METHOD
00097 
00098 }
00099 
00100 NO_ENUMS( LCDNumber )
00101 
00102 START_METHOD_LUT( LCDNumber )
00103     {"checkOverflow", 1, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::checkOverflow },
00104     {"intValue", 0, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::intValue },
00105     {"mode", 0, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::mode },
00106     {"numDigits", 0, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::numDigits },
00107     {"segmentStyle", 0, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::segmentStyle },
00108     {"setMode", 1, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::setMode },
00109     {"setNumDigits", 1, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::setNumDigits },
00110     {"setSegmentStyle", 1, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::setSegmentStyle },
00111     {"smallDecimalPoint", 1, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::smallDecimalPoint },
00112     {"value", 0, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::value },
00113     {"display", 1, KJS::DontDelete|KJS::ReadOnly, &LCDNumberNS::display }
00114 END_METHOD_LUT
00115 
00116 NO_STATICS( LCDNumber )
00117 
00118 KJSO_SIMPLE_BINDING_CTOR( LCDNumber, QLCDNumber, QWidgetBinding )
00119 KJSO_QOBJECT_BIND( LCDNumber, QLCDNumber )
00120 
00121 KJSO_START_CTOR( LCDNumber, QLCDNumber, 0 )
00122     KJSEmbed::QObjectBinding *obj = 0;
00123     if ( args.size() < 2 )
00124     {
00125         QWidget *parent = KJSEmbed::extractObject<QWidget>( exec, args, 0, 0 );
00126         QLCDNumber *lcd = new QLCDNumber( parent );
00127         obj = new KJSEmbed::QObjectBinding( exec, lcd );
00128     }
00129     else if ( args.size() < 3 )
00130     {
00131         uint arg0 = KJSEmbed::extractInt( exec, args, 0 );
00132         QWidget *parent = KJSEmbed::extractObject<QWidget>( exec, args, 1, 0 );
00133         QLCDNumber *lcd = new QLCDNumber( arg0, parent );
00134         obj = new KJSEmbed::QObjectBinding( exec, lcd );
00135     }
00136 
00137     return obj;
00138 KJSO_END_CTOR
00139 
00140 
00141 //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
  • Related Pages

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
  •   WTF
  • KJSEmbed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  •   core
  • Phonon
  •   Backend
  • 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