Salome HOME
0020523: String notebook support
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeTextHighlightColor.cxx
1 //  Copyright (C) 2007-2008  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.
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 //  File   : SALOMEDS_AttributeTextHighlightColor.cxx
23 //  Author : Sergey RUIN
24 //  Module : SALOME
25 //
26 #include "SALOMEDS_AttributeTextHighlightColor.hxx"
27 #include "SALOMEDS.hxx"
28
29 #include <vector>
30
31 using namespace std;
32
33 SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor
34                   (SALOMEDSImpl_AttributeTextHighlightColor* theAttr)
35 :SALOMEDS_GenericAttribute(theAttr)
36 {}
37
38 SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor
39                   (SALOMEDS::AttributeTextHighlightColor_ptr theAttr)
40 :SALOMEDS_GenericAttribute(theAttr)
41 {}
42
43 SALOMEDS_AttributeTextHighlightColor::~SALOMEDS_AttributeTextHighlightColor()
44 {}
45
46
47 STextColor SALOMEDS_AttributeTextHighlightColor::TextHighlightColor()
48 {
49   STextColor aColor;
50   if (_isLocal) {
51     SALOMEDS::Locker lock;
52     vector<double> aSeq = dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(_local_impl)->TextHighlightColor();
53     aColor.R = aSeq[0];
54     aColor.G = aSeq[1];
55     aColor.B = aSeq[2]; 
56   }
57   else {
58     SALOMEDS::Color anImplColor =
59       SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->TextHighlightColor();
60     aColor.R = anImplColor.R;
61     aColor.G = anImplColor.G;
62     aColor.B = anImplColor.B;
63   }
64   return aColor;
65 }
66
67 void SALOMEDS_AttributeTextHighlightColor::SetTextHighlightColor(STextColor value)
68 {
69   if (_isLocal) {
70     CheckLocked();
71     SALOMEDS::Locker lock;
72     vector<double> aSeq;
73     aSeq.push_back(value.R);
74     aSeq.push_back(value.G);
75     aSeq.push_back(value.B);
76     dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(_local_impl)->ChangeArray(aSeq);
77   }
78   else {
79     SALOMEDS::Color aColor;
80     aColor.R = value.R;
81     aColor.G = value.G;
82     aColor.B = value.B;
83     SALOMEDS::AttributeTextHighlightColor::_narrow(_corba_impl)->SetTextHighlightColor(aColor);
84   }
85 }