/***************************************************************************
    copyright     : (C) 1999 by Edwin Glaser
    email         : edwin@pannenleiter.de
    version       : $Id: dbcheckbox.h,v 1.1.1.1 2000/02/07 21:41:48 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 DBCHECKBOX_H
#define DBCHECKBOX_H

#include <qwidget.h>
#include <qcheckbox.h>
#include <qpixmap.h>

#include "dbdatasource.h"
#include "dbpainter.h"

/**
  * A data-aware checkbox
  * 
  *@author Edwin Glaser
  */

class DBCheckBox : public QCheckBox, public DBPainter  {
   Q_OBJECT

protected:
   DBDataSource *data;
   int column;
   bool userEnabled;
   bool dbSlot;
   bool textSlot;

   static const char *check_xpm[];
   static const char *uncheck_xpm[];
   static bool isInit;
   static QPixmap *cpixmap;
   static QPixmap *upixmap;

public: 
	DBCheckBox(DBDataSource *d, int col, QWidget *parent=0, const char *name=0);
	virtual ~DBCheckBox();
	virtual void paint (QPainter *p, int width, int height, int align = 0, const char *format = 0);

	DBDataSource *getDataSource() { return data; };
	int getColumn() { return column; };

protected slots:

	virtual void toggled(bool);
	virtual void checkEnabled();
	virtual void stateChanged();
	virtual void dbTextChanged();
	virtual void dbTextChanged(int column);

public slots:
  virtual void setEnabled ( bool );
};

class DBCheckBoxFactory : public DBWidgetFactory
{
protected:
  static DBCheckBoxFactory *instance;
	DBCheckBoxFactory() {};
	
public:
	static DBWidgetFactory *getFactory();
	virtual QWidget *makeEditor(DBDataSource *d, int col, QWidget *parent);
	virtual DBPainter *makePainter (QWidget *editor);
};

#endif



Documentation generated by eg@wonko on Sam Feb 19 00:09:53 MET 2000