summaryrefslogtreecommitdiffstats
path: root/tdehtml/rendering/render_applet.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:21 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:21 -0600
commitdfe289850f068f19ba4a83ab4e7e22a7e09c13c9 (patch)
treec297348a55df66c571de4525646e0b9762427353 /tdehtml/rendering/render_applet.cpp
parentb7658a0d5eca24a9d37c6e04f88298ef02389db0 (diff)
downloadtdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.tar.gz
tdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdehtml/rendering/render_applet.cpp')
-rw-r--r--tdehtml/rendering/render_applet.cpp145
1 files changed, 145 insertions, 0 deletions
diff --git a/tdehtml/rendering/render_applet.cpp b/tdehtml/rendering/render_applet.cpp
new file mode 100644
index 000000000..1b65ca8de
--- /dev/null
+++ b/tdehtml/rendering/render_applet.cpp
@@ -0,0 +1,145 @@
+/**
+ * This file is part of the HTML widget for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include <config.h>
+#include <klocale.h>
+
+#include <kdebug.h>
+
+#include "rendering/render_applet.h"
+#include "rendering/render_canvas.h"
+#include "xml/dom_docimpl.h"
+#include "tdehtmlview.h"
+#include "tdehtml_part.h"
+
+#include <tqlabel.h>
+
+#ifndef Q_WS_QWS // We don't have Java in Qt Embedded
+
+#include "java/kjavaappletwidget.h"
+#include "misc/htmltags.h"
+#include "html/html_objectimpl.h"
+
+using namespace tdehtml;
+using namespace DOM;
+
+RenderApplet::RenderApplet(HTMLElementImpl *applet, const TQMap<TQString, TQString> &args )
+ : RenderWidget(applet)
+{
+ // init RenderObject attributes
+ setInline(true);
+
+ KJavaAppletContext *context = 0;
+ KHTMLView *_view = applet->getDocument()->view();
+ if ( _view ) {
+ KHTMLPart *part = _view->part();
+ context = part->createJavaContext();
+ }
+
+ if ( context ) {
+ //kdDebug(6100) << "RenderApplet::RenderApplet, setting TQWidget" << endl;
+ setQWidget( new KJavaAppletWidget(context, _view->viewport()) );
+ processArguments(args);
+ }
+}
+
+RenderApplet::~RenderApplet()
+{
+}
+
+short RenderApplet::intrinsicWidth() const
+{
+ int rval = 300;
+
+ if( m_widget )
+ rval = ((KJavaAppletWidget*)(m_widget))->sizeHint().width();
+
+ return rval > 10 ? rval : 50;
+}
+
+int RenderApplet::intrinsicHeight() const
+{
+ int rval = 150;
+
+ if( m_widget )
+ rval = m_widget->sizeHint().height();
+
+ return rval > 10 ? rval : 50;
+}
+
+void RenderApplet::layout()
+{
+ //kdDebug(6100) << "RenderApplet::layout" << endl;
+
+ KHTMLAssert( needsLayout() );
+ KHTMLAssert( minMaxKnown() );
+
+ calcWidth();
+ calcHeight();
+
+ KJavaAppletWidget *tmp = static_cast<KJavaAppletWidget*>(m_widget);
+ if ( tmp ) {
+ NodeImpl *child = element()->firstChild();
+
+ while(child) {
+
+ if(child->id() == ID_PARAM) {
+ HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
+ if(tmp->applet())
+ tmp->applet()->setParameter( p->name(), p->value());
+ }
+ child = child->nextSibling();
+ }
+ //kdDebug(6100) << "setting applet widget to size: " << m_width << ", " << m_height << endl;
+ m_widget->resize(m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
+ m_height-borderTop()-borderBottom()-paddingTop()-paddingBottom());
+ tmp->showApplet();
+ }
+
+ setNeedsLayout(false);
+}
+
+void RenderApplet::processArguments(const TQMap<TQString, TQString> &args)
+{
+ KJavaAppletWidget *w = static_cast<KJavaAppletWidget*>(m_widget);
+ KJavaApplet* applet = w ? w->applet() : 0;
+
+ if ( applet ) {
+ applet->setBaseURL( args[TQString::fromLatin1("baseURL") ] );
+ applet->setAppletClass( args[TQString::fromLatin1("code") ] );
+
+ TQString str = args[TQString::fromLatin1("codeBase") ];
+ if( !str.isEmpty() )
+ applet->setCodeBase( str );
+
+ str = args[TQString::fromLatin1("name") ];
+ if( !str.isNull() )
+ applet->setAppletName( str );
+ else
+ applet->setAppletName( args[TQString::fromLatin1("code") ] );
+
+ str = args[TQString::fromLatin1("archive") ];
+ if( !str.isEmpty() )
+ applet->setArchives( args[TQString::fromLatin1("archive") ] );
+ }
+}
+
+#endif