1 /* 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann (at) kde.org> 3 * 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. 8 * 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. 13 * 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. 18 */ 19 20 #ifndef RadialGradientAttributes_h 21 #define RadialGradientAttributes_h 22 23 #include "core/svg/GradientAttributes.h" 24 25 namespace blink { 26 struct RadialGradientAttributes : GradientAttributes { 27 RadialGradientAttributes() 28 : m_cx(SVGLength::create(LengthModeWidth)) 29 , m_cy(SVGLength::create(LengthModeHeight)) 30 , m_r(SVGLength::create(LengthModeOther)) 31 , m_fx(SVGLength::create(LengthModeWidth)) 32 , m_fy(SVGLength::create(LengthModeHeight)) 33 , m_fr(SVGLength::create(LengthModeOther)) 34 , m_cxSet(false) 35 , m_cySet(false) 36 , m_rSet(false) 37 , m_fxSet(false) 38 , m_fySet(false) 39 , m_frSet(false) 40 { 41 m_cx->setValueAsString("50%", IGNORE_EXCEPTION); 42 m_cy->setValueAsString("50%", IGNORE_EXCEPTION); 43 m_r->setValueAsString("50%", IGNORE_EXCEPTION); 44 } 45 46 SVGLength* cx() const { return m_cx.get(); } 47 SVGLength* cy() const { return m_cy.get(); } 48 SVGLength* r() const { return m_r.get(); } 49 SVGLength* fx() const { return m_fx.get(); } 50 SVGLength* fy() const { return m_fy.get(); } 51 SVGLength* fr() const { return m_fr.get(); } 52 53 void setCx(PassRefPtr<SVGLength> value) { m_cx = value; m_cxSet = true; } 54 void setCy(PassRefPtr<SVGLength> value) { m_cy = value; m_cySet = true; } 55 void setR(PassRefPtr<SVGLength> value) { m_r = value; m_rSet = true; } 56 void setFx(PassRefPtr<SVGLength> value) { m_fx = value; m_fxSet = true; } 57 void setFy(PassRefPtr<SVGLength> value) { m_fy = value; m_fySet = true; } 58 void setFr(PassRefPtr<SVGLength> value) { m_fr = value; m_frSet = true; } 59 60 bool hasCx() const { return m_cxSet; } 61 bool hasCy() const { return m_cySet; } 62 bool hasR() const { return m_rSet; } 63 bool hasFx() const { return m_fxSet; } 64 bool hasFy() const { return m_fySet; } 65 bool hasFr() const { return m_frSet; } 66 67 private: 68 // Properties 69 RefPtr<SVGLength> m_cx; 70 RefPtr<SVGLength> m_cy; 71 RefPtr<SVGLength> m_r; 72 RefPtr<SVGLength> m_fx; 73 RefPtr<SVGLength> m_fy; 74 RefPtr<SVGLength> m_fr; 75 76 // Property states 77 bool m_cxSet : 1; 78 bool m_cySet : 1; 79 bool m_rSet : 1; 80 bool m_fxSet : 1; 81 bool m_fySet : 1; 82 bool m_frSet : 1; 83 }; 84 85 } // namespace blink 86 87 #endif 88