Salome HOME
updated copyright message
[modules/gui.git] / src / QDS / QDS.h
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef QDS_H
24 #define QDS_H
25
26 #ifdef WIN32
27 #if defined QDS_EXPORTS
28 #define QDS_EXPORT __declspec(dllexport)
29 #else
30 #define QDS_EXPORT __declspec(dllimport)
31 #endif
32 #else
33 #define QDS_EXPORT
34 #endif
35
36 #if defined WIN32
37 #pragma warning ( disable:4251 )
38 #pragma warning ( disable:4786 )
39 #endif
40
41 #include <QString>
42 #include <QList>
43
44 #include <TCollection_HExtendedString.hxx>
45 #include <TCollection_HAsciiString.hxx>
46
47 class QDS_Datum;
48
49
50 class QDS_EXPORT QDS
51 {
52 public:
53   //! Enum describes bit flags of the Qt datum view and behaviour
54   typedef enum
55   {
56     None           = 0x00,         //!< Non specified any flags (Default behaviour)
57     Label          = 0x01,         //!< Create subwidget for datum label
58     Control        = 0x02,         //!< Create subwidget for datum input control
59     Units          = 0x04,         //!< Create subwidget for datum units of measure
60     NotFormat      = 0x08,         //!< Don't format initial value
61     NotAccel       = 0x10,         //!< Not support accelerators in datum label
62     NotConvert     = 0x20,         //!< Don't convert numeric value
63     UnitsWithLabel = 0x40,         //!< Display units of measure in label like "<label_text> (<units_text>) instead separate text"
64     All = Label | Control | Units  //!< Create all subwidgets
65   } DatumFlags;
66
67 public:
68   static bool                       load( const QString& );
69
70   static QString                    unitSystemLabel( const QString&,
71                                                      const QString& = QString() );
72   static QString                    activeUnitSystem( const QString& = QString() );
73   static void                       setActiveUnitSystem( const QString&,
74                                                          const QString& = QString() );
75
76   static QString                    toQString( const TCollection_AsciiString& );
77   static QString                    toQString( const TCollection_ExtendedString& );
78   static QString                    toQString( const Handle(TCollection_HAsciiString)& );
79   static QString                    toQString( const Handle(TCollection_HExtendedString)& );
80
81   static TCollection_AsciiString    toAsciiString( const QString& );
82   static TCollection_AsciiString    toAsciiString( const TCollection_ExtendedString& );
83   static TCollection_AsciiString    toAsciiString( const Handle(TCollection_HExtendedString)& );
84
85   static TCollection_ExtendedString toExtString( const QString& );
86   static TCollection_ExtendedString toExtString( const TCollection_AsciiString& );
87
88 protected:
89   static void                       insertDatum( QDS_Datum* );
90   static void                       removeDatum( QDS_Datum* );
91
92 private:
93   static QList<QDS_Datum*>          _datumList;
94 };
95
96 #endif