]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/emptytable.h
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / emptytable.h
1 // -*- C++ -*-
2 /**
3  * \file emptytable.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef EMPTYTABLE_H
13 #define EMPTYTABLE_H
14
15 #include <QTableWidget>
16
17 class QMouseEvent;
18
19 /**
20  * A simple widget for a quick "preview" in TabularCreateDialog.
21  * The user can drag on the widget to change the table dimensions.
22  */
23 class EmptyTable : public QTableWidget {
24         Q_OBJECT
25 public:
26         EmptyTable(QWidget * parent = 0, int rows = 5, int columns = 5);
27
28         ~EmptyTable() {}
29
30         virtual QSize sizeHint() const;
31 public Q_SLOTS:
32         /// set the number of columns in the table and emit colsChanged() signal
33         void setNumberColumns(int nr_cols);
34         /// set the number of rows in the table and emit rowsChanged() signal
35         void setNumberRows(int nr_rows);
36 Q_SIGNALS:
37         /// the number of columns changed
38         void colsChanged(int);
39         /// the number of rows changed
40         void rowsChanged(int);
41 protected:
42         /// fill in a cell
43         virtual void paintCell(class QPainter *, int, int);
44 //      virtual void mouseMoveEvent(QMouseEvent *);
45
46         /// Reset all the cell size to default
47         virtual void resetCellSize();
48
49 private:
50         /// number of current columns
51         unsigned int cols;
52         /// number of current rows
53         unsigned int rows;
54
55 };
56
57 #endif