2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef RadialGradientAttributes_h
21 #define RadialGradientAttributes_h
23 #include "core/svg/GradientAttributes.h"
24 #include "core/svg/SVGLength.h"
27 struct RadialGradientAttributes final
: GradientAttributes
{
28 DISALLOW_ALLOCATION();
30 RadialGradientAttributes()
31 : m_cx(SVGLength::create(SVGLengthMode::Width
))
32 , m_cy(SVGLength::create(SVGLengthMode::Height
))
33 , m_r(SVGLength::create(SVGLengthMode::Other
))
34 , m_fx(SVGLength::create(SVGLengthMode::Width
))
35 , m_fy(SVGLength::create(SVGLengthMode::Height
))
36 , m_fr(SVGLength::create(SVGLengthMode::Other
))
44 m_cx
->setValueAsString("50%", IGNORE_EXCEPTION
);
45 m_cy
->setValueAsString("50%", IGNORE_EXCEPTION
);
46 m_r
->setValueAsString("50%", IGNORE_EXCEPTION
);
49 SVGLength
* cx() const { return m_cx
.get(); }
50 SVGLength
* cy() const { return m_cy
.get(); }
51 SVGLength
* r() const { return m_r
.get(); }
52 SVGLength
* fx() const { return m_fx
.get(); }
53 SVGLength
* fy() const { return m_fy
.get(); }
54 SVGLength
* fr() const { return m_fr
.get(); }
56 void setCx(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_cx
= value
; m_cxSet
= true; }
57 void setCy(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_cy
= value
; m_cySet
= true; }
58 void setR(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_r
= value
; m_rSet
= true; }
59 void setFx(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_fx
= value
; m_fxSet
= true; }
60 void setFy(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_fy
= value
; m_fySet
= true; }
61 void setFr(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_fr
= value
; m_frSet
= true; }
63 bool hasCx() const { return m_cxSet
; }
64 bool hasCy() const { return m_cySet
; }
65 bool hasR() const { return m_rSet
; }
66 bool hasFx() const { return m_fxSet
; }
67 bool hasFy() const { return m_fySet
; }
68 bool hasFr() const { return m_frSet
; }
82 RefPtrWillBeMember
<SVGLength
> m_cx
;
83 RefPtrWillBeMember
<SVGLength
> m_cy
;
84 RefPtrWillBeMember
<SVGLength
> m_r
;
85 RefPtrWillBeMember
<SVGLength
> m_fx
;
86 RefPtrWillBeMember
<SVGLength
> m_fy
;
87 RefPtrWillBeMember
<SVGLength
> m_fr
;
99 // Wrapper object for the RadialGradientAttributes part object.
100 class RadialGradientAttributesWrapper
: public GarbageCollectedFinalized
<RadialGradientAttributesWrapper
> {
102 static RadialGradientAttributesWrapper
* create()
104 return new RadialGradientAttributesWrapper
;
107 RadialGradientAttributes
& attributes() { return m_attributes
; }
108 void set(const RadialGradientAttributes
& attributes
) { m_attributes
= attributes
; }
109 DEFINE_INLINE_TRACE() { visitor
->trace(m_attributes
); }
112 RadialGradientAttributesWrapper()
116 RadialGradientAttributes m_attributes
;