khtml Library API Documentation

css_value.h

00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * (C) 1999 Lars Knoll (knoll@kde.org)
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  *
00021  * This file includes excerpts from the Document Object Model (DOM)
00022  * Level 2 Specification (Style)
00023  * http://www.w3.org/TR/DOM-Level-2-Style/
00024  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
00025  *
00026  */
00027 #ifndef _CSS_css_value_h_
00028 #define _CSS_css_value_h_
00029 
00030 #include <dom/dom_string.h>
00031 
00032 #include <qcolor.h>
00033 
00034 #include <kdemacros.h>
00035 
00036 namespace DOM {
00037 
00038 class CSSStyleDeclarationImpl;
00039 class CSSRule;
00040 class CSSValue;
00041 
00060 class KHTML_EXPORT CSSStyleDeclaration
00061 {
00062 public:
00063     CSSStyleDeclaration();
00064     CSSStyleDeclaration(const CSSStyleDeclaration &other);
00065     CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
00066 public:
00067 
00068     CSSStyleDeclaration & operator = (const CSSStyleDeclaration &other);
00069 
00070     ~CSSStyleDeclaration();
00071 
00079     DOM::DOMString cssText() const;
00080 
00092     void setCssText( const DOM::DOMString & );
00093 
00099     unsigned long length() const;
00100 
00105     CSSRule parentRule() const;
00106 
00120     DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName ) const;
00121     DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName );
00122 
00142     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
00143     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName );
00144 
00163     DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
00164 
00179     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
00180     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName );
00181 
00206     void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
00207 
00221     DOM::DOMString item ( unsigned long index ) const;
00222     DOM::DOMString item ( unsigned long index );
00223 
00228     CSSStyleDeclarationImpl *handle() const;
00229     bool isNull() const;
00230 
00231 protected:
00232     CSSStyleDeclarationImpl *impl;
00233 };
00234 
00235 
00236 class CSSValueImpl;
00237 
00243 class KHTML_EXPORT CSSValue
00244 {
00245 public:
00246     CSSValue();
00247     CSSValue(const CSSValue &other);
00248     CSSValue(CSSValueImpl *impl);
00249 public:
00250 
00251     CSSValue & operator = (const CSSValue &other);
00252 
00253     ~CSSValue();
00261     enum UnitTypes {
00262     CSS_INHERIT = 0,
00263         CSS_PRIMITIVE_VALUE = 1,
00264         CSS_VALUE_LIST = 2,
00265         CSS_CUSTOM = 3,
00266         CSS_INITIAL = 4
00267     };
00268 
00273     DOM::DOMString cssText() const;
00274 
00286     void setCssText( const DOM::DOMString & );
00287 
00292     unsigned short cssValueType() const;
00293 
00298     bool isCSSValueList() const;
00299     bool isCSSPrimitiveValue() const;
00300     CSSValueImpl *handle() const;
00301     bool isNull() const;
00302 
00303 protected:
00304     CSSValueImpl *impl;
00305 };
00306 
00307 
00308 class CSSValueListImpl;
00309 class CSSValue;
00310 
00316 class KHTML_EXPORT CSSValueList : public CSSValue
00317 {
00318 public:
00319     CSSValueList();
00320     CSSValueList(const CSSValueList &other);
00321     CSSValueList(const CSSValue &other);
00322     CSSValueList(CSSValueListImpl *impl);
00323 public:
00324 
00325     CSSValueList & operator = (const CSSValueList &other);
00326     CSSValueList & operator = (const CSSValue &other);
00327 
00328     ~CSSValueList();
00329 
00336     unsigned long length() const;
00337 
00350     CSSValue item ( unsigned long index );
00351 
00352 protected:
00353     CSSValueListImpl *vimpl;
00354 };
00355 
00356 
00357 class CSSPrimitiveValueImpl;
00358 class Counter;
00359 class RGBColor;
00360 class Rect;
00361 
00373 class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
00374 {
00375 public:
00376     CSSPrimitiveValue();
00377     CSSPrimitiveValue(const CSSPrimitiveValue &other);
00378     CSSPrimitiveValue(const CSSValue &other);
00379     CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
00380 public:
00381 
00382     CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
00383     CSSPrimitiveValue & operator = (const CSSValue &other);
00384 
00385     ~CSSPrimitiveValue();
00390     enum UnitTypes {
00391         CSS_UNKNOWN = 0,
00392         CSS_NUMBER = 1,
00393         CSS_PERCENTAGE = 2,
00394         CSS_EMS = 3,
00395         CSS_EXS = 4,
00396         CSS_PX = 5,
00397         CSS_CM = 6,
00398         CSS_MM = 7,
00399         CSS_IN = 8,
00400         CSS_PT = 9,
00401         CSS_PC = 10,
00402         CSS_DEG = 11,
00403         CSS_RAD = 12,
00404         CSS_GRAD = 13,
00405         CSS_MS = 14,
00406         CSS_S = 15,
00407         CSS_HZ = 16,
00408         CSS_KHZ = 17,
00409         CSS_DIMENSION = 18,
00410         CSS_STRING = 19,
00411         CSS_URI = 20,
00412         CSS_IDENT = 21,
00413         CSS_ATTR = 22,
00414         CSS_COUNTER = 23,
00415         CSS_RECT = 24,
00416         CSS_RGBCOLOR = 25,
00417     CSS_HTML_RELATIVE = 255
00418     };
00419 
00425     unsigned short primitiveType() const;
00426 
00455     void setFloatValue ( unsigned short unitType, float floatValue );
00456 
00482     // ### KDE 4: make this const!
00483     float getFloatValue ( unsigned short unitType );
00484 
00510     void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
00511 
00527     // ### KDE4: make this const!
00528     DOM::DOMString getStringValue (  );
00529 
00543     // ### KDE4: make this const!
00544     Counter getCounterValue (  );
00545 
00559     // ### KDE4: make this const!
00560     Rect getRectValue (  );
00561 
00576     // ### KDE4: make this const!
00577     RGBColor getRGBColorValue (  );
00578 };
00579 
00580 
00581 
00590 class KHTML_EXPORT RGBColor
00591 {
00592 public:
00593     RGBColor();
00597     RGBColor(const QColor& c) { m_color = c.rgb(); }
00598     RGBColor(QRgb color);
00599 
00600     RGBColor(const RGBColor &other);
00601     RGBColor & operator = (const RGBColor &other);
00602 
00603     ~RGBColor();
00604 
00609     CSSPrimitiveValue red() const;
00610 
00615     CSSPrimitiveValue green() const;
00616 
00621     CSSPrimitiveValue blue() const;
00622 
00626     QRgb color() const { return m_color; }
00627 protected:
00628     QRgb m_color;
00629 };
00630 
00631 class RectImpl;
00632 
00641 class KHTML_EXPORT Rect
00642 {
00643     friend class CSSPrimitiveValue;
00644 public:
00645     Rect();
00646     Rect(const Rect &other);
00647 
00648     Rect & operator = (const Rect &other);
00649 
00650     ~Rect();
00651 
00656     CSSPrimitiveValue top() const;
00657 
00662     CSSPrimitiveValue right() const;
00663 
00668     CSSPrimitiveValue bottom() const;
00669 
00674     CSSPrimitiveValue left() const;
00675 
00680     RectImpl *handle() const;
00681     bool isNull() const;
00682 
00683 protected:
00684     RectImpl *impl;
00685     Rect(RectImpl *i);
00686 };
00687 
00688 class CounterImpl;
00689 
00698 class KHTML_EXPORT Counter
00699 {
00700     friend class CSSPrimitiveValue;
00701 public:
00702     Counter();
00703     Counter(const Counter &other);
00704 public:
00705 
00706     Counter & operator = (const Counter &other);
00707 
00708     ~Counter();
00709 
00714     DOM::DOMString identifier() const;
00715 
00720     DOM::DOMString listStyle() const;
00721 
00726     DOM::DOMString separator() const;
00727 
00732     CounterImpl *handle() const;
00733     bool isNull() const;
00734 
00735 protected:
00736     CounterImpl *impl;
00737     Counter(CounterImpl *i);
00738 };
00739 
00740 
00741 } // namespace
00742 
00743 
00744 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jul 2 13:09:43 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003