~ubuntu-branches/ubuntu/maverick/datakiosk/maverick

« back to all changes in this revision

Viewing changes to src/datakiosk/src/datatableview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-06-27 22:48:06 UTC
  • Revision ID: james.westby@ubuntu.com-20050627224806-8farkci1dc2onhbs
Tags: upstream-0.7
ImportĀ upstreamĀ versionĀ 0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
*   Copyright (C) 2005 by Adam Treat                                      *
 
3
*   treat@kde.org                                                         *
 
4
*                                                                         *
 
5
*   This program is free software; you can redistribute it and/or modify  *
 
6
*   it under the terms of the GNU General Public License as published by  *
 
7
*   the Free Software Foundation; either version 2 of the License, or     *
 
8
*   (at your option) any later version.                                   *
 
9
*                                                                         *
 
10
***************************************************************************/
 
11
 
 
12
#ifndef DATATABLEVIEW_H
 
13
#define DATATABLEVIEW_H
 
14
 
 
15
#include <qdatatable.h>
 
16
 
 
17
class DataTable;
 
18
 
 
19
class DataTableView : public QDataTable
 
20
{
 
21
    Q_OBJECT
 
22
public:
 
23
    enum SelectionMode { Default = 0, MouseOver = 1 };
 
24
    DataTableView( DataTable *parent = 0, const char *name = 0 );
 
25
 
 
26
    virtual ~DataTableView();
 
27
 
 
28
    QColor selectionColor() const;
 
29
 
 
30
    SelectionMode selectionMode() const;
 
31
    void setSelectionMode( SelectionMode m );
 
32
 
 
33
public slots:
 
34
    void setSelectionColor( const QColor &color );
 
35
    virtual void columnWidthChanged( int col );
 
36
    virtual void setColumnWidth( int col, int w );
 
37
    void slotSelectFirstRow( bool updateCursor = true );
 
38
    void slotSelectPrevRow( bool updateCursor = true );
 
39
    void slotSelectNextRow( bool updateCursor = true );
 
40
    void slotSelectLastRow( bool updateCursor = true );
 
41
    void slotSelectRow( int row, bool updateCursor = true );
 
42
 
 
43
protected:
 
44
    void handleError( const QSqlError & error );
 
45
    virtual void paintCell( QPainter * p, int row, int col, const QRect & cr,
 
46
                            bool selected, const QColorGroup &cg );
 
47
    virtual void paintField( QPainter * p, const QSqlField* field,
 
48
                             const QRect & cr, bool b );
 
49
 
 
50
    QWidget* beginEdit( int row, int col, bool replace = false );
 
51
 
 
52
    virtual void sortColumn( int col, bool ascending = true, bool wholeRows = false );
 
53
    virtual void contentsContextMenuEvent( QContextMenuEvent *e );
 
54
    virtual void contentsMouseMoveEvent( QMouseEvent * e );
 
55
 
 
56
private:
 
57
    DataTable *m_dataTable;
 
58
    QColor m_selectionColor;
 
59
    SelectionMode m_mode;
 
60
};
 
61
 
 
62
#endif