/***************************************************************************
                            KWordWrap.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_KWordWrap.h>
#include <kdeobjc/KDESupport.h>
#include <qtobjc/Qt.h>
#include <kdeobjc/KWordWrap.h>
#include <qtobjc/QFontMetrics.h>
#include <qtobjc/QPainter.h>
#include <qtobjc/QRect.h>


@implementation  KWordWrap

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


- (QRect*) boundingRect
{
	return (QRect*) [QtSupport objectForQtKey: kde_KWordWrap_boundingRect((kde_KWordWrap *)[self qt]) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- (NSString *) wrappedString
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KWordWrap_wrappedString((kde_KWordWrap *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) truncatedString: (BOOL)dots
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KWordWrap_truncatedString((kde_KWordWrap *)[self qt], (int)dots);
	return [NSString fromQString: _qstring];
}

- drawText: (QPainter *)painter x: (int)x y: (int)y flags: (int)flags
{
	kde_KWordWrap_drawText((kde_KWordWrap *)[self qt], (qt_QPainter *) [painter qt], (int)x, (int)y, (int)flags);
	return self;
}

- drawText: (QPainter *)painter x: (int)x y: (int)y 
{
	kde_KWordWrap_drawText((kde_KWordWrap *)[self qt], (qt_QPainter *) [painter qt], (int)x, (int)y, [Qt AlignAuto]);
	return self;
}

+ (KWordWrap*) formatText: (QFontMetrics *)fm r: (QRect*)r flags: (int)flags str: (NSString *)str len: (int)len
{
static qt_QString * _qstring_str = 0L;
	return (KWordWrap*) [QtSupport objectForQtKey: kde_KWordWrap_formatText((qt_QFontMetrics *) [fm qt], (qt_QRect*) [r qt], (int)flags, (qt_QString *) [str toQString: &_qstring_str], (int)len) withClass: [KWordWrap class] allocatedInObjcWorld: YES];
}

+ (KWordWrap*) formatText: (QFontMetrics *)fm r: (QRect*)r flags: (int)flags str: (NSString *)str 
{
static qt_QString * _qstring_str = 0L;
	return (KWordWrap*) [QtSupport objectForQtKey: kde_KWordWrap_formatText((qt_QFontMetrics *) [fm qt], (qt_QRect*) [r qt], (int)flags, (qt_QString *) [str toQString: &_qstring_str], -1) withClass: [KWordWrap class] allocatedInObjcWorld: YES];
}

@end
