/***************************************************************************
                            KToolBarButton.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_KToolBarButton.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KToolBarButton.h>
#include <kdeobjc/KInstance.h>
#include <qtobjc/QIconSet.h>
#include <qtobjc/QPainter.h>
#include <qtobjc/QPalette.h>
#include <qtobjc/QPixmap.h>
#include <qtobjc/QPopupMenu.h>

#include <kdeobjc/KGlobal.h>

@implementation  KToolBarButton


- initWithText: (NSString *)icon identifier: (int)identifier parent: (QWidget *)parent name: (NSString *)name txt: (NSString *)txt _instance: (KInstance*)_instance
{
static qt_QString * _qstring_txt = 0L;
static qt_QString * _qstring_icon = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KToolBarButton((qt_QString *) [icon toQString: &_qstring_icon], (int)identifier, (qt_QWidget *) [parent qt], (char*) [name cString], (qt_QString *) [txt toQString: &_qstring_txt], (kde_KInstance*) [_instance qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)icon identifier: (int)identifier parent: (QWidget *)parent 
{
static qt_QString * _qstring_icon = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KToolBarButton((qt_QString *) [icon toQString: &_qstring_icon], (int)identifier, (qt_QWidget *) [parent qt], 0L, qt_QString_null(), [KGlobal instance])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithPixmap: (QPixmap *)pixmap identifier: (int)identifier parent: (QWidget *)parent name: (NSString *)name txt: (NSString *)txt
{
static qt_QString * _qstring_txt = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KToolBarButton1((qt_QPixmap *) [pixmap qt], (int)identifier, (qt_QWidget *) [parent qt], (char*) [name cString], (qt_QString *) [txt toQString: &_qstring_txt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithPixmap: (QPixmap *)pixmap identifier: (int)identifier parent: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KToolBarButton1((qt_QPixmap *) [pixmap qt], (int)identifier, (qt_QWidget *) [parent qt], 0L, qt_QString_null())];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KToolBarButton2((qt_QWidget *) [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_KToolBarButton2(0L, 0L)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parentWidget: YES] == nil) {
			kde_del_KToolBarButton((kde_KToolBarButton *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setEnabled: (BOOL)enable
{
	kde_KToolBarButton_setEnabled((kde_KToolBarButton *)[self qt], (int)enable);
	return self;
}

- setEnabled
{
	kde_KToolBarButton_setEnabled((kde_KToolBarButton *)[self qt], 1);
	return self;
}

- setPixmap: (QPixmap *)pixmap
{
	kde_KToolBarButton_setPixmap((kde_KToolBarButton *)[self qt], (qt_QPixmap *) [pixmap qt]);
	return self;
}

//- setPixmap: (QPixmap *)pixmap generate: (BOOL)generate
//{
//	kde_KToolBarButton_setPixmap1((kde_KToolBarButton *)[self qt], (qt_QPixmap *) [pixmap qt], (int)generate);
//	return self;
//}

- setDefaultPixmap: (QPixmap *)pixmap
{
	kde_KToolBarButton_setDefaultPixmap((kde_KToolBarButton *)[self qt], (qt_QPixmap *) [pixmap qt]);
	return self;
}

- setDisabledPixmap: (QPixmap *)pixmap
{
	kde_KToolBarButton_setDisabledPixmap((kde_KToolBarButton *)[self qt], (qt_QPixmap *) [pixmap qt]);
	return self;
}

- setText: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	kde_KToolBarButton_setText((kde_KToolBarButton *)[self qt], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

- setIcon: (NSString *)icon
{
static qt_QString * _qstring_icon = 0L;
	kde_KToolBarButton_setIcon((kde_KToolBarButton *)[self qt], (qt_QString *) [icon toQString: &_qstring_icon]);
	return self;
}

- setIcon: (NSString *)icon generate: (BOOL)generate
{
static qt_QString * _qstring_icon = 0L;
	kde_KToolBarButton_setIcon1((kde_KToolBarButton *)[self qt], (qt_QString *) [icon toQString: &_qstring_icon], (int)generate);
	return self;
}

- setDefaultIcon: (NSString *)icon
{
static qt_QString * _qstring_icon = 0L;
	kde_KToolBarButton_setDefaultIcon((kde_KToolBarButton *)[self qt], (qt_QString *) [icon toQString: &_qstring_icon]);
	return self;
}

- setDisabledIcon: (NSString *)icon
{
static qt_QString * _qstring_icon = 0L;
	kde_KToolBarButton_setDisabledIcon((kde_KToolBarButton *)[self qt], (qt_QString *) [icon toQString: &_qstring_icon]);
	return self;
}

- setIconSet: (QIconSet*)iconset
{
	kde_KToolBarButton_setIconSet((kde_KToolBarButton *)[self qt], (qt_QIconSet*) [iconset qt]);
	return self;
}

- on: (BOOL)flag
{
	kde_KToolBarButton_on((kde_KToolBarButton *)[self qt], (int)flag);
	return self;
}

- on
{
	kde_KToolBarButton_on((kde_KToolBarButton *)[self qt], 1);
	return self;
}

- toggle
{
	kde_KToolBarButton_toggle((kde_KToolBarButton *)[self qt]);
	return self;
}

- setToggle: (BOOL)toggle
{
	kde_KToolBarButton_setToggle((kde_KToolBarButton *)[self qt], (int)toggle);
	return self;
}

- setToggle
{
	kde_KToolBarButton_setToggle((kde_KToolBarButton *)[self qt], 1);
	return self;
}

- (QPopupMenu*) popup
{
	return (QPopupMenu*) [QtSupport objectForQtKey: kde_KToolBarButton_popup((kde_KToolBarButton *)[self qt]) withClass: [QPopupMenu class] allocatedInObjcWorld: YES];
}

- setPopup: (QPopupMenu*)p toggle: (BOOL)toggle
{
	kde_KToolBarButton_setPopup((kde_KToolBarButton *)[self qt], (qt_QPopupMenu*) [p qt], (int)toggle);
	return self;
}

- setPopup: (QPopupMenu*)p 
{
	kde_KToolBarButton_setPopup((kde_KToolBarButton *)[self qt], (qt_QPopupMenu*) [p qt], 0);
	return self;
}

- setDelayedPopup: (QPopupMenu*)p toggle: (BOOL)toggle
{
	kde_KToolBarButton_setDelayedPopup((kde_KToolBarButton *)[self qt], (qt_QPopupMenu*) [p qt], (int)toggle);
	return self;
}

- setDelayedPopup: (QPopupMenu*)p 
{
	kde_KToolBarButton_setDelayedPopup((kde_KToolBarButton *)[self qt], (qt_QPopupMenu*) [p qt], 0);
	return self;
}

- setRadio: (BOOL)f
{
	kde_KToolBarButton_setRadio((kde_KToolBarButton *)[self qt], (int)f);
	return self;
}

- setRadio
{
	kde_KToolBarButton_setRadio((kde_KToolBarButton *)[self qt], 1);
	return self;
}

- setNoStyle: (BOOL)no_style
{
	kde_KToolBarButton_setNoStyle((kde_KToolBarButton *)[self qt], (int)no_style);
	return self;
}

- setNoStyle
{
	kde_KToolBarButton_setNoStyle((kde_KToolBarButton *)[self qt], 1);
	return self;
}

- modeChange
{
	kde_KToolBarButton_modeChange((kde_KToolBarButton *)[self qt]);
	return self;
}

- setTextLabel: (NSString *)arg1 tipToo: (BOOL)tipToo
{
static qt_QString * _qstring_arg1 = 0L;
	kde_KToolBarButton_setTextLabel((kde_KToolBarButton *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)tipToo);
	return self;
}

- paletteChange: (QPalette *)arg1
{
	kde_KToolBarButton_paletteChange((kde_KToolBarButton *)[self qt], (qt_QPalette *) [arg1 qt]);
	return self;
}

- drawButton: (QPainter *)p
{
	kde_KToolBarButton_drawButton((kde_KToolBarButton *)[self qt], (qt_QPainter *) [p qt]);
	return self;
}

- (BOOL) eventFilter: (QObject *)o e: (QEvent *)e
{
	return (BOOL) kde_KToolBarButton_eventFilter((kde_KToolBarButton *)[self qt], (qt_QObject *) [o qt], (qt_QEvent *) [e qt]);
}

- showMenu
{
	kde_KToolBarButton_showMenu((kde_KToolBarButton *)[self qt]);
	return self;
}

- (QSize*) sizeHint
{
	return (QSize*) [QtSupport objectForQtKey: kde_KToolBarButton_sizeHint((kde_KToolBarButton *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- (QSize*) minimumSizeHint
{
	return (QSize*) [QtSupport objectForQtKey: kde_KToolBarButton_minimumSizeHint((kde_KToolBarButton *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- (QSize*) minimumSize
{
	return (QSize*) [QtSupport objectForQtKey: kde_KToolBarButton_minimumSize((kde_KToolBarButton *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

//- makeDefaultPixmap
//{
//	kde_KToolBarButton_makeDefaultPixmap((kde_KToolBarButton *)[self qt]);
//	return self;
//}

//- makeDisabledPixmap
//{
//	kde_KToolBarButton_makeDisabledPixmap((kde_KToolBarButton *)[self qt]);
//	return self;
//}

- slotClicked
{
	kde_KToolBarButton_slotClicked((kde_KToolBarButton *)[self qt]);
	return self;
}

- slotPressed
{
	kde_KToolBarButton_slotPressed((kde_KToolBarButton *)[self qt]);
	return self;
}

- slotReleased
{
	kde_KToolBarButton_slotReleased((kde_KToolBarButton *)[self qt]);
	return self;
}

- slotToggled
{
	kde_KToolBarButton_slotToggled((kde_KToolBarButton *)[self qt]);
	return self;
}

- slotDelayTimeout
{
	kde_KToolBarButton_slotDelayTimeout((kde_KToolBarButton *)[self qt]);
	return self;
}

@end
