1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ModuleBase_IconFactory_H
22 #define ModuleBase_IconFactory_H
24 #include "ModuleBase.h"
25 #include <ModelAPI_Object.h>
31 /**\class ModuleBase_IconFactory
33 * \brief This is a class which provides icons of objects for object browser
35 class MODULEBASE_EXPORT ModuleBase_IconFactory
38 /// Returns icons factory instance
39 static ModuleBase_IconFactory* get();
41 /// Returns Icon for the given object
42 /// \param theObj an object
43 virtual QIcon getIcon(ObjectPtr theObj);
45 /// Finds an icon for the given value. The icon is loaded: firstly from qrc file,
46 /// then by the icon path. If the path contains ":" , it will be treated as absolute path to
47 /// the icon, or relative path from the plugin library
48 /// \param theValue an icon information
49 /// \return a loaded or empty icon
50 static QIcon loadIcon(const QString& theValue);
52 /// Finds a pixmap for the given value. It is loaded: firstly from qrc file,
53 /// then by the absolute path. If the pixmap is not loaded, it is searched in relative plugin path
54 /// \param theValue a pixmap information
55 /// \return a loaded or empty pixmap
56 static QPixmap loadPixmap(const QString& theValue);
58 /// Finds an image for the given value. It is loaded: firstly from qrc file,
59 /// then by the absolute path. If the image is not loaded, it is searched in relative plugin path
60 /// \param theValue a image information
61 /// \return a loaded or empty pixmap
62 static QImage loadImage(const QString& theValue);
65 ModuleBase_IconFactory();
67 /// Set the current icons factory instance
68 /// \param theFactory a new factory
69 static void setFactory(ModuleBase_IconFactory* theFactory);