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  * $Id: css_value.h,v 1.17.2.3 2003/10/05 13:00:08 mueller Exp $
00027  */
00028 #ifndef _CSS_css_value_h_
00029 #define _CSS_css_value_h_
00030 
00031 #include <dom/dom_string.h>
00032 
00033 #include <qcolor.h>
00034 
00035 namespace DOM {
00036 
00037 class CSSStyleDeclarationImpl;
00038 class CSSRule;
00039 class CSSValue;
00040 
00059 class CSSStyleDeclaration
00060 {
00061 public:
00062     CSSStyleDeclaration();
00063     CSSStyleDeclaration(const CSSStyleDeclaration &other);
00064     CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
00065 public:
00066 
00067     CSSStyleDeclaration & operator = (const CSSStyleDeclaration &other);
00068 
00069     ~CSSStyleDeclaration();
00070 
00078     DOM::DOMString cssText() const;
00079 
00091     void setCssText( const DOM::DOMString & );
00092 
00098     unsigned long length() const;
00099 
00104     CSSRule parentRule() const;
00105 
00119     DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName ) const;
00120     DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName );
00121 
00141     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
00142     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName );
00143 
00162     DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
00163 
00178     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
00179     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName );
00180 
00205     void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
00206 
00220     DOM::DOMString item ( unsigned long index ) const;
00221     DOM::DOMString item ( unsigned long index );
00222 
00227     CSSStyleDeclarationImpl *handle() const;
00228     bool isNull() const;
00229 
00230 protected:
00231     CSSStyleDeclarationImpl *impl;
00232 };
00233 
00234 
00235 class CSSValueImpl;
00236 
00242 class CSSValue
00243 {
00244 public:
00245     CSSValue();
00246     CSSValue(const CSSValue &other);
00247     CSSValue(CSSValueImpl *impl);
00248 public:
00249 
00250     CSSValue & operator = (const CSSValue &other);
00251 
00252     ~CSSValue();
00260     enum UnitTypes {
00261         CSS_INHERIT = 0,
00262         CSS_PRIMITIVE_VALUE = 1,
00263         CSS_VALUE_LIST = 2,
00264         CSS_CUSTOM = 3
00265     };
00266 
00271     DOM::DOMString cssText() const;
00272 
00284     void setCssText( const DOM::DOMString & );
00285 
00290     unsigned short cssValueType() const;
00291 
00296     bool isCSSValueList() const;
00297     bool isCSSPrimitiveValue() const;
00298     CSSValueImpl *handle() const;
00299     bool isNull() const;
00300 
00301 protected:
00302     CSSValueImpl *impl;
00303 };
00304 
00305 
00306 class CSSValueListImpl;
00307 class CSSValue;
00308 
00314 class CSSValueList : public CSSValue
00315 {
00316 public:
00317     CSSValueList();
00318     CSSValueList(const CSSValueList &other);
00319     CSSValueList(const CSSValue &other);
00320     CSSValueList(CSSValueListImpl *impl);
00321 public:
00322 
00323     CSSValueList & operator = (const CSSValueList &other);
00324     CSSValueList & operator = (const CSSValue &other);
00325 
00326     ~CSSValueList();
00327 
00334     unsigned long length() const;
00335 
00348     CSSValue item ( unsigned long index );
00349 
00350 protected:
00351     CSSValueListImpl *vimpl;
00352 };
00353 
00354 
00355 class CSSPrimitiveValueImpl;
00356 class Counter;
00357 class RGBColor;
00358 class Rect;
00359 
00371 class CSSPrimitiveValue : public CSSValue
00372 {
00373 public:
00374     CSSPrimitiveValue();
00375     CSSPrimitiveValue(const CSSPrimitiveValue &other);
00376     CSSPrimitiveValue(const CSSValue &other);
00377     CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
00378 public:
00379 
00380     CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
00381     CSSPrimitiveValue & operator = (const CSSValue &other);
00382 
00383     ~CSSPrimitiveValue();
00388     enum UnitTypes {
00389         CSS_UNKNOWN = 0,
00390         CSS_NUMBER = 1,
00391         CSS_PERCENTAGE = 2,
00392         CSS_EMS = 3,
00393         CSS_EXS = 4,
00394         CSS_PX = 5,
00395         CSS_CM = 6,
00396         CSS_MM = 7,
00397         CSS_IN = 8,
00398         CSS_PT = 9,
00399         CSS_PC = 10,
00400         CSS_DEG = 11,
00401         CSS_RAD = 12,
00402         CSS_GRAD = 13,
00403         CSS_MS = 14,
00404         CSS_S = 15,
00405         CSS_HZ = 16,
00406         CSS_KHZ = 17,
00407         CSS_DIMENSION = 18,
00408         CSS_STRING = 19,
00409         CSS_URI = 20,
00410         CSS_IDENT = 21,
00411         CSS_ATTR = 22,
00412         CSS_COUNTER = 23,
00413         CSS_RECT = 24,
00414         CSS_RGBCOLOR = 25,
00415         CSS_HTML_RELATIVE = 255
00416     };
00417 
00423     unsigned short primitiveType() const;
00424 
00453     void setFloatValue ( unsigned short unitType, float floatValue );
00454 
00480     float getFloatValue ( unsigned short unitType );
00481 
00507     void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
00508 
00524     DOM::DOMString getStringValue (  );
00525 
00539     Counter getCounterValue (  );
00540 
00554     Rect getRectValue (  );
00555 
00570     RGBColor getRGBColorValue (  );
00571 };
00572 
00573 
00574 
00583 class RGBColor
00584 {
00585 public:
00586     RGBColor();
00590     RGBColor(const QColor& c) { m_color = c.rgb(); }
00591     RGBColor(QRgb color);
00592 
00593     RGBColor(const RGBColor &other);
00594     RGBColor & operator = (const RGBColor &other);
00595 
00596     ~RGBColor();
00597 
00602     CSSPrimitiveValue red() const;
00603 
00608     CSSPrimitiveValue green() const;
00609 
00614     CSSPrimitiveValue blue() const;
00615 
00619     QRgb color() const { return m_color; }
00620 protected:
00621     QRgb m_color;
00622 };
00623 
00624 class RectImpl;
00625 
00634 class Rect
00635 {
00636     friend class CSSPrimitiveValue;
00637 public:
00638     Rect();
00639     Rect(const Rect &other);
00640 
00641     Rect & operator = (const Rect &other);
00642 
00643     ~Rect();
00644 
00649     CSSPrimitiveValue top() const;
00650 
00655     CSSPrimitiveValue right() const;
00656 
00661     CSSPrimitiveValue bottom() const;
00662 
00667     CSSPrimitiveValue left() const;
00668 
00673     RectImpl *handle() const;
00674     bool isNull() const;
00675 
00676 protected:
00677     RectImpl *impl;
00678     Rect(RectImpl *i);
00679 };
00680 
00681 class CounterImpl;
00682 
00691 class Counter
00692 {
00693     friend class CSSPrimitiveValue;
00694 public:
00695     Counter();
00696     Counter(const Counter &other);
00697 public:
00698 
00699     Counter & operator = (const Counter &other);
00700 
00701     ~Counter();
00702 
00707     DOM::DOMString identifier() const;
00708 
00713     DOM::DOMString listStyle() const;
00714 
00719     DOM::DOMString separator() const;
00720 
00725     CounterImpl *handle() const;
00726     bool isNull() const;
00727 
00728 protected:
00729     CounterImpl *impl;
00730     Counter(CounterImpl *i);
00731 };
00732 
00733 
00734 } // namespace
00735 
00736 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:33 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001