Salome HOME
Merge branch 'master' 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 <QPixmap>
13
14 class QWidget;
15 class QLayout;
16 class QDoubleSpinBox;
17
18 namespace ModuleBase_Tools {
19
20 /*
21  * Methods to adjust margins and spacings.
22  */
23 MODULEBASE_EXPORT void adjustMargins(QWidget* theWidget);
24 MODULEBASE_EXPORT void adjustMargins(QLayout* theLayout);
25
26 MODULEBASE_EXPORT void zeroMargins(QWidget* theWidget);
27 MODULEBASE_EXPORT void zeroMargins(QLayout* theLayout);
28
29
30 /**
31  * \ingroup GUI
32  * Methods to modify a resource pixmap
33  */
34
35 //! Create composite pixmap. 
36 //! Pixmap \a theAdditionalIcon is drawn over pixmap \a dest with coordinates
37 //! specified relatively to the upper left corner of \a theIcon.
38
39 //! \param theAdditionalIcon resource text of the additional pixmap
40 //! \param theIcon resource text of the background pixmap
41 //! \return resulting pixmap
42 MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon);
43
44 //! Generates the pixmap lighter than the resources pixmap. 
45 //! Pixmap \a theIcon is lighted according to the given value.
46 //! If the lighter value is greater than 100, this functions returns a lighter pixmap.
47 //! Setting lighter value to 150 returns a color that is 50% brighter. If the factor is less than 100,
48 //! the return pixmap is darker. If the factor is 0 or negative, the return pixmap is unspecified.
49
50 //! \param resource text of the pixmap
51 //! \param theLighterValue a lighter factor
52 //! \return resulting pixmap
53 MODULEBASE_EXPORT QPixmap lighter(const QString& theIcon, const int theLighterValue = 200);
54
55 /// Sets programmatically the value to the spin box without emitting any signals(e.g. valueChanged)
56 /// \param theSpin an X or Y coordinate widget
57 /// \param theValue a new value
58 MODULEBASE_EXPORT void setSpinValue(QDoubleSpinBox* theSpin, double theValue);
59
60 }
61
62 #endif