/***************************************************************************
                            KHelpMenu.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_KHelpMenu.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KHelpMenu.h>
#include <kdeobjc/KAboutData.h>
#include <kdeobjc/KActionCollection.h>
#include <qtobjc/QWidget.h>


@implementation  KHelpMenu


- initWithWidget: (QWidget *)parent aboutAppText: (NSString *)aboutAppText showWhatsThis: (BOOL)showWhatsThis
{
static qt_QString * _qstring_aboutAppText = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KHelpMenu((qt_QWidget *) [parent qt], (qt_QString *) [aboutAppText toQString: &_qstring_aboutAppText], (int)showWhatsThis)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithWidget: (QWidget *)parent aboutData: (KAboutData*)aboutData showWhatsThis: (BOOL)showWhatsThis actions: (KActionCollection*)actions
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KHelpMenu1((qt_QWidget *) [parent qt], (kde_KAboutData*) [aboutData qt], (int)showWhatsThis, (kde_KActionCollection*) [actions qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)parent aboutData: (KAboutData*)aboutData 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KHelpMenu1((qt_QWidget *) [parent qt], (kde_KAboutData*) [aboutData qt], 1, 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_KHelpMenu((kde_KHelpMenu *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KPopupMenu*) menu
{
	return (KPopupMenu*) [QtSupport objectForQtKey: kde_KHelpMenu_menu((kde_KHelpMenu *)[self qt]) withClass: [KPopupMenu class] allocatedInObjcWorld: YES];
}

- appHelpActivated
{
	kde_KHelpMenu_appHelpActivated((kde_KHelpMenu *)[self qt]);
	return self;
}

- contextHelpActivated
{
	kde_KHelpMenu_contextHelpActivated((kde_KHelpMenu *)[self qt]);
	return self;
}

- aboutApplication
{
	kde_KHelpMenu_aboutApplication((kde_KHelpMenu *)[self qt]);
	return self;
}

- aboutKDE
{
	kde_KHelpMenu_aboutKDE((kde_KHelpMenu *)[self qt]);
	return self;
}

- reportBug
{
	kde_KHelpMenu_reportBug((kde_KHelpMenu *)[self qt]);
	return self;
}

+ (int) menuHelpContents
{
	return (int) KHELPMENU_menuHelpContents;
}

+ (int) menuWhatsThis
{
	return (int) KHELPMENU_menuWhatsThis;
}

+ (int) menuAboutApp
{
	return (int) KHELPMENU_menuAboutApp;
}

+ (int) menuAboutKDE
{
	return (int) KHELPMENU_menuAboutKDE;
}

+ (int) menuReportBug
{
	return (int) KHELPMENU_menuReportBug;
}

@end
