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

#include <qwidget.h>
#include <qtableview.h>

#include "dbdatasource.h"
#include "dbgrid.h"
#include "common.h"

struct ColumnDesc
{
  int col;
  int section; 
  QCString label;
  int width;
  int orgWidth;
  DBGrid::WidthMode mode;
  DBWidgetFactory *factory;
  QWidget *editor;
  DBPainter *painter;
  int align;
  QCString format;
};

class QHeader;

/**
  *@author Edwin Glaser
  */

class DBTableView : public QTableView
{
  Q_OBJECT

protected:

  DBDataSource *data;
  DBGrid *grid;
  bool enabled;
  bool delayEnabled;

  QColorGroup *col0color;

  int currentRow;
  int currentCol;
  bool hasInsertRow;
  bool showsEditor;
  bool editorNeedsFocus;
  bool checkColumn;
  bool inEditorCheck;

  bool widgetsDisabled;
    	
public:

  DBTableView(DBDataSource *d, QHeader *h, DBGrid *parent=0, const char *name=0);
  virtual ~DBTableView();

  void setLineHeigth(int h) { setCellHeight(h); };  // FIXME: query editor and painter

  bool ownesFocus () const;
  void setCurrentColumn(int col);

  bool collectKeys;
  QString keystrokes;
  
protected:

  QWidget *checkEditor();
  void checkRows();
  virtual void mousePressEvent ( QMouseEvent * );
  virtual void focusInEvent (QFocusEvent *); 
  virtual void focusOutEvent (QFocusEvent *); 
  virtual bool focusNextPrevChild (bool next);
  virtual void keyPressEvent ( QKeyEvent *);
  virtual void resizeEvent ( QResizeEvent * );
  virtual int cellWidth (int col);
  virtual void setupPainter( QPainter * );
  virtual void paintCell (QPainter *, int row, int col);
  void updateRows(int row1, int row2);
  bool assertVisible(int row);
  bool assertVisible(int row, int col);
  void moveTo(int row, int col);
  void paintEvent( QPaintEvent * );

protected slots:

  void offsetChanged(int);
 
public slots:

  virtual void stateChanged();
  virtual void cursorChanged();
  virtual void dataChanged(int column);
  virtual void columnChanged();

};

#endif

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