moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kvoctrain / kvoctrain / kvoctraintable.h
blob85ffb24934d1e6a925528554fad00f646d9b95ff
1 /***************************************************************************
3 table for kvoctrain
5 -----------------------------------------------------------------------
7 begin : Tue Jan 4 19:04:53 PST 2005
9 copyright :(C) 2005 Peter Hedlund
11 email : peter@peterandlinda.com
13 -----------------------------------------------------------------------
15 ***************************************************************************/
17 /***************************************************************************
18 * *
19 * This program is free software; you can redistribute it and/or modify *
20 * it under the terms of the GNU General Public License as published by *
21 * the Free Software Foundation; either version 2 of the License, or *
22 * (at your option) any later version. *
23 * *
24 ***************************************************************************/
26 #ifndef KVOCTRAINTABLE_H
27 #define KVOCTRAINTABLE_H
29 #include <qtable.h>
30 #include <qtimer.h>
32 #include "kvt-core/kvoctraindoc.h"
33 #include "kvt-core/kvoctrainexpr.h"
34 #include "kvoctraintableitem.h"
36 /**
37 @author Peter Hedlund
39 class KVocTrainTable : public QTable
41 Q_OBJECT
42 public:
43 public:
44 KVocTrainTable( kvoctrainDoc *_doc, const LangSet *ls, QWidget *parent = NULL, const char *name = NULL );
46 int currentItem() { return currentRow(); }
47 void setCurrentItem(int row);
48 int count() { return numRows(); }
50 void setModified(bool _dirty = true) { m_doc->setModified(_dirty); }
51 QString getIdent(int i) const { return m_doc->getIdent(i); }
52 QString getOriginalIdent() const { return m_doc->getOriginalIdent(); }
53 int findIdent(QString id) const { return m_doc->findIdent(id); }
54 void setCurrentRow(int row, int col);
55 void updateContents(int row = -1, int col = -1);
56 kvoctrainExpr *getRow(int row);
57 void setDoc(kvoctrainDoc *rows);
58 void setFont(const QFont &);
60 signals:
61 void selected(int row);
62 void rightButtonClicked(int header, int x, int y);
63 void forwardKeyPressEvent(QKeyEvent *);
64 void forwardKeyReleaseEvent(QKeyEvent *);
65 void edited(int, int);
67 public slots:
68 void sortByColumn_alpha(int index);
69 void sortByColumn_index(int index);
70 void slotSelectionChanged();
72 protected slots:
73 void menuTriggerTimeout();
74 void headerReleaseEvent(int sec);
75 void headerPressEvent(int sec);
77 protected:
78 int current;
79 QWidget* beginEdit(int row, int col, bool replace);
80 void endEdit(int row, int col, bool accept, bool replace);
81 void paintCell(QPainter *p, int row, int col, const QRect &cr, bool selected, const QColorGroup &cg);
82 void setItem(int row, int col, QTableItem * item);
83 QTableItem* item (int row, int col) const;
84 void keyPressEvent(QKeyEvent *e);
85 void keyReleaseEvent(QKeyEvent *e);
86 void contentsMousePressEvent(QMouseEvent *e);
87 void contentsMouseDoubleClickEvent(QMouseEvent *e);
88 void activateNextCell();
90 private:
91 kvoctrainDoc * m_doc;
92 void sortByColumn(int, bool);
93 const LangSet* langs;
94 //const GradeCols *gradecols;
95 KVocTrainTableItem *defaultItem;
96 QTimer *delayTimer;
97 int triggerSect;
98 QPixmap m_pixInactive;
99 QPixmap m_pixInQuery;
102 #endif