1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : VisuGUI_TableDlg.h
23 // Author : Vadim SANDLER
26 #ifndef VisuGUI_TABLE_DLG_H
27 #define VisuGUI_TABLE_DLG_H
31 #include <QPushButton>
32 #include <QItemDelegate>
35 class VisuGUI_TableWidget;
37 #include <SALOMEDSClient_SObject.hxx>
39 #include "VisuGUITools.h"
41 class VISU_GUITOOLS_EXPORT VisuGUI_TableDlg : public QDialog
47 enum { ttNone, ttInt, ttReal, ttBoth, ttAuto };
49 VisuGUI_TableDlg( QWidget* parent,
53 Qt::Orientation orient = Qt::Horizontal,
54 bool showColumnTitles = true );
58 void keyPressEvent( QKeyEvent* e );
68 VisuGUI_TableWidget* myIntTable;
69 VisuGUI_TableWidget* myRealTable;
71 QPushButton* myCancelBtn;
72 QPushButton* myHelpBtn;
74 _PTR(SObject) myObject;
77 class VISU_GUITOOLS_EXPORT VisuGUI_TableWidget : public QWidget
81 VisuGUI_TableWidget( QWidget* parent = 0,
84 Qt::Orientation orient = Qt::Horizontal,
85 bool showColumnTitles = true );
86 ~VisuGUI_TableWidget();
88 void setTableTitle( const QString& title );
89 QString getTableTitle();
90 void setNumRows( const int num );
92 void setNumCols( const int num );
94 void setRowTitles( QStringList& tlts );
95 void getRowTitles( QStringList& tlts );
96 void setColTitles( QStringList& tlts );
97 void getColTitles( QStringList& tlts );
98 void setUnitsTitle( const QString& tlt );
99 void setUnits( QStringList& units );
100 void getUnits( QStringList& units );
101 void setRowData( int row, QStringList& data );
102 void getRowData( int row, QStringList& data );
104 QTableWidget* getTable() { return myTable; }
105 QLineEdit* getTitleEdit() { return myTitleEdit; }
107 bool eventFilter( QObject* o, QEvent* e);
110 void updateButtonsState();
120 QLineEdit* myTitleEdit;
121 QTableWidget* myTable;
122 QPushButton* myAddRowBtn;
123 QPushButton* myAddColBtn;
124 QPushButton* myDelRowBtn;
125 QPushButton* myDelColBtn;
126 QPushButton* myAdjustBtn;
127 QPushButton* mySelectAllBtn;
128 QPushButton* myClearBtn;
129 Qt::Orientation myOrientation;
132 class VISU_GUITOOLS_EXPORT NumDelegateItem: public QItemDelegate
135 enum NumValidator{ NV_Int, NV_Real };
137 NumDelegateItem( QObject* parent, NumValidator mode = NV_Int );
138 virtual ~NumDelegateItem();
140 virtual QWidget * createEditor( QWidget * parent,
141 const QStyleOptionViewItem & option,
142 const QModelIndex & index ) const;
143 virtual void setEditorData( QWidget * editor,
144 const QModelIndex & index ) const;
149 #endif // VisuGUI_TABLE_DLG_H