Salome HOME
Join modifications from branch BR_3_1_0deb
[modules/gui.git] / src / ObjBrowser / OB_ListView.cxx
index c815071ff2b0134390292d2dbcb2076b399f3985..53d62602f15de6c4a942c31afe9fb39d5af1672c 100755 (executable)
@@ -1,3 +1,21 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
 #include "OB_ListView.h"
 
 #include "OB_Filter.h"
@@ -144,3 +162,39 @@ bool OB_ListView::isDropAccepted( QListViewItem* drag, QListViewItem* drop ) con
 
   return dropObj->isDropAccepted( dragObj );
 }
+
+void OB_ListView::setColumnWidth( int col, int width )
+{
+  int max = columnMaxWidth( col );
+  if( max>0 && width>max )
+    width = max;
+  QListView::setColumnWidth( col, width );
+}
+
+int OB_ListView::columnMaxWidth( const int col ) const
+{
+  int res = -1;
+  if( myMaxColWidth.contains( col ) )
+    res = myMaxColWidth[col];
+  else if( myMaxColRatio.contains( col ) )
+    res = int( myMaxColRatio[col]*height() );
+  return res;
+}
+
+void OB_ListView::setColumnMaxWidth( const int col, const int w )
+{
+  myMaxColWidth.insert( col, w );
+}
+
+double OB_ListView::columnMaxRatio( const int col ) const
+{
+  double res = 0.0;
+  if( myMaxColRatio.contains( col ) )
+    res = myMaxColRatio[col];
+  return res;
+}
+
+void OB_ListView::setColumnMaxRatio( const int col, const double r )
+{
+  myMaxColRatio.insert( col, r );
+}