1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: QtxMRUAction.h
24 // Author: Sergey TELKOV
26 #ifndef QTXMRUACTION_H
27 #define QTXMRUACTION_H
29 #include "QtxAction.h"
31 #include <QStringList>
36 #pragma warning( disable:4251 )
39 class QTX_EXPORT QtxMRUAction : public QtxAction
44 //! Items insertion policy
45 typedef enum { MoveFirst, //!< put the specified item to the beginning
46 MoveLast, //!< put the specified item to the end
47 AddFirst, //!< if specified item doesn't exist, add it to the beginning
48 AddLast //!< if specified item doesn't exist, add it to the end
51 typedef enum { LinkAuto, //!< put the full path of link into the menu if link file names of severals link are same
52 LinkShort, //!< put the only file name of link into the menu
53 LinkFull //!< put the full path of link into the menu
57 QtxMRUAction( QObject* = 0 );
58 QtxMRUAction( const QString&, const QString&, QObject* = 0 );
59 QtxMRUAction( const QString&, const QIcon&, const QString&, QObject* = 0 );
60 virtual ~QtxMRUAction();
62 int insertMode() const;
63 void setInsertMode( const int );
66 void setLinkType( const int );
71 int visibleCount() const;
72 void setVisibleCount( const int );
74 bool isClearPossible() const;
75 void setClearPossible( const bool );
77 int historyCount() const;
78 void setHistoryCount( const int );
80 void remove( const int );
81 void remove( const QString& );
82 void insert( const QString& );
84 QString item( const int ) const;
85 int find( const QString& ) const;
86 bool contains( const QString& ) const;
88 virtual void loadLinks( QtxResourceMgr*, const QString&, const bool = true );
89 virtual void saveLinks( QtxResourceMgr*, const QString&, const bool = true ) const;
95 void activated( const QString& );
100 void onCleared( bool );
106 QStringList myLinks; //!< most recent used items
107 QAction* myClear; //!< clear item
108 int myVisCount; //!< number of visible MRU items
109 int myHistoryCount; //!< number of stored MRU items
110 int myLinkType; //!< type of link names in menu
111 int myInsertMode; //!< items insertion policy