1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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, or (at your option) any later version.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModuleBase_IconFactory_H
21 #define ModuleBase_IconFactory_H
23 #include "ModuleBase.h"
24 #include <ModelAPI_Object.h>
30 /**\class ModuleBase_IconFactory
32 * \brief This is a class which provides icons of objects for object browser
34 class MODULEBASE_EXPORT ModuleBase_IconFactory
37 virtual ~ModuleBase_IconFactory() {}
39 /// Returns icons factory instance
40 static ModuleBase_IconFactory* get();
42 /// Returns Icon for the given object
43 /// \param theObj an object
44 virtual QIcon getIcon(ObjectPtr theObj);
46 /// Finds an icon for the given value. The icon is loaded: firstly from qrc file,
47 /// then by the icon path. If the path contains ":" , it will be treated as absolute path to
48 /// the icon, or relative path from the plugin library
49 /// \param theValue an icon information
50 /// \return a loaded or empty icon
51 static QIcon loadIcon(const QString& theValue);
53 /// Finds a pixmap for the given value. It is loaded: firstly from qrc file,
54 /// then by the absolute path. If the pixmap is not loaded, it is searched in relative plugin path
55 /// \param theValue a pixmap information
56 /// \return a loaded or empty pixmap
57 static QPixmap loadPixmap(const QString& theValue);
59 /// Finds an image for the given value. It is loaded: firstly from qrc file,
60 /// then by the absolute path. If the image is not loaded, it is searched in relative plugin path
61 /// \param theValue a image information
62 /// \return a loaded or empty pixmap
63 static QImage loadImage(const QString& theValue);
66 ModuleBase_IconFactory();
68 /// Set the current icons factory instance
69 /// \param theFactory a new factory
70 static void setFactory(ModuleBase_IconFactory* theFactory);