/***************************************************************************
                            KPixmapSplitter.h -  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.                       *
 *                                                                         *
 ***************************************************************************/

#ifndef KPIXMAPSPLITTER_H
#define KPIXMAPSPLITTER_H

#include <Foundation/NSObject.h>
#include <Foundation/NSString.h>
#include <qtobjc/QtSupport.h>

/**

 If you have a pixmap containing several items (icons), you can use this
 class to get the coordinates of each item.

 For example, if you have a pixmap with 25 items and you want to get the
 4th item as a pixmap (every item being 20x10 pixels):
 <pre>
 KPixmapSplitter splitter;
 splitter.setPixmap( somePixmap );
 splitter.setItemSize( QSize( 20, 10 ));

 QPixmap item( 20, 10 );
 item.fill( -[Qt white]);
 QRect rect = splitter.coordinates( 4 );
 if ( !rect.-isEmpty )
     bitBlt( &item, QPoint(0,0), &somePixmap, rect, CopyROP );
 </pre>

 @author Carsten Pfeiffer <pfeiffer@kde.org>
 
 @short A class to split a pixmap into several items.

*/
@class QPixmap; 
@class QRect; 
@class QSize; 

@interface  KPixmapSplitter : NSObject <QtSupport>
{
@private
	void * _qt;
	BOOL  _allocatedInObjcWorld;
}

/** 
 Constructor, does nothing but initializing some default-values.
     
*/
- init;
- (void) dealloc;

/** 
 Sets the pixmap to be splitted.
     
*/
- setPixmap: (QPixmap *)pixmap;

/** 

*/
- (QPixmap*) pixmap;

/** 
 Sets the size of the items you want to get out of the given pixmap.
 The QRect of @ref coordinates will have the width and height of exactly
 this @p size.
     
*/
- setItemSize: (QSize *)size;

/** 

*/
- (QSize*) itemSize;

/** 
 If there is space between rows in the given pixmap, you have to specify
 how many pixels there are.
     
*/
- setVSpacing: (int)spacing;

/** 
 If there is space between columns in the given pixmap, you have to
 specify how many pixels there are.
     
*/
- setHSpacing: (int)spacing;

/** 

*/
- (QRect*) coordinates: (int)pos;

/** 
 Overloaded for convenience. Returns the item at the position of the
 given character (when using a latin1 font-pixmap)
     
*/
- (QRect*) coordinatesForCh: (unichar *)ch;
@end

#endif
