/***************************************************************************
                            KCommandHistory.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KCommandHistory.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KCommandHistory.h>
#include <kdeobjc/KActionCollection.h>
#include <kdeobjc/KCommand.h>


@implementation  KCommandHistory


- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KCommandHistory()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithActionCollection: (KActionCollection*)actionCollection withMenus: (BOOL)withMenus
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KCommandHistory1((kde_KActionCollection*) [actionCollection qt], (int)withMenus)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithActionCollection: (KActionCollection*)actionCollection 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KCommandHistory1((kde_KActionCollection*) [actionCollection qt], 1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			kde_del_KCommandHistory((kde_KCommandHistory *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- clear
{
	kde_KCommandHistory_clear((kde_KCommandHistory *)[self qt]);
	return self;
}

- addCommand: (KCommand*)command execute: (BOOL)execute
{
	kde_KCommandHistory_addCommand((kde_KCommandHistory *)[self qt], (kde_KCommand*) [command qt], (int)execute);
	return self;
}

- addCommand: (KCommand*)command 
{
	kde_KCommandHistory_addCommand((kde_KCommandHistory *)[self qt], (kde_KCommand*) [command qt], 1);
	return self;
}

- (int) undoLimit
{
	return (int) kde_KCommandHistory_undoLimit((kde_KCommandHistory *)[self qt]);
}

- setUndoLimit: (int)limit
{
	kde_KCommandHistory_setUndoLimit((kde_KCommandHistory *)[self qt], (int)limit);
	return self;
}

- (int) redoLimit
{
	return (int) kde_KCommandHistory_redoLimit((kde_KCommandHistory *)[self qt]);
}

- setRedoLimit: (int)limit
{
	kde_KCommandHistory_setRedoLimit((kde_KCommandHistory *)[self qt], (int)limit);
	return self;
}

- updateActions
{
	kde_KCommandHistory_updateActions((kde_KCommandHistory *)[self qt]);
	return self;
}

- undo
{
	kde_KCommandHistory_undo((kde_KCommandHistory *)[self qt]);
	return self;
}

- redo
{
	kde_KCommandHistory_redo((kde_KCommandHistory *)[self qt]);
	return self;
}

- documentSaved
{
	kde_KCommandHistory_documentSaved((kde_KCommandHistory *)[self qt]);
	return self;
}

- slotUndoAboutToShow
{
	kde_KCommandHistory_slotUndoAboutToShow((kde_KCommandHistory *)[self qt]);
	return self;
}

- slotUndoActivated: (int)arg1
{
	kde_KCommandHistory_slotUndoActivated((kde_KCommandHistory *)[self qt], (int)arg1);
	return self;
}

- slotRedoAboutToShow
{
	kde_KCommandHistory_slotRedoAboutToShow((kde_KCommandHistory *)[self qt]);
	return self;
}

- slotRedoActivated: (int)arg1
{
	kde_KCommandHistory_slotRedoActivated((kde_KCommandHistory *)[self qt], (int)arg1);
	return self;
}

@end
