KHtml

kjavaappletwidget.h
1 // -*- c++ -*-
2 
3 /* This file is part of the KDE project
4  *
5  * Copyright (C) 2000 Richard Moore <[email protected]>
6  * 2000 Wynn Wilkes <[email protected]>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef KJAVAAPPLETWIDGET_H
25 #define KJAVAAPPLETWIDGET_H
26 
27 #include <QImage>
28 
29 #include "java/kjavaappletcontext.h"
30 #include "java/kjavaapplet.h"
31 #pragma message ("Revive QX11EmbedContainer")
32 #if 0
33 #include <QX11EmbedContainer>
34 #else
35 #define QX11EmbedContainer QWidget
36 #include <QWidget>
37 #endif
38 
39 /**
40  * @short A widget for displaying Java applets
41  *
42  * KJavaAppletWidget provides support for the inclusion of Java applets
43  * in Qt and KDE applications. To create an applet, you must first create
44  * a context object in which it will run. There can be several applets and
45  * contexts in operation at a given time, for example in a web browser there
46  * would be one context object for each web page. Applets in the same context
47  * can communicate with each other, applets in different contexts cannot.
48  * Once you have created a KJavaAppletContext, you can create as many
49  * applets in it as you want.
50  *
51  * Once you have created the applet widget, you should access the applet() method
52  * to call the various setXXX methods to configure the applet,
53  * They correspond to the HTML tags used to embed applets in a web page.
54  * Once the applet is configured, call the create() method to set things in motion.
55  * The applet is running when it first appears, but you can start or stop it
56  * when you like (for example if it scrolls off the screen).
57  *
58  * This widget works by using the KJavaAppletServer, which fires off a
59  * Java server process with which it communicates using the
60  * KDE Java Applet Server (KJAS) protocol over stdin and stdout.
61  * The applet windows are swallowed and attached to the QWidget, but they are
62  * actually running in a different process. This has the advantage of robustness
63  * and reusability. The details of the communication are hidden from the user
64  * in the KJASAppletServer class. Normally only a single server process is used for
65  * all of the applets in a given application, this is all sorted automatically.
66  * The KJAS server is 100% pure Java, and should also prove useful for people
67  * wishing to add java support to other systems (for example a perl/Tk binding
68  * is perfectly feasible). All you need to do is implement the protocol and
69  * (optionally) swallow the applet windows.
70  *
71  * The applet support in KDE is still dependent on the KWin Window Manager. The
72  * applet swallowing will not work under other Window Managers. Hopefully this
73  * will be fixed in the future.
74  *
75  * For a description of the KJAS protocol, please see the KJAS_GRAMMAR.txt file.
76  *
77  * @author Richard J. Moore, [email protected]
78  * @author Wynn Wilkes, [email protected]
79  */
80 
81 class KJavaAppletWidgetPrivate;
82 
83 class KJavaAppletWidget : public QX11EmbedContainer
84 {
85  Q_OBJECT
86 public:
87  KJavaAppletWidget(QWidget *parent = nullptr);
88 
89  ~KJavaAppletWidget();
90 
91  /**
92  * Returns a pointer to the KJavaApplet. Use this to
93  * configure the applet's parameters. You can also
94  * use it to start and stop the Applet.
95  */
96  KJavaApplet *applet()
97  {
98  return m_applet;
99  }
100 
101  /**
102  * Tells the AppletServer to create, initialize, and
103  * show the Applet.
104  */
105  void showApplet();
106 
107  QSize sizeHint() const override;
108  void resize(int, int);
109 
110 protected Q_SLOTS:
111  /**
112  * This slot is called by KWin when new windows are added. We check
113  * to see if the window has the title we set. If so we embed it.
114  */
115  void setWindow(WId w);
116 
117 protected:
118  //The counter to generate ID's for the applets
119  static int appletCount;
120  void showEvent(QShowEvent *) override;
121 
122 private:
123  KJavaAppletWidgetPrivate *const d;
124 
125  KJavaApplet *m_applet;
126  QString m_swallowTitle;
127 
128 };
129 
130 #endif // KJAVAAPPLETWIDGET_H
131 
KJOBWIDGETS_EXPORT void setWindow(KJob *job, QWidget *widget)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.