/***************************************************************************
                            KActionMenu.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_KActionMenu.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KActionMenu.h>
#include <qtobjc/QIconSet.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QWidget.h>


@implementation  KActionMenu


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

- initWithText: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionMenu((qt_QString *) [text toQString: &_qstring_text], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text iconset: (QIconSet*)icon parent: (QObject *)parent name: (NSString *)name
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionMenu1((qt_QString *) [text toQString: &_qstring_text], (qt_QIconSet*) [icon qt], (qt_QObject *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text iconset: (QIconSet*)icon
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionMenu1((qt_QString *) [text toQString: &_qstring_text], (qt_QIconSet*) [icon qt], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text icon: (NSString *)icon parent: (QObject *)parent name: (NSString *)name
{
static qt_QString * _qstring_icon = 0L;
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionMenu2((qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [icon toQString: &_qstring_icon], (qt_QObject *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)text icon: (NSString *)icon 
{
static qt_QString * _qstring_icon = 0L;
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionMenu2((qt_QString *) [text toQString: &_qstring_text], (qt_QString *) [icon toQString: &_qstring_icon], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KActionMenu3(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) {
			kde_del_KActionMenu((kde_KActionMenu *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- insert: (KAction*)arg1 index: (int)index
{
	kde_KActionMenu_insert((kde_KActionMenu *)[self qt], (kde_KAction*) [arg1 qt], (int)index);
	return self;
}

- insert: (KAction*)arg1 
{
	kde_KActionMenu_insert((kde_KActionMenu *)[self qt], (kde_KAction*) [arg1 qt], -1);
	return self;
}

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

- (KPopupMenu*) popupMenu
{
	return (KPopupMenu*) [QtSupport objectForQtKey: kde_KActionMenu_popupMenu((kde_KActionMenu *)[self qt]) withClass: [KPopupMenu class] allocatedInObjcWorld: YES];
}

- popup: (QPoint*)global
{
	kde_KActionMenu_popup((kde_KActionMenu *)[self qt], (qt_QPoint*) [global qt]);
	return self;
}

- (BOOL) delayed
{
	return (BOOL) kde_KActionMenu_delayed((kde_KActionMenu *)[self qt]);
}

- setDelayed: (BOOL)_delayed
{
	kde_KActionMenu_setDelayed((kde_KActionMenu *)[self qt], (int)_delayed);
	return self;
}

- (BOOL) stickyMenu
{
	return (BOOL) kde_KActionMenu_stickyMenu((kde_KActionMenu *)[self qt]);
}

- setStickyMenu: (BOOL)sticky
{
	kde_KActionMenu_setStickyMenu((kde_KActionMenu *)[self qt], (int)sticky);
	return self;
}

- (int) plug: (QWidget *)widget index: (int)index
{
	return (int) kde_KActionMenu_plug((kde_KActionMenu *)[self qt], (qt_QWidget *) [widget qt], (int)index);
}

- (int) plug: (QWidget *)widget 
{
	return (int) kde_KActionMenu_plug((kde_KActionMenu *)[self qt], (qt_QWidget *) [widget qt], -1);
}

- unplug: (QWidget *)widget
{
	kde_KActionMenu_unplug((kde_KActionMenu *)[self qt], (qt_QWidget *) [widget qt]);
	return self;
}

- setEnabled: (BOOL)b
{
	kde_KActionMenu_setEnabled((kde_KActionMenu *)[self qt], (int)b);
	return self;
}

//- setText: (int)identifier text: (NSString *)text
//{
//static qt_QString * _qstring_text = 0L;
//	kde_KActionMenu_setText((kde_KActionMenu *)[self qt], (int)identifier, (qt_QString *) [text toQString: &_qstring_text]);
//	return self;
//}

//- setIconSet: (int)identifier iconSet: (QIconSet*)iconSet
//{
//	kde_KActionMenu_setIconSet((kde_KActionMenu *)[self qt], (int)identifier, (qt_QIconSet*) [iconSet qt]);
//	return self;
//}

- setIconSet: (QIconSet*)i
{
	kde_KActionMenu_setIconSet1((kde_KActionMenu *)[self qt], (qt_QIconSet*) [i qt]);
	return self;
}

- setText: (NSString *)s
{
static qt_QString * _qstring_s = 0L;
	kde_KActionMenu_setText1((kde_KActionMenu *)[self qt], (qt_QString *) [s toQString: &_qstring_s]);
	return self;
}

@end
