/***************************************************************************
                            KGlobalAccel.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_KGlobalAccel.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KGlobalAccel.h>
#include <kdeobjc/KConfigBase.h>
#include <kdeobjc/KShortcut.h>


@implementation  KGlobalAccel


- initWithObject: (QObject *)pParent psName: (NSString *)psName
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KGlobalAccel((qt_QObject *) [pParent qt], (char*) [psName cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithObject: (QObject *)pParent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KGlobalAccel((qt_QObject *) [pParent qt], 0)];
		[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_KGlobalAccel((kde_KGlobalAccel *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) isEnabled
{
	return (BOOL) kde_KGlobalAccel_isEnabled((kde_KGlobalAccel *)[self qt]);
}

- setEnabled: (BOOL)bEnabled
{
	kde_KGlobalAccel_setEnabled((kde_KGlobalAccel *)[self qt], (int)bEnabled);
	return self;
}

//- (KAccelAction*) insert: (NSString *)sAction sLabel: (NSString *)sLabel sWhatsThis: (NSString *)sWhatsThis cutDef3: (KShortcut*)cutDef3 cutDef4: (KShortcut*)cutDef4 pObjSlot: (QObject *)pObjSlot psMethodSlot: (NSString *)psMethodSlot bConfigurable: (BOOL)bConfigurable bEnabled: (BOOL)bEnabled
//{
//static qt_QString * _qstring_sWhatsThis = 0L;
//static qt_QString * _qstring_sLabel = 0L;
//static qt_QString * _qstring_sAction = 0L;
//	return (KAccelAction*) [QtSupport objectForQtKey: kde_KGlobalAccel_insert((kde_KGlobalAccel *)[self qt], (qt_QString *) [sAction toQString: &_qstring_sAction], (qt_QString *) [sLabel toQString: &_qstring_sLabel], (qt_QString *) [sWhatsThis toQString: &_qstring_sWhatsThis], (kde_KShortcut*) [cutDef3 qt], (kde_KShortcut*) [cutDef4 qt], (qt_QObject *) [pObjSlot qt], (char*) [psMethodSlot cString], (int)bConfigurable, (int)bEnabled) withClass: [KAccelAction class] allocatedInObjcWorld: YES];
//}

//- (KAccelAction*) insert: (NSString *)sAction sLabel: (NSString *)sLabel sWhatsThis: (NSString *)sWhatsThis cutDef3: (KShortcut*)cutDef3 cutDef4: (KShortcut*)cutDef4 pObjSlot: (QObject *)pObjSlot psMethodSlot: (NSString *)psMethodSlot
//{
//static qt_QString * _qstring_sWhatsThis = 0L;
//static qt_QString * _qstring_sLabel = 0L;
//static qt_QString * _qstring_sAction = 0L;
//	return (KAccelAction*) [QtSupport objectForQtKey: kde_KGlobalAccel_insert((kde_KGlobalAccel *)[self qt], (qt_QString *) [sAction toQString: &_qstring_sAction], (qt_QString *) [sLabel toQString: &_qstring_sLabel], (qt_QString *) [sWhatsThis toQString: &_qstring_sWhatsThis], (kde_KShortcut*) [cutDef3 qt], (kde_KShortcut*) [cutDef4 qt], (qt_QObject *) [pObjSlot qt], (char*) [psMethodSlot cString], 1, 1) withClass: [KAccelAction class] allocatedInObjcWorld: YES];
//}

//- (KAccelAction*) insert: (NSString *)sName sLabel: (NSString *)sLabel
//{
//static qt_QString * _qstring_sLabel = 0L;
//static qt_QString * _qstring_sName = 0L;
//	return (KAccelAction*) [QtSupport objectForQtKey: kde_KGlobalAccel_insert1((kde_KGlobalAccel *)[self qt], (qt_QString *) [sName toQString: &_qstring_sName], (qt_QString *) [sLabel toQString: &_qstring_sLabel]) withClass: [KAccelAction class] allocatedInObjcWorld: YES];
//}

- (BOOL) updateConnections
{
	return (BOOL) kde_KGlobalAccel_updateConnections((kde_KGlobalAccel *)[self qt]);
}

- (KShortcut*) shortcut: (NSString *)sAction
{
static qt_QString * _qstring_sAction = 0L;
	return (KShortcut*) [QtSupport objectForQtKey: kde_KGlobalAccel_shortcut((kde_KGlobalAccel *)[self qt], (qt_QString *) [sAction toQString: &_qstring_sAction]) withClass: [KShortcut class] allocatedInObjcWorld: YES];
}

- (BOOL) setShortcut: (NSString *)sAction shortcut: (KShortcut*)arg1
{
static qt_QString * _qstring_sAction = 0L;
	return (BOOL) kde_KGlobalAccel_setShortcut((kde_KGlobalAccel *)[self qt], (qt_QString *) [sAction toQString: &_qstring_sAction], (kde_KShortcut*) [arg1 qt]);
}

- (BOOL) setSlot: (NSString *)sAction pObjSlot: (QObject *)pObjSlot psMethodSlot: (NSString *)psMethodSlot
{
static qt_QString * _qstring_sAction = 0L;
	return (BOOL) kde_KGlobalAccel_setSlot((kde_KGlobalAccel *)[self qt], (qt_QString *) [sAction toQString: &_qstring_sAction], (qt_QObject *) [pObjSlot qt], (char*) [psMethodSlot cString]);
}

//- (BOOL) setEnabled: (NSString *)sAction bEnabled: (BOOL)bEnabled
//{
//static qt_QString * _qstring_sAction = 0L;
//	return (BOOL) kde_KGlobalAccel_setEnabled1((kde_KGlobalAccel *)[self qt], (qt_QString *) [sAction toQString: &_qstring_sAction], (int)bEnabled);
//}

- (NSString *) configGroup
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KGlobalAccel_configGroup((kde_KGlobalAccel *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (BOOL) readSettings: (KConfigBase*)pConfig
{
	return (BOOL) kde_KGlobalAccel_readSettings((kde_KGlobalAccel *)[self qt], (kde_KConfigBase*) [pConfig qt]);
}

- (BOOL) readSettings
{
	return (BOOL) kde_KGlobalAccel_readSettings((kde_KGlobalAccel *)[self qt], 0);
}

- (BOOL) writeSettings: (KConfigBase*)pConfig
{
	return (BOOL) kde_KGlobalAccel_writeSettings((kde_KGlobalAccel *)[self qt], (kde_KConfigBase*) [pConfig qt]);
}

- (BOOL) writeSettings
{
	return (BOOL) kde_KGlobalAccel_writeSettings((kde_KGlobalAccel *)[self qt], 0);
}

+ (BOOL) useFourModifierKeys
{
	return (BOOL) kde_KGlobalAccel_useFourModifierKeys();
}

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

@end
