1 | /* This file is part of the KDE project |
2 | Copyright (C) 2001 Simon Hausmann <hausmann@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to the |
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KPARTS_BROWSERINTERFACE_H |
21 | #define KPARTS_BROWSERINTERFACE_H |
22 | |
23 | #include <QtCore/QObject> |
24 | #include <QtCore/QVariant> |
25 | |
26 | #include <kparts/kparts_export.h> |
27 | |
28 | namespace KParts |
29 | { |
30 | |
31 | /** |
32 | * The purpose of this interface is to allow a direct communication between |
33 | * a KPart and the hosting browser shell (for example Konqueror) . A |
34 | * shell implementing this interface can propagate it to embedded kpart |
35 | * components by using the setBrowserInterface call of the part's |
36 | * KParts::BrowserExtension object. |
37 | * |
38 | * This interface looks not very rich, but the main functionality is |
39 | * implemented using the callMethod method for part->shell |
40 | * communication and using Qt properties for allowing a part to |
41 | * to explicitly query information from the shell. |
42 | * |
43 | * Konqueror in particular, as 'reference' implementation, provides |
44 | * the following functionality through this interface: |
45 | * |
46 | * Qt properties: |
47 | * Q_PROPERTY( uint historyLength READ historyLength ); |
48 | * |
49 | * Callable methods: |
50 | * void goHistory( int ); |
51 | * |
52 | */ |
53 | class KPARTS_EXPORT BrowserInterface : public QObject |
54 | { |
55 | Q_OBJECT |
56 | public: |
57 | explicit BrowserInterface( QObject *parent ); |
58 | virtual ~BrowserInterface(); |
59 | |
60 | /** |
61 | * Perform a dynamic invocation of a method in the BrowserInterface |
62 | * implementation. Methods are to be implemented as simple Qt slots. |
63 | * You should only include the method name, and not the signature, |
64 | * in the name argument. |
65 | */ |
66 | void callMethod( const char *name, const QVariant &argument ); |
67 | }; |
68 | |
69 | } |
70 | |
71 | #endif |
72 | |