Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_Tools.h
4 // Created:     11 July 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ModuleBase_Tools_H
8 #define ModuleBase_Tools_H
9
10 #include "ModuleBase.h"
11
12 #include <ModelAPI_Feature.h>
13
14 #include <QPixmap>
15
16 class QWidget;
17 class QLayout;
18 class QDoubleSpinBox;
19
20 namespace ModuleBase_Tools {
21
22 /*
23  * Methods to adjust margins and spacings.
24  */
25 MODULEBASE_EXPORT void adjustMargins(QWidget* theWidget);
26 MODULEBASE_EXPORT void adjustMargins(QLayout* theLayout);
27
28 MODULEBASE_EXPORT void zeroMargins(QWidget* theWidget);
29 MODULEBASE_EXPORT void zeroMargins(QLayout* theLayout);
30
31
32 /**
33  * \ingroup GUI
34  * Methods to modify a resource pixmap
35  */
36
37 //! Create composite pixmap. 
38 //! Pixmap \a theAdditionalIcon is drawn over pixmap \a dest with coordinates
39 //! specified relatively to the upper left corner of \a theIcon.
40
41 //! \param theAdditionalIcon resource text of the additional pixmap
42 //! \param theIcon resource text of the background pixmap
43 //! \return resulting pixmap
44 MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon);
45
46 //! Generates the pixmap lighter than the resources pixmap. 
47 //! Pixmap \a theIcon is lighted according to the given value.
48 //! If the lighter value is greater than 100, this functions returns a lighter pixmap.
49 //! Setting lighter value to 150 returns a color that is 50% brighter. If the factor is less than 100,
50 //! the return pixmap is darker. If the factor is 0 or negative, the return pixmap is unspecified.
51
52 //! \param resource text of the pixmap
53 //! \param theLighterValue a lighter factor
54 //! \return resulting pixmap
55 MODULEBASE_EXPORT QPixmap lighter(const QString& theIcon, const int theLighterValue = 200);
56
57 /// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged)
58 /// \param theSpin an X or Y coordinate widget
59 /// \param theValue a new value
60 MODULEBASE_EXPORT void setSpinValue(QDoubleSpinBox* theSpin, double theValue);
61
62 /// Converts the object to the feature or a result and generate information string
63 /// \param theObj an object
64 /// \param isUseAttributesInfo a flag whether the attribute values information is used
65 /// \return a string
66 MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo = false);
67
68 }
69
70 #endif