Back to index

salome-gui  6.5.0
QtxComboBox.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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:      QtxComboBox.h
00024 // Author:    Sergey TELKOV
00025 //
00026 #ifndef QTXCOMBOBOX_H
00027 #define QTXCOMBOBOX_H
00028 
00029 #include "Qtx.h"
00030 
00031 #include <QMap>
00032 #include <QComboBox>
00033 
00034 #ifdef WIN32
00035 #pragma warning( disable:4251 )
00036 #endif
00037 
00038 class QTX_EXPORT QtxComboBox : public QComboBox
00039 {
00040   Q_OBJECT
00041 
00042   class Model;
00043   class ClearEvent;
00044 
00045 public:
00046   QtxComboBox( QWidget* = 0 );
00047   virtual ~QtxComboBox();
00048 
00049   bool         isCleared() const;
00050   void         setCleared( const bool );
00051 
00052   int          currentId() const;
00053   void         setCurrentId( int );
00054 
00055   int          id( const int ) const;
00056   int          index( const int ) const;
00057 
00058   bool         hasId( const int ) const;
00059   void         setId( const int, const int );
00060 
00061 signals:
00062   void         activatedId( int );
00063 
00064 private slots:
00065   void         onCurrentChanged( int );
00066 
00067 protected:
00068   virtual void paintEvent( QPaintEvent* );
00069   virtual void childEvent( QChildEvent* );
00070   virtual void customEvent( QEvent* );
00071 
00072 private:
00073   void         resetClear();
00074 
00075 private:
00076   enum { IdRole = Qt::UserRole + 10 };
00077 
00078 private:
00079   bool         myCleared;     
00080 };
00081 
00082 #ifdef WIN32
00083 #pragma warning( default:4251 )
00084 #endif
00085 
00086 #endif