[Kde-java] Questions about KCommandHistory
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Thu Jul 22 12:39:55 CEST 2004
On Saturday 10 July 2004 10:46, Richard Dale wrote:
> I'll add some more virtual method callbacks for the KDE 3.3 release as it's
> the biggest limitation of the bindings. Fixing KCommand.execute() should be
> straightforward, so I can to a patch this weekend and either mail it to you
> or post it on this list if it isn't too big.
Apologies for the non-appearance of this patch. The problem was that there
were two things wrong with the code generation for KCommand. It was missing
the virtual method callbacks, but also it didn't even have a suitable
'KCommandJBridge' C++ class to add the callbacks too.
I started to try and fix it, but it was more work than I was expecting, and
I've needed to get the ruby bindings out of the way this last week. So the
code generated below still doesn't compile (it needs a constructor), but it
shows what needs to be done..
I'll start working on the java bindings next week I hope, and try and sort
this all out.
If it cheers anyone up, here is an article about the difficulties of
subclassing in Swing:
http://www.scruffles.net/blog/archive/000002.html
-- Richard
//Auto-generated by kalyptus. DO NOT EDIT.
#include <kcommand.h>
#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KCommand.h>
class KCommandJBridge : public KCommand
{
public:
~KCommandJBridge() {QtSupport::qtKeyDeleted(this);}
void execute() {
if (!QtSupport::voidDelegate((void*)this,"execute")) {
KCommand::execute();
}
return;
}
void unexecute() {
if (!QtSupport::voidDelegate((void*)this,"unexecute")) {
KCommand::unexecute();
}
return;
}
};
JNIEXPORT void JNICALL
Java_org_kde_koala_KCommand_execute(JNIEnv* env, jobject obj)
{
((KCommand*) QtSupport::getQt(env, obj))->execute();
return;
}
JNIEXPORT void JNICALL
Java_org_kde_koala_KCommand_finalize(JNIEnv* env, jobject obj)
{
if (QtSupport::allocatedInJavaWorld(env, obj)) {
delete (KCommand*)QtSupport::getQt(env, obj);
QtSupport::setQt(env, obj, 0);
}
return;
}
JNIEXPORT void JNICALL
Java_org_kde_koala_KCommand_dispose(JNIEnv* env, jobject obj)
{
Java_org_kde_koala_KCommand_finalize(env, obj);
return;
}
JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KCommand_isDisposed(JNIEnv* env, jobject obj)
{
return (QtSupport::getQt(env, obj) == 0);
}
JNIEXPORT jstring JNICALL
Java_org_kde_koala_KCommand_name(JNIEnv* env, jobject obj)
{
QString _qstring;
_qstring = ((KCommand*) QtSupport::getQt(env, obj))->name();
return QtSupport::fromQString(env, &_qstring);
}
JNIEXPORT void JNICALL
Java_org_kde_koala_KCommand_unexecute(JNIEnv* env, jobject obj)
{
((KCommand*) QtSupport::getQt(env, obj))->unexecute();
return;
}
More information about the Kde-java
mailing list