os_horizontal_rule
|
 |
A horizontal rule.
An os_horizontal_rule
is a horizontal line typically used to separate sections within a Web page by
terminating a preceding block-structuring element like an os_paragraph
. An os_horizontal_rule can specify the following
characteristics.
- Thickness-Specifies the
horizontal line thickness, in pixels, through the
size()
member function.
- Width-Specifies the
horizontal line width as a percentage of the display size in a constructor
or through the
width() member function. The width()
member function is overloaded so that width can be specified in absolute
pixels. By default, the horizontal line extends completely across the view
area.
- Alignment-Typically centers
the horizontal line within the view area. Alignment can be specified in a
constructor or through the
align() member
function.
- Shading-Typically renders
the horizontal line as chiseled and shaded. A simple, non-shaded rendering
can be specified in a constructor or through the
shade()
member function.
Note that the thickness, width,
alignment, and shading specifications support HTML extensions implemented by
Netscape browsers.
Declaration
#include <ospace/web/hrule.h>
class os_horizontal_rule : public os_element
Enums
enum os_horizontal_rule::alignment
{
left, // Aligns the horizontal rule against the left margin.
center, // Centers the horizontal rule between the left and right margins.
right // Aligns the horizontal rule against the right margin.
};
enum os_horizontal_rule::shading
{
shaded, // Displays the horizontal rule as a shaded line.
not_shaded // Displays the horizontal rule as a solid black line with no shading.
};
Interface
Constructor
os_horizontal_rule()
Constructs a horizontal
rule.
Constructor
os_horizontal_rule(
int size )
Constructs a horizontal
rule that is size pixels thick.
Constructor
os_horizontal_rule(
alignment align )
Constructs a horizontal
rule with alignment align .
Constructor
os_horizontal_rule(
int size ,
const string& width )
Constructs a horizontal
rule that is size pixels thick and spans
width percent of the window.
Constructor
os_horizontal_rule(
int size ,
alignment align )
Constructs a horizontal
rule that is size pixels thick with alignment align
.
Constructor
os_horizontal_rule(
int size ,
const string& width ,
alignment align )
Constructs a horizontal
rule that is size pixels thick, spans
width percent of the window, and has alignment align
.
Constructor
os_horizontal_rule(
int size ,
const string& width ,
alignment align ,
shading shade )
Constructs a horizontal
rule that is size pixels thick, spans width
percent of the window, and has alignment align and
shading shade .
align
os_horizontal_rule&
align( alignment align )
Sets the alignment to align
and returns a reference to the horizontal rule.
align
int
align() const
Returns the alignment, or os_element::use_default
if not set.
clone
/*
virtual */ os_element* clone() const
Returns a base class
pointer to a heap-based deep copy of the horizontal rule.
shade
os_horizontal_rule&
shade( shading shade )
Sets the shading to shade
and returns a reference to the horizontal rule.
shade
int
shade() const
Returns the shading, or os_horizontal_rule::shaded
if not set.
size
os_horizontal_rule&
size( int size )
Sets the size (vertical
thickness) to size pixels, and returns a reference
to the horizontal rule.
size
int
size() const
Returns the size, or 0 if
not set.
width
string
width() const
Returns the width, or the
empty string if not set. If the string ends with a percent sign, %
, width is a percentage of the window width. Otherwise, width is returned in
pixels.
width
os_horizontal_rule&
width( const string& percentage )
Sets the width to percentage
percent of window width and returns a reference to the horizontal rule.
width
os_horizontal_rule&
width( int pixels )
Sets the width to pixels
pixels and returns a reference to the horizontal rule.
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved