TQStyleSheetItem Class Reference
The TQStyleSheetItem class provides an encapsulation of a set of text styles.
More...
#include <ntqstylesheet.h>
Inherits TQt.
List of all member functions.
Public Members
- TQStyleSheetItem ( TQStyleSheet * parent, const TQString & name )
- TQStyleSheetItem ( const TQStyleSheetItem & other )
- ~TQStyleSheetItem ()
- TQStyleSheetItem & operator= ( const TQStyleSheetItem & other )
- TQString name () const
- TQStyleSheet * styleSheet ()
- const TQStyleSheet * styleSheet () const
- enum DisplayMode { DisplayBlock, DisplayInline, DisplayListItem, DisplayNone }
- DisplayMode displayMode () const
- void setDisplayMode ( DisplayMode m )
- int alignment () const
- void setAlignment ( int f )
- enum VerticalAlignment { VAlignBaseline, VAlignSub, VAlignSuper }
- VerticalAlignment verticalAlignment () const
- void setVerticalAlignment ( VerticalAlignment valign )
- int fontWeight () const
- void setFontWeight ( int w )
- int logicalFontSize () const
- void setLogicalFontSize ( int s )
- int logicalFontSizeStep () const
- void setLogicalFontSizeStep ( int s )
- int fontSize () const
- void setFontSize ( int s )
- TQString fontFamily () const
- void setFontFamily ( const TQString & fam )
- int numberOfColumns () const (obsolete)
- void setNumberOfColumns ( int ncols ) (obsolete)
- TQColor color () const
- void setColor ( const TQColor & c )
- bool fontItalic () const
- void setFontItalic ( bool italic )
- bool definesFontItalic () const
- bool fontUnderline () const
- void setFontUnderline ( bool underline )
- bool definesFontUnderline () const
- bool fontStrikeOut () const
- void setFontStrikeOut ( bool strikeOut )
- bool definesFontStrikeOut () const
- bool isAnchor () const
- void setAnchor ( bool anc )
- enum WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap }
- WhiteSpaceMode whiteSpaceMode () const
- void setWhiteSpaceMode ( WhiteSpaceMode m )
- enum Margin { MarginLeft, MarginRight, MarginTop, MarginBottom, MarginFirstLine, MarginAll, MarginVertical, MarginHorizontal }
- int margin ( Margin m ) const
- void setMargin ( Margin m, int v )
- enum ListStyle { ListDisc, ListCircle, ListSquare, ListDecimal, ListLowerAlpha, ListUpperAlpha }
- ListStyle listStyle () const
- void setListStyle ( ListStyle s )
- TQString contexts () const
- void setContexts ( const TQString & c )
- bool allowedInContext ( const TQStyleSheetItem * s ) const
- bool selfNesting () const
- void setSelfNesting ( bool nesting )
- int lineSpacing () const (obsolete)
Detailed Description
The TQStyleSheetItem class provides an encapsulation of a set of text styles.
A style sheet item consists of a name and a set of attributes that
specifiy its font, color, etc. When used in a style sheet (see styleSheet()), items define the name() of
a rich text tag and the display property changes associated with
it.
The display mode
attribute indicates whether the item is a block, an inline element
or a list element; see setDisplayMode(). The treatment of
whitespace is controlled by the white space mode; see
setWhiteSpaceMode(). An item's margins are set with setMargin(),
In the case of list items, the list style is set with
setListStyle(). An item may be a hypertext link anchor; see
setAnchor(). Other attributes are set with setAlignment(),
setVerticalAlignment(), setFontFamily(), setFontSize(),
setFontWeight(), setFontItalic(), setFontUnderline(),
setFontStrikeOut and setColor().
See also Text Related Classes.
Member Type Documentation
TQStyleSheetItem::DisplayMode
This enum type defines the way adjacent elements are displayed.
- TQStyleSheetItem::DisplayBlock - elements are displayed as a rectangular block
(e.g. <p>...</p>).
- TQStyleSheetItem::DisplayInline - elements are displayed in a horizontally
flowing sequence (e.g. <em>...</em>).
- TQStyleSheetItem::DisplayListItem - elements are displayed in a vertical
sequence (e.g. <li>...</li>).
- TQStyleSheetItem::DisplayNone - elements are not displayed at all.
TQStyleSheetItem::ListStyle
This enum type defines how the items in a list are prefixed when
displayed.
- TQStyleSheetItem::ListDisc - a filled circle (i.e. a bullet)
- TQStyleSheetItem::ListCircle - an unfilled circle
- TQStyleSheetItem::ListSquare - a filled square
- TQStyleSheetItem::ListDecimal - an integer in base 10: 1, 2, 3, ...
- TQStyleSheetItem::ListLowerAlpha - a lowercase letter: a, b, c, ...
- TQStyleSheetItem::ListUpperAlpha - an uppercase letter: A, B, C, ...
TQStyleSheetItem::Margin
- TQStyleSheetItem::MarginLeft - left margin
- TQStyleSheetItem::MarginRight - right margin
- TQStyleSheetItem::MarginTop - top margin
- TQStyleSheetItem::MarginBottom - bottom margin
- TQStyleSheetItem::MarginAll - all margins (left, right, top and bottom)
- TQStyleSheetItem::MarginVertical - top and bottom margins
- TQStyleSheetItem::MarginHorizontal - left and right margins
- TQStyleSheetItem::MarginFirstLine - margin (indentation) of the first line of
a paragarph (in addition to the MarginLeft of the paragraph)
TQStyleSheetItem::VerticalAlignment
This enum type defines the way elements are aligned vertically.
This is only supported for text elements.
- TQStyleSheetItem::VAlignBaseline - align the baseline of the element (or the
bottom, if the element doesn't have a baseline) with the
baseline of the parent
- TQStyleSheetItem::VAlignSub - subscript the element
- TQStyleSheetItem::VAlignSuper - superscript the element
TQStyleSheetItem::WhiteSpaceMode
This enum defines the ways in which TQStyleSheet can treat
whitespace.
- TQStyleSheetItem::WhiteSpaceNormal - any sequence of whitespace (including
line-breaks) is equivalent to a single space.
- TQStyleSheetItem::WhiteSpacePre - whitespace must be output exactly as given
in the input.
- TQStyleSheetItem::WhiteSpaceNoWrap - multiple spaces are collapsed as with
WhiteSpaceNormal, but no automatic line-breaks occur. To break
lines manually, use the <br> tag.
Member Function Documentation
TQStyleSheetItem::TQStyleSheetItem ( TQStyleSheet * parent, const TQString & name )
Constructs a new style called name for the stylesheet parent.
All properties in TQStyleSheetItem are initially in the "do not
change" state, except display
mode, which defaults to DisplayInline.
TQStyleSheetItem::TQStyleSheetItem ( const TQStyleSheetItem & other )
Copy constructor. Constructs a copy of other that is not bound
to any style sheet.
TQStyleSheetItem::~TQStyleSheetItem ()
Destroys the style. Note that TQStyleSheetItem objects become
owned by TQStyleSheet when they are created.
int TQStyleSheetItem::alignment () const
Returns the alignment of this style. Possible values are AlignAuto, AlignLeft, AlignRight, AlignCenter or AlignJustify.
See also setAlignment() and TQt::AlignmentFlags.
bool TQStyleSheetItem::allowedInContext ( const TQStyleSheetItem * s ) const
Returns TRUE if this style can be nested into an element of style
s; otherwise returns FALSE.
See also contexts() and setContexts().
TQColor TQStyleSheetItem::color () const
Returns the text color of this style or an invalid color if no
color has been set.
See also setColor() and TQColor::isValid().
TQString TQStyleSheetItem::contexts () const
Returns a space-separated list of names of styles that may contain
elements of this style. If nothing has been set, contexts()
returns an empty string, which indicates that this style can be
nested everywhere.
See also setContexts().
bool TQStyleSheetItem::definesFontItalic () const
Returns TRUE if the style defines a font shape; otherwise returns
FALSE. A style does not define any shape until setFontItalic() is
called.
See also setFontItalic() and fontItalic().
bool TQStyleSheetItem::definesFontStrikeOut () const
Returns TRUE if the style defines a setting for the strikeOut
property of the font; otherwise returns FALSE. A style does not
define this until setFontStrikeOut() is called.
See also setFontStrikeOut() and fontStrikeOut().
bool TQStyleSheetItem::definesFontUnderline () const
Returns TRUE if the style defines a setting for the underline
property of the font; otherwise returns FALSE. A style does not
define this until setFontUnderline() is called.
See also setFontUnderline() and fontUnderline().
DisplayMode TQStyleSheetItem::displayMode () const
Returns the display
mode of the style.
See also setDisplayMode().
TQString TQStyleSheetItem::fontFamily () const
Returns the font family setting of the style. This is either a
valid font family or TQString::null if no family has been set.
See also setFontFamily(), TQFont::family(), and TQFont::setFamily().
bool TQStyleSheetItem::fontItalic () const
Returns TRUE if the style sets an italic font; otherwise returns
FALSE.
See also setFontItalic() and definesFontItalic().
int TQStyleSheetItem::fontSize () const
Returns the font size setting of the style. This is either a valid
point size or TQStyleSheetItem::Undefined.
See also setFontSize(), TQFont::pointSize(), and TQFont::setPointSize().
bool TQStyleSheetItem::fontStrikeOut () const
Returns TRUE if the style sets a strike out font; otherwise
returns FALSE.
See also setFontStrikeOut() and definesFontStrikeOut().
bool TQStyleSheetItem::fontUnderline () const
Returns TRUE if the style sets an underlined font; otherwise
returns FALSE.
See also setFontUnderline() and definesFontUnderline().
int TQStyleSheetItem::fontWeight () const
Returns the font weight setting of the style. This is either a
valid TQFont::Weight or the value TQStyleSheetItem::Undefined.
See also setFontWeight() and TQFont.
bool TQStyleSheetItem::isAnchor () const
Returns whether this style is an anchor.
See also setAnchor().
int TQStyleSheetItem::lineSpacing () const
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.
Returns the linespacing
ListStyle TQStyleSheetItem::listStyle () const
Returns the list style of the style.
See also setListStyle() and ListStyle.
int TQStyleSheetItem::logicalFontSize () const
Returns the logical font size setting of the style. This is either
a valid size between 1 and 7 or TQStyleSheetItem::Undefined.
See also setLogicalFontSize(), setLogicalFontSizeStep(), TQFont::pointSize(), and TQFont::setPointSize().
int TQStyleSheetItem::logicalFontSizeStep () const
Returns the logical font size step of this style.
The default is 0. Tags such as big define +1; small
defines -1.
See also setLogicalFontSizeStep().
int TQStyleSheetItem::margin ( Margin m ) const
Returns the width of margin m in pixels.
The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom, or MarginFirstLine.
See also setMargin() and Margin.
TQString TQStyleSheetItem::name () const
Returns the name of the style item.
int TQStyleSheetItem::numberOfColumns () const
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.
Returns the number of columns for this style.
See also setNumberOfColumns(), displayMode(), and setDisplayMode().
Assignment. Assings a copy of other that is not bound to any style sheet.
Unbounds first from previous style sheet.
bool TQStyleSheetItem::selfNesting () const
Returns TRUE if this style has self-nesting enabled; otherwise
returns FALSE.
See also setSelfNesting().
void TQStyleSheetItem::setAlignment ( int f )
Sets the alignment to f. This only makes sense for styles with
a display mode of
DisplayBlock. Possible values are AlignAuto, AlignLeft,
AlignRight, AlignCenter or AlignJustify.
See also alignment(), displayMode(), and TQt::AlignmentFlags.
void TQStyleSheetItem::setAnchor ( bool anc )
If anc is TRUE, sets this style to be an anchor (hypertext
link); otherwise sets it to not be an anchor. Elements in this
style link to other documents or anchors.
See also isAnchor().
void TQStyleSheetItem::setColor ( const TQColor & c )
Sets the text color of this style to c.
See also color().
void TQStyleSheetItem::setContexts ( const TQString & c )
Sets a space-separated list of names of styles that may contain
elements of this style. If c is empty, the style can be nested
everywhere.
See also contexts().
void TQStyleSheetItem::setDisplayMode ( DisplayMode m )
Sets the display mode of the style to m.
See also displayMode().
void TQStyleSheetItem::setFontFamily ( const TQString & fam )
Sets the font family setting of the style to fam.
See also fontFamily(), TQFont::family(), and TQFont::setFamily().
void TQStyleSheetItem::setFontItalic ( bool italic )
If italic is TRUE sets italic for the style; otherwise sets
upright.
See also fontItalic() and definesFontItalic().
void TQStyleSheetItem::setFontSize ( int s )
Sets the font size setting of the style to s points.
See also fontSize(), TQFont::pointSize(), and TQFont::setPointSize().
void TQStyleSheetItem::setFontStrikeOut ( bool strikeOut )
If strikeOut is TRUE, sets strike out for the style; otherwise
sets no strike out.
See also fontStrikeOut() and definesFontStrikeOut().
void TQStyleSheetItem::setFontUnderline ( bool underline )
If underline is TRUE, sets underline for the style; otherwise
sets no underline.
See also fontUnderline() and definesFontUnderline().
void TQStyleSheetItem::setFontWeight ( int w )
Sets the font weight setting of the style to w. Valid values
are those defined by TQFont::Weight.
See also TQFont and fontWeight().
void TQStyleSheetItem::setListStyle ( ListStyle s )
Sets the list style of the style to s.
This is used by nested elements that have a display mode of DisplayListItem.
See also listStyle(), DisplayMode, and ListStyle.
void TQStyleSheetItem::setLogicalFontSize ( int s )
Sets the logical font size setting of the style to s. Valid
logical sizes are 1 to 7.
See also logicalFontSize(), TQFont::pointSize(), and TQFont::setPointSize().
void TQStyleSheetItem::setLogicalFontSizeStep ( int s )
Sets the logical font size step of this style to s.
See also logicalFontSizeStep().
void TQStyleSheetItem::setMargin ( Margin m, int v )
Sets the width of margin m to v pixels.
The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom, MarginFirstLine, MarginAll,
MarginVertical or MarginHorizontal. The value v must
be >= 0.
See also margin().
void TQStyleSheetItem::setNumberOfColumns ( int ncols )
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.
Sets the number of columns for this style. Elements in the style
are divided into columns.
This makes sense only if the style uses a block display mode
(see TQStyleSheetItem::DisplayMode).
See also numberOfColumns().
void TQStyleSheetItem::setSelfNesting ( bool nesting )
Sets the self-nesting property for this style to nesting.
In order to support "dirty" HTML, paragraphs <p> and list
items <li> are not self-nesting. This means that starting a
new paragraph or list item automatically closes the previous one.
See also selfNesting().
void TQStyleSheetItem::setVerticalAlignment ( VerticalAlignment valign )
Sets the vertical alignment to valign. Possible values are
VAlignBaseline, VAlignSub or VAlignSuper.
The vertical alignment property is not inherited.
See also verticalAlignment().
void TQStyleSheetItem::setWhiteSpaceMode ( WhiteSpaceMode m )
Sets the whitespace mode to m.
See also WhiteSpaceMode.
TQStyleSheet * TQStyleSheetItem::styleSheet ()
Returns the style sheet this item is in.
const TQStyleSheet * TQStyleSheetItem::styleSheet () const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the style sheet this item is in.
VerticalAlignment TQStyleSheetItem::verticalAlignment () const
Returns the vertical alignment of the style. Possible values are
VAlignBaseline, VAlignSub or VAlignSuper.
See also setVerticalAlignment().
WhiteSpaceMode TQStyleSheetItem::whiteSpaceMode () const
Returns the whitespace mode.
See also setWhiteSpaceMode() and WhiteSpaceMode.
This file is part of the TQt toolkit.
Copyright © 1995-2007
Trolltech. All Rights Reserved.