• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

SVGLength.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
00003                   2004, 2005, 2006 Rob Buis <buis@kde.org>
00004 
00005     This file is part of the KDE project
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef SVGLength_h
00024 #define SVGLength_h
00025 
00026 #if ENABLE(SVG)
00027 
00028 //#include "PlatformString.h"
00029 #include "Document.h"
00030 
00031 namespace WebCore {
00032 
00033     class SVGStyledElement;
00034 
00035     enum SVGLengthType {
00036         LengthTypeUnknown = 0,
00037         LengthTypeNumber = 1,
00038         LengthTypePercentage = 2,
00039         LengthTypeEMS = 3,
00040         LengthTypeEXS = 4,
00041         LengthTypePX = 5,
00042         LengthTypeCM = 6,
00043         LengthTypeMM = 7,
00044         LengthTypeIN = 8,
00045         LengthTypePT = 9,
00046         LengthTypePC = 10
00047     };
00048 
00049     enum SVGLengthMode {
00050         LengthModeWidth = 0,
00051         LengthModeHeight,
00052         LengthModeOther
00053     };
00054 
00055     class SVGLength {
00056     public:
00057         // Forward declare these enums in the w3c naming scheme, for IDL generation
00058         enum {
00059             SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown,
00060             SVG_LENGTHTYPE_NUMBER = LengthTypeNumber,
00061             SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage,
00062             SVG_LENGTHTYPE_EMS = LengthTypeEMS,
00063             SVG_LENGTHTYPE_EXS = LengthTypeEXS,
00064             SVG_LENGTHTYPE_PX = LengthTypePX,
00065             SVG_LENGTHTYPE_CM = LengthTypeCM,
00066             SVG_LENGTHTYPE_MM = LengthTypeMM,
00067             SVG_LENGTHTYPE_IN = LengthTypeIN,
00068             SVG_LENGTHTYPE_PT = LengthTypePT,
00069             SVG_LENGTHTYPE_PC = LengthTypePC
00070         };
00071 
00072         SVGLength(const SVGStyledElement* context = 0, SVGLengthMode mode = LengthModeOther, const String& valueAsString = String());
00073 
00074         // 'SVGLength' functions
00075         SVGLengthType unitType() const;
00076 
00077         float value() const;
00078         void setValue(float);
00079 
00080         float valueInSpecifiedUnits() const;
00081         void setValueInSpecifiedUnits(float);
00082         
00083         float valueAsPercentage() const;
00084 
00085         String valueAsString() const;
00086         bool setValueAsString(const String&);
00087 
00088         void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
00089         void convertToSpecifiedUnits(unsigned short);
00090 
00091         // Helper functions
00092         static float PercentageOfViewport(float value, const SVGStyledElement*, SVGLengthMode);
00093 
00094         inline bool isRelative() const
00095         {
00096             SVGLengthType type = unitType();
00097             return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS);
00098         }
00099  
00100     private:
00101         float m_valueInSpecifiedUnits;
00102         unsigned int m_unit;
00103 
00104         const SVGStyledElement* m_context;
00105     };
00106 
00107 } // namespace WebCore
00108 
00109 #endif // ENABLE(SVG)
00110 #endif // SVGLength_h
00111 
00112 // vim:ts=4:noet

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal