1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_IconFactory.h
4 // Created: 28 Jul 2015
5 // Author: Vitaly SMETANNIKOV
7 #ifndef ModuleBase_IconFactory_H
8 #define ModuleBase_IconFactory_H
10 #include "ModuleBase.h"
11 #include <ModelAPI_Object.h>
17 /**\class ModuleBase_IconFactory
19 * \brief This is a class which provides icons of objects for object browser
21 class MODULEBASE_EXPORT ModuleBase_IconFactory
24 /// Returns icons factory instance
25 static ModuleBase_IconFactory* get();
27 /// Returns Icon for the given object
28 /// \param theObj an object
29 virtual QIcon getIcon(ObjectPtr theObj);
31 /// Finds an icon for the given value. The icon is loaded: firstly from qrc file,
32 /// then by the icon path. If the path contains ":" , it will be treated as absolute path to
33 /// the icon, or relative path from the plugin library
34 /// \param theValue an icon information
35 /// \return a loaded or empty icon
36 static QIcon loadIcon(const QString& theValue);
38 /// Finds a pixmap for the given value. It is loaded: firstly from qrc file,
39 /// then by the absolute path. If the pixmap is not loaded, it is searched in relative plugin path
40 /// \param theValue a pixmap information
41 /// \return a loaded or empty pixmap
42 static QPixmap loadPixmap(const QString& theValue);
44 /// Finds an image for the given value. It is loaded: firstly from qrc file,
45 /// then by the absolute path. If the image is not loaded, it is searched in relative plugin path
46 /// \param theValue a image information
47 /// \return a loaded or empty pixmap
48 static QImage loadImage(const QString& theValue);
51 ModuleBase_IconFactory();
53 /// Set the current icons factory instance
54 /// \param theFactory a new factory
55 static void setFactory(ModuleBase_IconFactory* theFactory);