Salome HOME
1fef63f044153889677bc3124dc895f466728600
[modules/gui.git] / src / Qtx / Qtx.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
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.
7 // 
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File:      Qtx.h
20 // Author:    Sergey TELKOV
21
22 #ifndef QTX_H
23 #define QTX_H
24
25 #if defined QTX_EXPORTS
26 #if defined WIN32
27 #define QTX_EXPORT _declspec( dllexport )
28 #else
29 #define QTX_EXPORT  
30 #endif
31 #else
32 #if defined WIN32
33 #define QTX_EXPORT _declspec( dllimport )
34 #else
35 #define QTX_EXPORT  
36 #endif
37 #endif
38
39 #if defined SOLARIS
40 #define bool  int
41 #define false 0
42 #define true  1
43 #endif
44
45 #ifndef INCLUDE_MENUITEM_DEF
46 #define INCLUDE_MENUITEM_DEF
47 #endif
48
49 #include <qnamespace.h>
50
51 #ifndef QT_VERSION
52 #define QT_VER 0
53 #else
54 #if QT_VERSION >= 0x30000
55 #define QT_VER 3
56 #else
57 #if QT_VERSION >= 300
58 #define QT_VER 3
59 #else
60 #if QT_VERSION >= 200
61 #define QT_VER 2
62 #else
63 #if QT_VERSION >= 100
64 #define QT_VER 1
65 #endif
66 #endif
67 #endif
68 #endif
69 #endif
70
71 class QObject;
72 class QString;
73 class QWidget;
74 class QToolBar;
75 class QGroupBox;
76 class QPopupMenu;
77 class QWidgetList;
78
79 template <class> class QValueList;
80
81 #if QT_VER < 3
82 #define QPtrList QList
83 #define QPtrListIterator QListIterator
84 #endif
85
86 typedef QValueList<int>    QIntList;
87 typedef QValueList<short>  QShortList;
88 typedef QValueList<double> QDoubleList;
89
90 /*!
91   \class Qtx
92   \brief Set of auxiliary static methods
93 */
94 class QTX_EXPORT Qtx : public Qt
95 {
96 public:
97   enum AlignmentFlags
98   {
99     AlignOutLeft   = AlignVCenter  << 2,
100     AlignOutRight  = AlignOutLeft  << 2,
101     AlignOutTop    = AlignOutRight << 2,
102     AlignOutBottom = AlignOutTop   << 2
103   };
104
105   static void    setTabOrder( QWidget*, ... );
106   static void    setTabOrder( const QWidgetList& );
107   static void    alignWidget( QWidget*, const QWidget*, const int );
108
109   static void    simplifySeparators( QToolBar* );
110   static void    simplifySeparators( QPopupMenu*, const bool = true );
111
112   static bool    isParent( QObject*, QObject* );
113
114   static QString extension( const QString& );
115   static QString dir( const QString&, const bool = true );
116   static QString file( const QString&, const bool = true );
117
118   static QString library( const QString& );
119
120   static QString tmpDir();
121   static bool    mkDir( const QString& );
122   static bool    rmDir( const QString& );
123   static bool    dos2unix( const QString& );
124   static QString addSlash( const QString& );
125
126   static int     rgbSet( const QColor& );
127   static int     rgbSet( const int, const int, const int );
128
129   static void    rgbSet( const int, QColor& );
130   static void    rgbSet( const int, int&, int&, int& );
131
132   static QColor  scaleColor( const int, const int, const int );
133   static void    scaleColors( const int, QValueList<QColor>& );
134 };
135
136 #endif