/***************************************************************************
                            KCommandHistory.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <kcommand.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KCommandHistory.h>

class KCommandHistoryJBridge : public KCommandHistory
{
public:
	KCommandHistoryJBridge() : KCommandHistory() {}
	KCommandHistoryJBridge(KActionCollection* actionCollection, bool withMenus) : KCommandHistory(actionCollection, withMenus) {}
	~KCommandHistoryJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_slotUndoAboutToShow() {
		KCommandHistory::slotUndoAboutToShow();
		return;
	}
	void protected_slotUndoActivated(int arg1) {
		KCommandHistory::slotUndoActivated(arg1);
		return;
	}
	void protected_slotRedoAboutToShow() {
		KCommandHistory::slotRedoAboutToShow();
		return;
	}
	void protected_slotRedoActivated(int arg1) {
		KCommandHistory::slotRedoActivated(arg1);
		return;
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	void customEvent(QCustomEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "customEvent", arg1, "org.kde.qt.QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "timerEvent", arg1, "org.kde.qt.QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_newKCommandHistory__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KCommandHistoryJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_newKCommandHistory__Lorg_kde_koala_KActionCollection_2Z(JNIEnv *env, jobject obj, jobject actionCollection, jboolean withMenus)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KCommandHistoryJBridge((KActionCollection*) QtSupport::getQt(env, actionCollection), (bool) withMenus));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_newKCommandHistory__Lorg_kde_koala_KActionCollection_2(JNIEnv *env, jobject obj, jobject actionCollection)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KCommandHistoryJBridge((KActionCollection*) QtSupport::getQt(env, actionCollection), true));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj) && ((KCommandHistory*)QtSupport::getQt(env, obj))->parent() == (QObject *) 0) {
		delete (KCommandHistory*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KCommandHistory_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KCommandHistory_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_clear(JNIEnv *env, jobject obj)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->clear();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_addCommand__Lorg_kde_koala_KCommand_2Z(JNIEnv *env, jobject obj, jobject command, jboolean execute)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->addCommand((KCommand*) QtSupport::getQt(env, command), (bool) execute);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_addCommand__Lorg_kde_koala_KCommand_2(JNIEnv *env, jobject obj, jobject command)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->addCommand((KCommand*) QtSupport::getQt(env, command), true);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KCommandHistory_undoLimit(JNIEnv *env, jobject obj)
{
	return (jint) ((KCommandHistory*) QtSupport::getQt(env, obj))->undoLimit();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_setUndoLimit(JNIEnv *env, jobject obj, jint limit)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->setUndoLimit((int) limit);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KCommandHistory_redoLimit(JNIEnv *env, jobject obj)
{
	return (jint) ((KCommandHistory*) QtSupport::getQt(env, obj))->redoLimit();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_setRedoLimit(JNIEnv *env, jobject obj, jint limit)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->setRedoLimit((int) limit);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_updateActions(JNIEnv *env, jobject obj)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->updateActions();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_undo(JNIEnv *env, jobject obj)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->undo();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_redo(JNIEnv *env, jobject obj)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->redo();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_documentSaved(JNIEnv *env, jobject obj)
{
	((KCommandHistory*) QtSupport::getQt(env, obj))->documentSaved();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_slotUndoAboutToShow(JNIEnv *env, jobject obj)
{
	((KCommandHistoryJBridge*) QtSupport::getQt(env, obj))->protected_slotUndoAboutToShow();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_slotUndoActivated(JNIEnv *env, jobject obj, jint arg1)
{
	((KCommandHistoryJBridge*) QtSupport::getQt(env, obj))->protected_slotUndoActivated((int) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_slotRedoAboutToShow(JNIEnv *env, jobject obj)
{
	((KCommandHistoryJBridge*) QtSupport::getQt(env, obj))->protected_slotRedoAboutToShow();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCommandHistory_slotRedoActivated(JNIEnv *env, jobject obj, jint arg1)
{
	((KCommandHistoryJBridge*) QtSupport::getQt(env, obj))->protected_slotRedoActivated((int) arg1);
	return;
}

