1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
36 #include <qpopupmenu.h>
37 #include <TCollection_ExtendedString.hxx>
38 #include <TCollection_AsciiString.hxx>
40 class QAD_EXPORT QAD_Tools : public Qt
43 /* min/max functions */
44 static int getMax(int v1, int v2);
45 static int getMin(int v1, int v2);
48 static QRect makeRect(int x1, int y1, int x2, int y2);
51 static void trace (const char* pLog, const char* szFormat, ... );
54 static QString getDirFromPath( const QString& path, bool absPath = true );
55 static QString getFileNameFromPath( const QString& path, bool withExtension = true );
56 static QString getFileExtensionFromPath( const QString& path );
57 static QString addSlash( const QString& path );
58 static QString unix2win( const QString& path );
60 /* aligning widget in 'ref' widget */
61 static void centerWidget( QWidget* src, const QWidget* ref );
62 static void alignWidget ( QWidget* src, const QWidget* ref, int alignFlags = AlignCenter );
64 /* converting strings */
65 static QString toQString ( const TCollection_ExtendedString& extString);
66 static TCollection_ExtendedString toExtString ( const QString& qString);
67 static QString toQString ( const TCollection_AsciiString& asciiString);
68 static TCollection_AsciiString toAsciiString( const QString& qString);
70 static QFont stringToFont( const QString& fontDescription );
71 static QString fontToString( const QFont& font );
73 /* popup menu optimization */
74 static void checkPopup( QPopupMenu* popup );