summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/qtjava/JavaSlot.h
blob: ac4525c217fecff81b317bc3a91605ca9b24d17f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/***************************************************************************
                          JavaSlot.h  -  description
                             -------------------
    begin                : Tue Oct 31 2000
    copyright            : (C) 2000 by Richard Dale
    email                : Richard_Dale@tipitina.demon.co.uk
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   Lost Highway Ltd reserves the right to issue additional license types *
 *   compatible with the Trolltech AS Qt commercial license.               *
 ***************************************************************************/

#ifndef _JAVASLOT_H_
#define _JAVASLOT_H_

#include <jni.h>
#include <tqobject.h>

#include <tqevent.h>
#include <tqlistview.h>
#include <tqiconview.h>
#include <tqlistbox.h>
#include <tqdatetime.h>
#include <tqtoolbar.h>
#include <tqaction.h>
#include <tqnetworkprotocol.h>
#include <tqsql.h>
#include <tqsqlcursor.h>
#include <tqsqlrecord.h>
#include <tqurlinfo.h>
#include <tqlibrary.h>
#include <tqhttp.h>
#include <tqdir.h>
#include <tqtextedit.h>

class JavaSlotFactory;
class TQMetaObject;

class JavaSlot: public TQObject
{
    Q_OBJECT
public:
    JavaSlot(JNIEnv * env, jobject receiver, jstring slot);
    ~JavaSlot();
	
	/** Set the JavaSlot factory to create any JavaSlot instances */
	static void setJavaSlotFactory(JavaSlotFactory * factory);

    /** Return a new JavaSlot instance via the JavaSlot factory */
	static JavaSlot * createJavaSlot(JNIEnv * env, jobject receiver, jstring slot);

	/** Given a Java signal name, returns the corresponding C++ signal name.
		The TTQMetaObject is used to check whether the TTQObject instance described
		by 'smeta' implements the C++ signal. */
	const char * javaToQtSignalName(JNIEnv * env, jstring signalString, TTQMetaObject * smeta);
	
	/** Converts a Java type signature for a signal to the corresponding C++ Qt type signature.*/
	virtual const char * javaToQtSignalType(const char * signalName, const char * javaTypeSignature, TTQMetaObject * smeta);

	/** Given a Java slot name, returns the corresponding C++ slot name. The optional signalString
		parameter is the C++ signal to connect to - any C++ slot type signature must match this.
	*/
	const char * javaToQtSlotName(JNIEnv * env, jstring slotString, const char * signalString = 0);

	/** Converts a Java type signature for a slot to the corresponding C++ Qt type signature.*/
	virtual const char * javaToQtSlotType(const char * javaTypeSignature, const char * signalString);

public slots:
    void invoke();
    void invoke(bool arg);
	void invoke(bool* arg1, bool* arg2);
    void invoke(char arg);
    void invoke(double arg);
    void invoke(float arg);
    void invoke(int arg);
    void invoke(int arg1, bool arg2);
    void invoke(int arg1,const TTQCString& arg2,const TTQByteArray& arg3);
    void invoke(int arg1,const TTQPoint& arg2);
    void invoke(int arg1,const TTQString& arg2);
    void invoke(int arg1,int arg2);
    void invoke(int arg1,int arg2,const TTQPoint& arg3);
	void invoke(int arg1,int arg2,int arg3);
	void invoke(int arg1,int arg2,int arg3,const TTQPoint& arg4);
	void invoke(int arg1,int arg2,TTQNetworkOperation* arg3);
	void invoke(int arg1,TTQDropEvent* arg2);
	void invoke(int arg1,TTQIconViewItem* arg2,const TTQPoint& arg3);
	void invoke(int arg1,TTQListBoxItem* arg2,const TTQPoint arg3);
	void invoke(int arg1,TTQListViewItem* arg2,const TTQPoint arg3,int arg4);
    void invoke(long arg);
    void invoke(long arg,const TTQByteArray&);
    void invoke(long arg,const TTQString&);
    void invoke(short arg);
    void invoke(unsigned char arg);
	void invoke(TTQAction * arg1);
	void invoke(TTQDir::SortSpec arg1);
	void invoke(TTQDockWindow * arg1);
	void invoke(TTQDockWindow::Place arg1);
	void invoke(TTQDropEvent* arg1);
	void invoke(TTQDropEvent* arg1,TTQListViewItem*arg2);
	void invoke(TTQDropEvent* arg1,const TTQValueList<TTQIconDragItem>& arg2);
	void invoke(TTQDropEvent*arg1,TTQListViewItem*arg2,TTQListViewItem*arg3);
	void invoke(TTQIconViewItem* arg1);
	void invoke(TTQIconViewItem* arg1,const TTQPoint& arg2);
	void invoke(TTQIconViewItem* arg1,const TTQString& arg2);
	void invoke(TQList<TTQListViewItem> arg1,TQList<TTQListViewItem> arg2,TQList<TTQListViewItem> arg3);
	void invoke(TTQListBoxItem* arg1);
	void invoke(TTQListBoxItem* arg1,const TTQPoint& arg2);
	void invoke(TTQListViewItem* arg1, int arg2, const TTQString& arg3);
	void invoke(TTQListViewItem* arg1,TTQListViewItem*arg2,TTQListViewItem*arg3);
	void invoke(TTQListViewItem* arg1,const TTQPoint& arg2,int arg3);
	void invoke(TTQListViewItem* arg1,const TTQString& arg2,int arg3);
	void invoke(TTQListViewItem* arg1,int arg2);
	void invoke(TTQListViewItem*arg1);
	void invoke(TTQNetworkOperation* arg1);
	void invoke(TTQObject* arg1);
	void invoke(TTQPopupMenu* arg1);
	void invoke(TTQSql::Op arg1);
	void invoke(TTQSqlCursor::Mode arg1);
	void invoke(TTQSqlRecord* arg1);
	void invoke(TTQTextEdit::VerticalAlignment arg1);
	void invoke(TTQToolBar* arg1);
	void invoke(Orientation arg1);
	void invoke(TTQWidget* arg1);
	void invoke(TTQWidget* arg1,const TTQPoint& arg2);
	void invoke(TTQWidget* arg1,const TTQString& arg2);
	void invoke(TTQWidget* arg1,const TTQDropEvent* arg2);
	void invoke(TTQWidget* arg1,TTQPixmap arg2);
	void invoke(const TTQByteArray& arg1);
	void invoke(const TTQByteArray& arg1,TTQNetworkOperation* arg2);
	void invoke(const char* arg1, bool arg2);
	void invoke(const char* arg1,const TTQString& arg2,const TTQByteArray& arg3,const TTQString& arg4,const TTQString& arg5,const TTQString& arg6);
	void invoke(const TTQChar& arg1);
	void invoke(const TTQCString& arg1);
	void invoke(const TTQColor& arg1);
	void invoke(const TTQColor& arg1,const TTQString& arg2);
	void invoke(const TTQDate& arg1);
	void invoke(const TTQDate& arg1,const TTQDate& arg2);
	void invoke(const TTQDateTime& arg1);
	void invoke(const TTQDragMoveEvent* arg1,bool& arg2);
	void invoke(const TTQSize& arg1);
	void invoke(const TTQFont& arg1);
	void invoke(const TTQHttpResponseHeader& arg1);
	void invoke(const TTQImage& arg1, int arg2);
	void invoke(const TTQPixmap& arg1);
	void invoke(const TTQPoint& arg1);
	void invoke(const TTQRect& arg1);
	void invoke(const TTQSqlRecord* arg1);
	void invoke(const TTQString& arg1);
	void invoke(const TTQString& arg1,bool arg2,const TTQString& arg3);
	void invoke(const TTQString& arg1,const TTQCString& arg2,const TTQString& arg3);
	void invoke(const TTQString& arg1,TTQLibrary* arg2);
	void invoke(const TTQString& arg1,const TTQPoint& arg2);
	void invoke(const TTQString& arg1,const TTQString& arg2);
	void invoke(const TTQString& arg1,const TTQStringList& arg2,unsigned int arg3);
	void invoke(const TTQString& arg1,const TTQString& arg2,unsigned int arg3);
	void invoke(const TTQString& arg1,int arg2);
	void invoke(const TTQString& arg1,int arg2,int arg3);
	void invoke(const TTQString& arg1,int arg2,int arg3,int arg4);
	void invoke(const TTQStringList& arg1);
	void invoke(const TTQTime& arg1);
	void invoke(const TTQString& arg1,unsigned long arg2,unsigned long arg3,unsigned long arg4);
	void invoke(const TTQUrlInfo& arg1);
	void invoke(const TTQUrlInfo& arg1,TTQNetworkOperation* arg2);
	void invoke(const TTQValueList<TTQUrlInfo>& arg1,TTQNetworkOperation* arg2);
	void invoke(const TTQVariant& arg1);
	void invoke(const unsigned long& arg1,const unsigned long& arg2,const unsigned long& arg3,const TTQString& arg4);
	
    /** Java signals are always of type 'jobjectArray' */
	void invoke(jobjectArray args);

protected:
    jobject invocation;
private:
    static JavaSlotFactory *	_factory;
};

class JavaSlotFactory {
public:
	JavaSlotFactory();
	virtual ~JavaSlotFactory() {};
	virtual JavaSlot *	createJavaSlot(JNIEnv * env, jobject receiver, jstring slot);
};

class JavaSignal: public TQObject
{
    Q_OBJECT
public:
    JavaSignal();
    ~JavaSignal();
    void emitArgs(jobjectArray args);
signals:
    void signalJava(jobjectArray);
};

#endif