khtml Library API Documentation

kjs_proxy.h

00001 // -*- c-basic-offset: 2 -*-
00002 /*
00003  *  This file is part of the KDE libraries
00004  *  Copyright (C) 1999 Harri Porten (porten@kde.org)
00005  *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
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
00018  *  License along with this library; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  */
00021 
00022 #ifndef _KJS_PROXY_H_
00023 #define _KJS_PROXY_H_
00024 
00025 #include <qvariant.h>
00026 #include <qstring.h>
00027 #include <sys/time.h>
00028 
00029 class KHTMLPart;
00030 class KJSDebugWin;
00031 
00032 namespace DOM {
00033   class Node;
00034   class EventListener;
00035   class Event;
00036 }
00037 
00038 namespace KJS {
00039   class List;
00040   class Interpreter;
00041   class Completion;
00042 }
00043 
00049 class KJSProxy {
00050 public:
00051   KJSProxy() { m_handlerLineno = 0; }
00052   virtual ~KJSProxy() { }
00053   virtual QVariant evaluate(QString filename, int baseLine, const QString &, const DOM::Node &n,
00054                             KJS::Completion *completion = 0) = 0;
00055   virtual void clear() = 0;
00056   virtual DOM::EventListener *createHTMLEventHandler(QString sourceUrl, QString code) = 0;
00057   virtual void finishedWithEvent(const DOM::Event &event) = 0;
00058   virtual KJS::Interpreter *interpreter() = 0;
00059 
00060   virtual void setDebugEnabled(bool enabled) = 0;
00061   virtual bool paused() const = 0;
00062   virtual void setSourceFile(QString url, QString code) = 0;
00063   virtual void appendSourceFile(QString url, QString code) = 0;
00064 
00065   void setEventHandlerLineno(int lineno) { m_handlerLineno = lineno; }
00066 
00067   KHTMLPart *m_part;
00068   int m_handlerLineno;
00069 
00070   // Helper method, to access the private KHTMLPart::jScript()
00071   static KJSProxy *proxy( KHTMLPart *part );
00072 };
00073 
00074 class KJSCPUGuard {
00075 public:
00076   KJSCPUGuard() {}
00077   void start(unsigned int msec=5000, unsigned int i_msec=10000);
00078   void stop();
00079 private:
00080   void (*oldAlarmHandler)(int);
00081   static void alarmHandler(int);
00082   itimerval oldtv; 
00083 };
00084 
00085 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:34:24 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001