1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #ifndef YACSGui_PlusMinusGrp_H
22 #define YACSGui_PlusMinusGrp_H
24 #include "QtxGroupBox.h"
25 #include <qstringlist.h>
31 Class : YACSGui_PlusMinusGrp
32 Description : Group box containing data table and "plus" "minus" "insert" "up" and "down" buttons
36 class YACSGui_PlusMinusGrp : public QtxGroupBox
42 enum { PlusBtn = 0x1, MinusBtn = 0x2, InsertBtn = 0x4, UpBtn = 0x8, DownBtn = 0x10, SelectBtn = 0x20,
43 AllBtn = PlusBtn | MinusBtn | InsertBtn | UpBtn | DownBtn | SelectBtn };
46 YACSGui_PlusMinusGrp( QWidget* theParent, const QString& theTitle, const int theBtns = AllBtn );
47 virtual ~YACSGui_PlusMinusGrp();
49 YACSGui_Table* Table();
50 void ShowBtn( const int = AllBtn );
51 void HideBtn( const int = AllBtn );
53 /*! buttons become enabled or disabled depending on number of rows at a table
54 and max allowed number of rows for this table
55 parameter: defines which buttons will be enabled/disabled
57 void EnableBtn( const int = AllBtn );
58 void EnableBtn( const int, bool theEnable );
60 /*! Returns the tool button with given id
61 parameter: defines tool buttons' id
63 QToolButton* Btn( const int ) const;
65 /*! Set min allowed number of rows at the table.
68 inline void SetMinNumRow( const int theMinRow ) { myMinNumRow = theMinRow; };
71 returns min allowed number of strings for table or 0
73 inline int MinNumRow() { return myMinNumRow; }
75 /*! Set max allowed number of rows at the table.
76 It is -1 by default. That means that number of rows is not limited
78 inline void SetMaxNumRow( const int theMaxRow ) { myMaxNumRow = theMaxRow; };
81 returns max allowed number of strings for table or -1
83 inline int MaxNumRow() { return myMaxNumRow; }
85 /*! Set the row number before which a new row will be added in case of "Plus" button
86 or "Insert" button with empty rows selection in the table.
87 It is -1 by default. That means that row is added to the end of the table
89 inline void SetAddBeforeRowNum( const int theAddBeforeRowNum ) { myAddBeforeRowNum = theAddBeforeRowNum; };
92 returns the row number before which a new row will be added or -1
94 inline int AddBeforeRowNum() { return myAddBeforeRowNum; }
97 untoggled the selection button
102 void MovedUp( const int theUpRowId );
103 void MovedDown( const int theDownRowId );
104 void Inserted( const int theInsRowId );
105 void initSelection( const int theRowId, const int theColId );
106 void Added( const int theRowId );
107 void Removed( const int theRowId );
111 /*! SLOT which called when button Up is pressed.
112 Moves up the selected row by one row.
116 /*! SLOT which called when button Down is pressed.
117 Moves down the selected row by one row.
121 /*! SLOT which called when button Insert is pressed.
122 Adds new row before selected.
126 /*! SLOT which called when button Select is pressed.
127 Emits the signal to start the selection in the tree.
128 The selected object have to be put into the current cell.
130 void onSelect( bool );
132 /*! SLOT which called when button Add is pressed.
133 Adds new string at table's bottom.
137 /*! SLOT which called when button Remove is pressed.
138 Removed selected row from table.
142 /*! SLOT which called whenever a selection in the table changes
143 or the current cell has changed.
144 Apdated the enable/disable states of the tool buttons.
146 void onTableSelectionChanged();
151 int myAddBeforeRowNum;
153 YACSGui_Table* myTable;
154 QToolButton* myAddBtn;
155 QToolButton* myInsertBtn;
156 QToolButton* myRemoveBtn;
157 QToolButton* myUpBtn;
158 QToolButton* myDownBtn;
159 QToolButton* mySelectBtn;