Salome HOME
5ea4c4273ac9669ee17f0569c18f6aff19a43cfa
[modules/shaper.git] / src / ModuleBase / ModuleBase_IconFactory.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_IconFactory.h
4 // Created:     28 Jul 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef ModuleBase_IconFactory_H
8 #define ModuleBase_IconFactory_H
9
10 #include "ModuleBase.h"
11 #include <ModelAPI_Object.h>
12 #include <QIcon>
13
14 /**\class ModuleBase_IconFactory
15  * \ingroup GUI
16  * \brief This is a class which provides icons of objects for object browser 
17  */
18 class MODULEBASE_EXPORT ModuleBase_IconFactory
19 {
20 public:
21   /// Returns icons factory instance
22   static ModuleBase_IconFactory* get();
23
24   /// Returns Icon for the given object
25   /// \param theObj an object
26   virtual QIcon getIcon(ObjectPtr theObj);
27
28   /// Finds an icon for the given object. The icon is loaded: firstly from qrc file,
29   /// then by the icon path. If the path contains ":" , it will be treated as absolute path to
30   /// the icon, or relative path from the plugin library
31   /// \param theValue an icon information
32   /// \return a loaded or empty icon
33   static QIcon loadIcon(const QString& theValue);
34
35 protected:
36   ModuleBase_IconFactory();
37
38   /// Set the current icons factory instance
39   /// \param theFactory a new factory
40   static void setFactory(ModuleBase_IconFactory* theFactory);
41 };
42
43 #endif