Version: 6.3.1

src/Qtx/QtxListBox.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File:      QtxListBox.h
00024 // Author:    Sergey TELKOV
00025 //
00026 #ifndef QTXLISTBOX_H
00027 #define QTXLISTBOX_H
00028 
00029 #include "Qtx.h"
00030 
00031 // This file isn't yet ported to Qt4 => there are some corrections for OCCViewer porting  -->
00032 //#include <qlistbox.h>
00033 #include <QListWidget>
00034 #include <QListWidgetItem>
00035 // <--
00036 
00037 #ifdef WIN32
00038 #pragma warning( disable:4251 )
00039 #endif
00040 
00041 class QLineEdit;
00042 class QValidator;
00043 
00044 class QTX_EXPORT QtxListBox : public QListWidget//QListBox // This file isn't yet ported to Qt4 => there are some corrections for OCCViewer porting
00045 {
00046     Q_OBJECT
00047 
00048 public:
00049     QtxListBox( QWidget* = 0, const char* = 0, Qt::WindowFlags = 0 );
00050     virtual ~QtxListBox();
00051 
00052     bool              isEditEnabled() const;
00053     bool              defaultEditAction() const;
00054     bool              isModificationEnabled() const;
00055 
00056     QListWidgetItem*  editedItem() const;
00057     int               editedIndex() const;
00058 
00059     void              startEdition( const int );
00060     void              startEdition( const QListWidgetItem* );
00061     void              endEdition( const bool );
00062 
00063     void              ensureItemVisible( const int );
00064     void              ensureItemVisible( const QListWidgetItem* );
00065 
00066     virtual bool      eventFilter( QObject*, QEvent* );
00067 
00068     const QValidator* validator() const;
00069 
00070     void              moveItemToTop( const int );
00071     void              moveItemToBottom( const int );
00072     void              moveItem( const int, const int );
00073 
00074     void              createItem( const int = -1 );
00075     void              deleteItem( const int = -1 );
00076 
00077 signals:
00078     void              itemEdited( int );
00079     void              itemEdited( QListWidgetItem* );
00080     void              itemMoved( int, int );
00081 
00082 public slots:
00083     virtual void      setEditEnabled( bool );
00084     virtual void      setDefaultEditAction( bool );
00085     virtual void      setModificationEnabled( bool );
00086 
00087     virtual void      clearValidator();
00088     virtual void      setValidator( const QValidator* );
00089     virtual void      setContentsPos( int, int );
00090 
00091 private slots:
00092     void              onContentsMoving( int, int );
00093 
00094 protected:
00095     virtual void      keyPressEvent( QKeyEvent* );
00096     virtual void      viewportResizeEvent( QResizeEvent* );
00097     virtual void      mouseDoubleClickEvent( QMouseEvent* );
00098 
00099 private:
00100     QLineEdit*        editor() const;
00101     void              createEditor();
00102     void              updateEditor();
00103 
00104 private:
00105     QLineEdit*        myEditor;
00106     int               myEditIndex;
00107     bool              myEditState;
00108     bool              myEditDefault;
00109     bool              myModifEnabled;
00110 };
00111 
00112 #ifdef WIN32
00113 #pragma warning( default:4251 )
00114 #endif
00115 
00116 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS