/***************************************************************************
                            KActionCollection.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 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_KActionCollection.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KActionCollection.h>

@implementation  KActionCollection


- initWithWidget: (QWidget *)parent name: (NSString *)name instance: (KInstance*)instance
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionCollection((qt_QWidget *) [parent qt], (char*) [name cString], (kde_KInstance*) [instance qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionCollection((qt_QWidget *) [parent qt], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)watch parent: (QObject *)parent name: (NSString *)name instance: (KInstance*)instance
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionCollection1((qt_QWidget *) [watch qt], (qt_QObject *) [parent qt], (char*) [name cString], (kde_KInstance*) [instance qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)watch parent: (QObject *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionCollection1((qt_QWidget *) [watch qt], (qt_QObject *) [parent qt], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	KActionCollection * aCopy;
	aCopy = [[(KActionCollection *)[[self class] allocWithZone: zone] setQt: kde_new_KActionCollection2([self qt])] init];
	[aCopy setAllocatedInObjcWorld: YES];
	[QtSupport setObject: aCopy forQtKey: [aCopy qt]];
	return aCopy;
}

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

- setWidget: (QWidget *)widget
{
	kde_KActionCollection_setWidget((kde_KActionCollection *)[self qt], (qt_QWidget *) [widget qt]);
	return self;
}

- (KAccel*) accel
{
	return (KAccel*) [QtSupport objectForQtKey: kde_KActionCollection_accel((kde_KActionCollection *)[self qt]) withClass: [KAccel class] allocatedInObjcWorld: YES];
}

//- (KAccel*) accel
//{
//	return (KAccel*) [QtSupport objectForQtKey: kde_KActionCollection_accel1((kde_KActionCollection *)[self qt]) withClass: [KAccel class] allocatedInObjcWorld: YES];
//}

- (unsigned int) count
{
	return (unsigned int) kde_KActionCollection_count((kde_KActionCollection *)[self qt]);
}

- (BOOL) isEmpty
{
	return (BOOL) kde_KActionCollection_isEmpty((kde_KActionCollection *)[self qt]);
}

- (KAction*) actionWithId: (int)index
{
	return (KAction*) [QtSupport objectForQtKey: kde_KActionCollection_action((kde_KActionCollection *)[self qt], (int)index) withClass: [KAction class] allocatedInObjcWorld: YES];
}

- (KAction*) action: (NSString *)name classname: (NSString *)classname
{
	return (KAction*) [QtSupport objectForQtKey: kde_KActionCollection_action1((kde_KActionCollection *)[self qt], (char*) [name cString], (char*) [classname cString]) withClass: [KAction class] allocatedInObjcWorld: YES];
}

- (KAction*) action: (NSString *)name 
{
	return (KAction*) [QtSupport objectForQtKey: kde_KActionCollection_action1((kde_KActionCollection *)[self qt], (char*) [name cString], 0) withClass: [KAction class] allocatedInObjcWorld: YES];
}

- (NSArray *) groups
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KActionCollection_groups((kde_KActionCollection *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

//- (KActionPtrList) actions: (NSString *)group
//{
//static qt_QString * _qstring_group = 0L;
//	return (KActionPtrList) kde_KActionCollection_actions((kde_KActionCollection *)[self qt], (qt_QString *) [group toQString: &_qstring_group]);
//}

//- (KActionPtrList) actions
//{
//	return (KActionPtrList) kde_KActionCollection_actions1((kde_KActionCollection *)[self qt]);
//}

- (BOOL) readShortcutSettings: (NSString *)sConfigGroup pConfig: (KConfigBase*)pConfig
{
static qt_QString * _qstring_sConfigGroup = 0L;
	return (BOOL) kde_KActionCollection_readShortcutSettings((kde_KActionCollection *)[self qt], (qt_QString *) [sConfigGroup toQString: &_qstring_sConfigGroup], (kde_KConfigBase*) [pConfig qt]);
}

- (BOOL) readShortcutSettings
{
	return (BOOL) kde_KActionCollection_readShortcutSettings((kde_KActionCollection *)[self qt], qt_QString_null(), 0);
}

- (BOOL) writeShortcutSettings: (NSString *)sConfigGroup pConfig: (KConfigBase*)pConfig
{
static qt_QString * _qstring_sConfigGroup = 0L;
	return (BOOL) kde_KActionCollection_writeShortcutSettings((kde_KActionCollection *)[self qt], (qt_QString *) [sConfigGroup toQString: &_qstring_sConfigGroup], (kde_KConfigBase*) [pConfig qt]);
}

- (BOOL) writeShortcutSettings
{
	return (BOOL) kde_KActionCollection_writeShortcutSettings((kde_KActionCollection *)[self qt], qt_QString_null(), 0);
}

- setInstance: (KInstance*)instance
{
	kde_KActionCollection_setInstance((kde_KActionCollection *)[self qt], (kde_KInstance*) [instance qt]);
	return self;
}

- (KInstance*) instance
{
	return (KInstance*) [QtSupport objectForQtKey: kde_KActionCollection_instance((kde_KActionCollection *)[self qt]) withClass: [KInstance class] allocatedInObjcWorld: YES];
}

- setXMLFile: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	kde_KActionCollection_setXMLFile((kde_KActionCollection *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- (NSString *) xmlFile
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KActionCollection_xmlFile((kde_KActionCollection *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setHighlightingEnabled: (BOOL)enable
{
	kde_KActionCollection_setHighlightingEnabled((kde_KActionCollection *)[self qt], (int)enable);
	return self;
}

- (BOOL) highlightingEnabled
{
	return (BOOL) kde_KActionCollection_highlightingEnabled((kde_KActionCollection *)[self qt]);
}

- connectHighlight: (QWidget *)container action: (KAction*)action
{
	kde_KActionCollection_connectHighlight((kde_KActionCollection *)[self qt], (qt_QWidget *) [container qt], (kde_KAction*) [action qt]);
	return self;
}

- disconnectHighlight: (QWidget *)container action: (KAction*)action
{
	kde_KActionCollection_disconnectHighlight((kde_KActionCollection *)[self qt], (qt_QWidget *) [container qt], (kde_KAction*) [action qt]);
	return self;
}

- initWithObject: (QObject *)parent name: (NSString *)name instance: (KInstance*)instance
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionCollection3((qt_QObject *) [parent qt], (char*) [name cString], (kde_KInstance*) [instance qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithObject: (QObject *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionCollection3((qt_QObject *) [parent qt], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- insert: (KAction*)arg1
{
	kde_KActionCollection_insert((kde_KActionCollection *)[self qt], (kde_KAction*) [arg1 qt]);
	return self;
}

- remove: (KAction*)arg1
{
	kde_KActionCollection_remove((kde_KActionCollection *)[self qt], (kde_KAction*) [arg1 qt]);
	return self;
}

- (KAction*) take: (KAction*)arg1
{
	return (KAction*) [QtSupport objectForQtKey: kde_KActionCollection_take((kde_KActionCollection *)[self qt], (kde_KAction*) [arg1 qt]) withClass: [KAction class] allocatedInObjcWorld: YES];
}

- clear
{
	kde_KActionCollection_clear((kde_KActionCollection *)[self qt]);
	return self;
}

- virtual_hook: (int)identifier data: (void*)data
{
	kde_KActionCollection_virtual_hook((kde_KActionCollection *)[self qt], (int)identifier, (void*)data);
	return self;
}

@end
