/***************************************************************************
                            QAction.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, 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 <qtc/qt_QAction.h>
#include <qtobjc/QAction.h>
#include <qtobjc/QKeySequence.h>
#include <qtobjc/QPopupMenu.h>

#include <qtobjc/QIconSet.h>
#include <qtobjc/QWidget.h>

@implementation  QAction


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

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

- initWithText: (NSString *)text icon: (QIconSet*)icon menuText: (NSString *)menuText accel: (QKeySequence*)accel parent: (QObject *)parent name: (NSString *)name toggle: (BOOL)toggle
{
static qt_QString * _qstring_menuText = 0L;
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QAction1((qt_QString *) [text toQString: &_qstring_text], (qt_QIconSet*) [icon qt], (qt_QString *) [menuText toQString: &_qstring_menuText], (qt_QKeySequence*) [accel qt], (qt_QObject *) [parent qt], (char*) [name cString], (int)toggle)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text icon: (QIconSet*)icon menuText: (NSString *)menuText accel: (QKeySequence*)accel parent: (QObject *)parent 
{
static qt_QString * _qstring_menuText = 0L;
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QAction1((qt_QString *) [text toQString: &_qstring_text], (qt_QIconSet*) [icon qt], (qt_QString *) [menuText toQString: &_qstring_menuText], (qt_QKeySequence*) [accel qt], (qt_QObject *) [parent qt], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text menuText: (NSString *)menuText accel: (QKeySequence*)accel parent: (QObject *)parent name: (NSString *)name toggle: (BOOL)toggle
{
static qt_QString * _qstring_menuText = 0L;
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QAction2((qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [menuText toQString: &_qstring_menuText], (qt_QKeySequence*) [accel qt], (qt_QObject *) [parent qt], (char*) [name cString], (int)toggle)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text menuText: (NSString *)menuText accel: (QKeySequence*)accel parent: (QObject *)parent 
{
static qt_QString * _qstring_menuText = 0L;
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QAction2((qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [menuText toQString: &_qstring_menuText], (qt_QKeySequence*) [accel qt], (qt_QObject *) [parent qt], 0, 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) {
			qt_del_QAction((qt_QAction *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setIconSet: (QIconSet*)arg1
{
	qt_QAction_setIconSet((qt_QAction *)[self qt], (qt_QIconSet*) [arg1 qt]);
	return self;
}

- (QIconSet*) iconSet
{
	return (QIconSet*) [QtSupport objectForQtKey: qt_QAction_iconSet((qt_QAction *)[self qt]) withClass: [QIconSet class] allocatedInObjcWorld: YES];
}

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

- (NSString *) text
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QAction_text((qt_QAction *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (NSString *) menuText
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QAction_menuText((qt_QAction *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (NSString *) toolTip
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QAction_toolTip((qt_QAction *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (NSString *) statusTip
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QAction_statusTip((qt_QAction *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (NSString *) whatsThis
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QAction_whatsThis((qt_QAction *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setAccel: (QKeySequence*)key
{
	qt_QAction_setAccel((qt_QAction *)[self qt], (qt_QKeySequence*) [key qt]);
	return self;
}

- (QKeySequence*) accel
{
	return (QKeySequence*) [QtSupport objectForQtKey: qt_QAction_accel((qt_QAction *)[self qt]) withClass: [QKeySequence class] allocatedInObjcWorld: YES];
}

- setToggleAction: (BOOL)arg1
{
	qt_QAction_setToggleAction((qt_QAction *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isToggleAction
{
	return (BOOL) qt_QAction_isToggleAction((qt_QAction *)[self qt]);
}

- (BOOL) isOn
{
	return (BOOL) qt_QAction_isOn((qt_QAction *)[self qt]);
}

- (BOOL) isEnabled
{
	return (BOOL) qt_QAction_isEnabled((qt_QAction *)[self qt]);
}

- (BOOL) addTo: (QWidget *)arg1
{
	return (BOOL) qt_QAction_addTo((qt_QAction *)[self qt], (qt_QWidget *) [arg1 qt]);
}

- (BOOL) removeFrom: (QWidget *)arg1
{
	return (BOOL) qt_QAction_removeFrom((qt_QAction *)[self qt], (qt_QWidget *) [arg1 qt]);
}

- toggle
{
	qt_QAction_toggle((qt_QAction *)[self qt]);
	return self;
}

- setOn: (BOOL)arg1
{
	qt_QAction_setOn((qt_QAction *)[self qt], (int)arg1);
	return self;
}

- setEnabled: (BOOL)arg1
{
	qt_QAction_setEnabled((qt_QAction *)[self qt], (int)arg1);
	return self;
}

- addedTo: (QWidget *)actionWidget container: (QWidget *)container
{
	qt_QAction_addedTo((qt_QAction *)[self qt], (qt_QWidget *) [actionWidget qt], (qt_QWidget *) [container qt]);
	return self;
}

- addedTo: (int)index menu: (QPopupMenu*)menu
{
	qt_QAction_addedTo1((qt_QAction *)[self qt], (int)index, (qt_QPopupMenu*) [menu qt]);
	return self;
}

@end
