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>
28 #include <ModelAPI_Feature.h>
30 #include <ModuleBase_Definitions.h>
36 class ModuleBase_IWorkshop;
40 \brief Commonly used methods in XGUI package and higher.
42 namespace XGUI_Tools {
45 \brief Return directory part of the file path.
47 If the file path does not include directory part (the file is in the
48 current directory), null string is returned.
51 \param isAbs if true (default) \a path parameter is treated as absolute file path
52 \return directory part of the file path
54 QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
57 \brief Return file name part of the file path.
60 \param withExt if true (default) complete file name (with all
61 extension except the last) is returned, otherwise only base name
63 \return file name part of the file path
65 QString XGUI_EXPORT file(const QString& path, bool withExt = true);
68 \brief Add a slash (platform-specific) to the end of \a path
69 if it is not already there.
70 \param path directory path
71 \return modified path (with slash added to the end)
73 QString XGUI_EXPORT addSlash(const QString& path);
75 // The model concerning tools
77 /*! Unite object names in one string using the separator between values
78 \param theObjects a list of objects
79 \param theSeparator a separator
81 QString unionOfObjectNames(const QObjectPtrList& theObjects, const QString& theSeparator);
84 Returns true if the feature is a model object
85 \param theFeature a feature
87 bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
90 Returns the string presentation of the given feature
91 \param theFeature a feature
93 std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
96 Returns true if there are no parts in the document, which are not activated or
97 all objects in the list are not PartSet document.
98 It shows the warning control if the result is false.
99 \param theParent a parent for the warning control
100 \param theFeatures a list of checked features
101 \return a boolean value
103 bool XGUI_EXPORT canRemoveOrRename(QWidget* theParent, const std::set<FeaturePtr>& theFeatures);
106 Check possibility to rename object
107 \param theObject an object to rename
108 \param theName a name
110 bool canRename(const ObjectPtr& theObject, const QString& theName);
113 Returns converted workshop
114 \param theWorkshop an interface workshop
115 \return XGUI workshop instance
117 XGUI_EXPORT XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);