Back to index

salome-gui  6.5.0
QtxActionGroup.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File:      QtxActionGroup.h
00021 // Author:    Sergey TELKOV
00022 //
00023 #ifndef QTXACTIONGROUP_H
00024 #define QTXACTIONGROUP_H
00025 
00026 #include "QtxActionSet.h"
00027 
00028 #ifdef WIN32
00029 #pragma warning( disable:4251 )
00030 #endif
00031 
00032 class QtxComboBox;
00033 class QActionGroup;
00034 
00035 class QTX_EXPORT QtxActionGroup : public QtxActionSet
00036 {
00037   Q_OBJECT
00038 
00039 public:
00040   QtxActionGroup( QObject* = 0 );
00041   QtxActionGroup( QObject*, const bool );
00042   virtual ~QtxActionGroup();
00043 
00044   bool             isExclusive() const;
00045   bool             usesDropDown() const;
00046 
00047   void             add( QAction* );
00048 
00049 public slots:
00050   void             setExclusive( const bool );
00051   void             setUsesDropDown( const bool );
00052 
00053 signals:
00054   void             selected( QAction* );
00055 
00056 private slots:
00057   void             onActivated( int );
00058   void             onTriggered( QAction* );
00059 
00060 protected:
00061   virtual void     updateAction( QWidget* );
00062   virtual void     updateAction( QtxComboBox* );
00063 
00064   virtual QWidget* createWidget( QWidget* );
00065 
00066   virtual bool     isEmptyAction() const;
00067   virtual void     actionAdded( QAction* );
00068   virtual void     actionRemoved( QAction* );
00069 
00070 private:
00071   void             updateType();
00072   QtxComboBox*     createdWidget( QWidget* );
00073 
00074 private:
00075   bool             myDropDown;
00076   QActionGroup*    myActionGroup;
00077 };
00078 
00079 #ifdef WIN32
00080 #pragma warning( default:4251 )
00081 #endif
00082 
00083 #endif