Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / LightApp / LightApp_Preferences.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File:      LightApp_Preferences.h
20 // Author:    Sergey TELKOV
21
22 #ifndef LIGHTAPP_PREFERENCES_H
23 #define LIGHTAPP_PREFERENCES_H
24
25 #include <LightApp.h>
26
27 #include <QtxDialog.h>
28 #include <QtxListResourceEdit.h>
29
30 #include <qmap.h>
31
32 class QtxResourceMgr;
33
34 /*!
35   \class LightApp_Preferences
36   Custom preference container. Assign each preference category with module.
37   Emits signal on preference changing
38 */
39 class LIGHTAPP_EXPORT LightApp_Preferences : public QtxListResourceEdit
40 {
41   Q_OBJECT
42
43 public:
44   LightApp_Preferences( QtxResourceMgr*, QWidget* = 0 );
45   virtual ~LightApp_Preferences();
46
47   int                  addPreference( const QString& label, const int pId = -1, const int = -1,
48                                       const QString& section = QString::null, const QString& param = QString::null );
49   int                  addPreference( const QString& modName, const QString& label, const int pId = -1, const int = -1,
50                                       const QString& section = QString::null, const QString& param = QString::null );
51
52   bool                 hasModule( const QString& ) const;
53
54 signals:
55   void                 preferenceChanged( QString&, QString&, QString& );
56
57 private slots:
58   void                 onHelp();
59   void                 onApply();
60   virtual void         changedResources( const QMap<Item*, QString>& );
61
62 private:
63   QString              module( const int ) const;
64
65 private:
66   typedef QMap<int, QString> PrefModuleMap;
67
68 private:
69   PrefModuleMap        myPrefMod;
70 };
71
72 #endif