1 // Copyright (C) 2007-2008 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
22 // File: QtxMRUAction.h
23 // Author: Sergey TELKOV
25 #ifndef QTXMRUACTION_H
26 #define QTXMRUACTION_H
28 #include "QtxAction.h"
30 #include <QStringList>
35 #pragma warning( disable:4251 )
38 class QTX_EXPORT QtxMRUAction : public QtxAction
43 //! Items insertion policy
44 typedef enum { MoveFirst, //!< put the specified item to the beginning
45 MoveLast, //!< put the specified item to the end
46 AddFirst, //!< if specified item doesn't exist, add it to the beginning
47 AddLast //!< if specified item doesn't exist, add it to the end
50 typedef enum { LinkAuto, //!< put the full path of link into the menu if link file names of severals link are same
51 LinkShort, //!< put the only file name of link into the menu
52 LinkFull //!< put the full path of link into the menu
56 QtxMRUAction( QObject* = 0 );
57 QtxMRUAction( const QString&, const QString&, QObject* = 0 );
58 QtxMRUAction( const QString&, const QIcon&, const QString&, QObject* = 0 );
59 virtual ~QtxMRUAction();
61 int insertMode() const;
62 void setInsertMode( const int );
65 void setLinkType( const int );
70 int visibleCount() const;
71 void setVisibleCount( const int );
73 bool isClearPossible() const;
74 void setClearPossible( const bool );
76 int historyCount() const;
77 void setHistoryCount( const int );
79 void remove( const int );
80 void remove( const QString& );
81 void insert( const QString& );
83 QString item( const int ) const;
84 int find( const QString& ) const;
85 bool contains( const QString& ) const;
87 virtual void loadLinks( QtxResourceMgr*, const QString&, const bool = true );
88 virtual void saveLinks( QtxResourceMgr*, const QString&, const bool = true ) const;
94 void activated( const QString& );
99 void onCleared( bool );
105 QStringList myLinks; //!< most recent used items
106 QAction* myClear; //!< clear item
107 int myVisCount; //!< number of visible MRU items
108 int myHistoryCount; //!< number of stored MRU items
109 int myLinkType; //!< type of link names in menu
110 int myInsertMode; //!< items insertion policy