]> SALOME platform Git repositories - modules/gui.git/blob - src/Qtx/Qtx.h
Salome HOME
c16bd7b231b907cf30755369a484099ed4a906bc
[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/
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 class QTX_EXPORT Qtx : public Qt
91 {
92 public:
93   enum AlignmentFlags
94   {
95     AlignOutLeft   = AlignVCenter  << 2,
96     AlignOutRight  = AlignOutLeft  << 2,
97     AlignOutTop    = AlignOutRight << 2,
98     AlignOutBottom = AlignOutTop   << 2
99   };
100
101   static void    setTabOrder( QWidget*, ... );
102   static void    setTabOrder( const QWidgetList& );
103   static void    alignWidget( QWidget*, const QWidget*, const int );
104
105   static void    simplifySeparators( QToolBar* );
106   static void    simplifySeparators( QPopupMenu*, const bool = true );
107
108   static bool    isParent( QObject*, QObject* );
109
110   static QString extension( const QString& );
111   static QString dir( const QString&, const bool = true );
112   static QString file( const QString&, const bool = true );
113
114   static QString library( const QString& );
115
116   static QString tmpDir();
117   static bool    mkDir( const QString& );
118   static bool    rmDir( const QString& );
119   static bool    dos2unix( const QString& );
120   static QString addSlash( const QString& );
121
122   static int     rgbSet( const QColor& );
123   static int     rgbSet( const int, const int, const int );
124
125   static void    rgbSet( const int, QColor& );
126   static void    rgbSet( const int, int&, int&, int& );
127
128   static QColor  scaleColor( const int, const int, const int );
129   static void    scaleColors( const int, QValueList<QColor>& );
130 };
131
132 #endif