Back to index

salome-gui  6.5.0
QDS_RadioBox.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 #ifndef QDS_RADIOBOX_H
00024 #define QDS_RADIOBOX_H
00025 
00026 #include "QDS_Datum.h"
00027 
00028 #include <Qtx.h>
00029 
00030 #include <QMap>
00031 #include <QStringList>
00032 
00033 #ifdef WIN32
00034 #pragma warning( disable:4251 )
00035 #endif
00036 
00037 class QButtonGroup;
00038 class QGroupBox;
00039 class QRadioButton;
00040 
00041 class QDS_EXPORT QDS_RadioBox : public QDS_Datum
00042 {
00043   Q_OBJECT
00044 
00045 public:
00046   QDS_RadioBox( const QString&, QWidget* = 0, const int = Control, const QString& = QString() );
00047   virtual ~QDS_RadioBox();
00048 
00049   int                        count( bool = false ) const;
00050   void                       values( QList<int>&, bool = false ) const;
00051 
00052   int                        columns() const;
00053   void                       setColumns( const int );
00054 
00055   bool                       state( const int ) const;
00056   void                       setState( const bool, const int, const bool = true );
00057   void                       setState( const bool, const QList<int>&, const bool = true );
00058   void                       setValues( const QList<int>&, const QStringList& );
00059   void                       setValues( const QStringList& );
00060 
00061 signals:
00062   void                       activated( int );
00063 
00064 protected slots:
00065   virtual void               onToggled( bool );
00066 
00067 protected:
00068   QButtonGroup*              buttonGroup() const;
00069   QGroupBox*                 groupBox() const;
00070   virtual QWidget*           createControl( QWidget* );
00071   void                       buttons( QList<QRadioButton*>& ) const;
00072 
00073   virtual QString            getString() const;
00074   virtual void               setString( const QString& );
00075 
00076   virtual void               unitSystemChanged( const QString& );
00077 
00078 private:
00079   void                       updateRadioBox();
00080 
00081 private:
00082   typedef QMap<int, QString> IdValueMap;
00083   typedef QMap<int, bool>    IdStateMap;
00084 
00085 private:
00086   IdValueMap                 myValue;
00087   IdStateMap                 myState;
00088 
00089   QIntList                   myDataIds;
00090   QIntList                   myUserIds;
00091   QStringList                myUserNames;
00092 
00093   QButtonGroup*              myButtonGroup;
00094 };
00095 
00096 #ifdef WIN32
00097 #pragma warning( default:4251 )
00098 #endif
00099 
00100 #endif