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 2002/11/25 05:15:54 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 );
00120 
00140     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName );
00141 
00160     DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
00161 
00176     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName );
00177 
00202     void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
00203 
00217     DOM::DOMString item ( unsigned long index );
00218 
00223     CSSStyleDeclarationImpl *handle() const;
00224     bool isNull() const;
00225 
00226 protected:
00227     CSSStyleDeclarationImpl *impl;
00228 };
00229 
00230 
00231 class CSSValueImpl;
00232 
00238 class CSSValue
00239 {
00240 public:
00241     CSSValue();
00242     CSSValue(const CSSValue &other);
00243     CSSValue(CSSValueImpl *impl);
00244 public:
00245 
00246     CSSValue & operator = (const CSSValue &other);
00247 
00248     ~CSSValue();
00256     enum UnitTypes {
00257     CSS_INHERIT = 0,
00258         CSS_PRIMITIVE_VALUE = 1,
00259         CSS_VALUE_LIST = 2,
00260         CSS_CUSTOM = 3
00261     };
00262 
00267     DOM::DOMString cssText() const;
00268 
00280     void setCssText( const DOM::DOMString & );
00281 
00286     unsigned short cssValueType() const;
00287 
00292     bool isCSSValueList() const;
00293     bool isCSSPrimitiveValue() const;
00294     CSSValueImpl *handle() const;
00295     bool isNull() const;
00296 
00297 protected:
00298     CSSValueImpl *impl;
00299 };
00300 
00301 
00302 class CSSValueListImpl;
00303 class CSSValue;
00304 
00310 class CSSValueList : public CSSValue
00311 {
00312 public:
00313     CSSValueList();
00314     CSSValueList(const CSSValueList &other);
00315     CSSValueList(const CSSValue &other);
00316     CSSValueList(CSSValueListImpl *impl);
00317 public:
00318 
00319     CSSValueList & operator = (const CSSValueList &other);
00320     CSSValueList & operator = (const CSSValue &other);
00321 
00322     ~CSSValueList();
00323 
00330     unsigned long length() const;
00331 
00344     CSSValue item ( unsigned long index );
00345 
00346 protected:
00347     CSSValueListImpl *vimpl;
00348 };
00349 
00350 
00351 class CSSPrimitiveValueImpl;
00352 class Counter;
00353 class RGBColor;
00354 class Rect;
00355 
00367 class CSSPrimitiveValue : public CSSValue
00368 {
00369 public:
00370     CSSPrimitiveValue();
00371     CSSPrimitiveValue(const CSSPrimitiveValue &other);
00372     CSSPrimitiveValue(const CSSValue &other);
00373     CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
00374 public:
00375 
00376     CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
00377     CSSPrimitiveValue & operator = (const CSSValue &other);
00378 
00379     ~CSSPrimitiveValue();
00384     enum UnitTypes {
00385         CSS_UNKNOWN = 0,
00386         CSS_NUMBER = 1,
00387         CSS_PERCENTAGE = 2,
00388         CSS_EMS = 3,
00389         CSS_EXS = 4,
00390         CSS_PX = 5,
00391         CSS_CM = 6,
00392         CSS_MM = 7,
00393         CSS_IN = 8,
00394         CSS_PT = 9,
00395         CSS_PC = 10,
00396         CSS_DEG = 11,
00397         CSS_RAD = 12,
00398         CSS_GRAD = 13,
00399         CSS_MS = 14,
00400         CSS_S = 15,
00401         CSS_HZ = 16,
00402         CSS_KHZ = 17,
00403         CSS_DIMENSION = 18,
00404         CSS_STRING = 19,
00405         CSS_URI = 20,
00406         CSS_IDENT = 21,
00407         CSS_ATTR = 22,
00408         CSS_COUNTER = 23,
00409         CSS_RECT = 24,
00410         CSS_RGBCOLOR = 25,
00411     CSS_HTML_RELATIVE = 255
00412     };
00413 
00419     unsigned short primitiveType() const;
00420 
00449     void setFloatValue ( unsigned short unitType, float floatValue );
00450 
00476     float getFloatValue ( unsigned short unitType );
00477 
00503     void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
00504 
00520     DOM::DOMString getStringValue (  );
00521 
00535     Counter getCounterValue (  );
00536 
00550     Rect getRectValue (  );
00551 
00566     RGBColor getRGBColorValue (  );
00567 };
00568 
00569 
00570 
00579 class RGBColor
00580 {
00581 public:
00582     RGBColor();
00586     RGBColor(const QColor& c) { m_color = c.rgb(); }
00587     RGBColor(QRgb color);
00588 
00589     RGBColor(const RGBColor &other);
00590     RGBColor & operator = (const RGBColor &other);
00591 
00592     ~RGBColor();
00593 
00598     CSSPrimitiveValue red() const;
00599 
00604     CSSPrimitiveValue green() const;
00605 
00610     CSSPrimitiveValue blue() const;
00611 
00615     QRgb color() const { return m_color; }
00616 protected:
00617     QRgb m_color;
00618 };
00619 
00620 class RectImpl;
00621 
00630 class Rect
00631 {
00632     friend class CSSPrimitiveValue;
00633 public:
00634     Rect();
00635     Rect(const Rect &other);
00636 
00637     Rect & operator = (const Rect &other);
00638 
00639     ~Rect();
00640 
00645     CSSPrimitiveValue top() const;
00646 
00651     CSSPrimitiveValue right() const;
00652 
00657     CSSPrimitiveValue bottom() const;
00658 
00663     CSSPrimitiveValue left() const;
00664 
00669     RectImpl *handle() const;
00670     bool isNull() const;
00671 
00672 protected:
00673     RectImpl *impl;
00674     Rect(RectImpl *i);
00675 };
00676 
00677 class CounterImpl;
00678 
00687 class Counter
00688 {
00689     friend class CSSPrimitiveValue;
00690 public:
00691     Counter();
00692     Counter(const Counter &other);
00693 public:
00694 
00695     Counter & operator = (const Counter &other);
00696 
00697     ~Counter();
00698 
00703     DOM::DOMString identifier() const;
00704 
00709     DOM::DOMString listStyle() const;
00710 
00715     DOM::DOMString separator() const;
00716 
00721     CounterImpl *handle() const;
00722     bool isNull() const;
00723 
00724 protected:
00725     CounterImpl *impl;
00726     Counter(CounterImpl *i);
00727 };
00728 
00729 
00730 }; // namespace
00731 
00732 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:34 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001