/***************************************************************************
copyright : (C) 1999 by Edwin Glaser
email : edwin@pannenleiter.de
version : $Id: dbpainter.h,v 1.1.1.1 2000/02/07 21:42:02 ege Exp $
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DBPAINTER_H
#define DBPAINTER_H
/**
*@author Edwin Glaser
*/
#include <qwidget.h>
#include <qstring.h>
#include <qpainter.h>
class DBDataSource;
/** A widget used in a DBGrid needs a DBPainter
*
* @author Edwin Glaser
* @version $Name: $ $Date: 2000/02/07 21:42:02 $
*/
class DBPainter
{
public:
/** Draw a representation of the database value into a cell of a DBGrid.
* The datasource of the grid points to the proper record.
*
* @param painter A painter with a reasonable font and color.
* @param width The width of the cell.
* @param height The height of the cell.
* @param align The alignment is the bitwise OR of the QLabel alignment flags
* @param format A printf or strftime format string. WARNING the resust string must not exeed 8000 bytes!
*/
virtual void paint (QPainter *painter, int width, int height, int align = 0, const char *format = 0) = 0;
protected:
static const int bufferSize = 8001;
/** The paint method my use this generic method.
*/
static void doPaint (QString &str, QPainter *painter, int width, int height, int align = 0);
};
/** A widget used in a DBGrid needs a DBWidgetFactory
*
* @author Edwin Glaser
* @version $Name: $ $Date: 2000/02/07 21:42:02 $
*/
class DBWidgetFactory
{
public:
/** Returns the single factory object. Do not delete it!
*/
static DBWidgetFactory *getFactory() { return 0; };
/** Returns a new Editor.
*/
virtual QWidget *makeEditor(DBDataSource *d, int col, QWidget *parent) = 0;
/** Returns a painter for inactive cells.
*/
virtual DBPainter *makePainter (QWidget *editor) = 0;
};
#endif
Documentation generated by eg@wonko on Sam Feb 19 00:09:53 MET 2000