Back to index

salome-gui  6.5.0
QtxMRUAction.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:      QtxMRUAction.h
00024 // Author:    Sergey TELKOV
00025 //
00026 #ifndef QTXMRUACTION_H
00027 #define QTXMRUACTION_H
00028 
00029 #include "QtxAction.h"
00030 
00031 #include <QStringList>
00032 
00033 class QtxResourceMgr;
00034 
00035 #ifdef WIN32
00036 #pragma warning( disable:4251 )
00037 #endif
00038 
00039 class QTX_EXPORT QtxMRUAction : public QtxAction
00040 {
00041   Q_OBJECT
00042 
00043 public:
00045   typedef enum { MoveFirst,   
00046                  MoveLast,    
00047                  AddFirst,    
00048                  AddLast      
00049   } InsertionMode;
00050 
00051   typedef enum { LinkAuto,    
00052                  LinkShort,   
00053                  LinkFull     
00054   } LinkType;
00055 
00056 public:
00057   QtxMRUAction( QObject* = 0 );
00058   QtxMRUAction( const QString&, const QString&, QObject* = 0 );
00059   QtxMRUAction( const QString&, const QIcon&, const QString&, QObject* = 0 );
00060   virtual ~QtxMRUAction();
00061 
00062   int          insertMode() const;
00063   void         setInsertMode( const int );
00064 
00065   int          linkType() const;
00066   void         setLinkType( const int );
00067 
00068   int          count() const;
00069   bool         isEmpty() const;
00070 
00071   int          visibleCount() const;
00072   void         setVisibleCount( const int );
00073 
00074   bool         isClearPossible() const;
00075   void         setClearPossible( const bool );
00076 
00077   int          historyCount() const;
00078   void         setHistoryCount( const int );
00079 
00080   void         remove( const int );
00081   void         remove( const QString& );
00082   void         insert( const QString& );
00083 
00084   QString      item( const int ) const;
00085   int          find( const QString& ) const;
00086   bool         contains( const QString& ) const;
00087 
00088   virtual void loadLinks( QtxResourceMgr*, const QString&, const bool = true );
00089   virtual void saveLinks( QtxResourceMgr*, const QString&, const bool = true ) const;
00090 
00091 public slots:
00092   void         clear();
00093 
00094 signals:
00095   void         activated( const QString& );
00096 
00097 private slots:
00098   void         onActivated();
00099   void         onAboutToShow();
00100   void         onCleared( bool );
00101 
00102 private:
00103   void         updateMenu();
00104 
00105 private:
00106   QStringList  myLinks;        
00107   QAction*     myClear;        
00108   int          myVisCount;     
00109   int          myHistoryCount; 
00110   int          myLinkType;     
00111   int          myInsertMode;   
00112 };
00113 
00114 #endif