Annotation of libwww/Library/src/HTStyle.html, revision 2.25
2.6 timbl 1: <HTML>
2: <HEAD>
2.25 ! frystyk 3: <TITLE>W3C Reference Library libwww STYLE MANAGER</TITLE>
2.24 frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 29-Feb-1996 -->
2.12 frystyk 5: </HEAD>
2.6 timbl 6: <BODY>
2.11 frystyk 7:
2.12 frystyk 8: <H1>Style Definition for Hypertext</H1>
9:
10: <PRE>
11: /*
2.17 frystyk 12: ** (c) COPYRIGHT MIT 1995.
2.12 frystyk 13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
16:
17: Styles allow the translation between a logical property of a piece of
18: text and its physical representation. A StyleSheet is a collection of
19: styles, defining the translation necessary to represent a document. It
20: is a linked list of styles.
2.11 frystyk 21:
22: <H2>Overriding this module</H2>
23:
24: Why is the style structure declared in the HTStyle.h module, instead
25: of having the user browser define the structure, and the HTStyle
26: routines just use sizeof() for copying?<P>
27:
28: It's not obvious whether HTStyle.c should be common code. It's useful
29: to have common code for loading style sheets, especially if the
30: movement toward standard style sheets gets going.<P>
31:
32: If it <B>is</B> common code, then both the hypertext object and
33: HTStyle.c must know the structure of a style, so HTStyle.h is a
34: suitable place to put that.<P>
35:
36: If we take it out of the library, then of course HTStyle could be
37: declared as an undefined structure. The only references to it are in
38: the structure-flattening code HTML.c and HTPlain.c, which only use
39: HTStypeNamed().<P>
40:
41: You can in any case override this function in your own code, which
42: will prevent the HTStyle from being loaded. You will be able to
43: redefine your style structure in this case without problems, as no
2.12 frystyk 44: other moule needs to know it. <P>
45:
46: This module is implemented by <A HREF="HTStyle.c">HTStyle.c</A>, and
47: it is a part of the <A
2.21 frystyk 48: HREF="http://www.w3.org/pub/WWW/Library/">
2.18 frystyk 49: W3C Reference Library</A>.
2.11 frystyk 50:
2.10 timbl 51: <PRE>
52: #ifndef HTStyle_H
2.1 timbl 53: #define HTStyle_H
54:
2.8 luotonen 55: #include "HTFormat.h"
2.1 timbl 56: #include "HTAnchor.h"
2.10 timbl 57: #include "HTML.h"
2.1 timbl 58:
59: typedef long int HTFont; /* Dummy definition instead */
60:
2.9 timbl 61: #ifdef DEFINE_STRUCT_HTSTYLE
2.1 timbl 62: #ifdef NeXT_suppressed
63: typedef NXCoord HTCoord;
64: #define HTParagraphStyle NXTextStyle
65: #define HTCoord NXCoord
66: typedef struct _color {
2.15 frystyk 67: double grey;
2.1 timbl 68: int RGBColor;
69: } HTColor;
70: #else
71:
2.15 frystyk 72: typedef double HTCoord;
2.1 timbl 73:
74: typedef struct _HTParagraphStyle {
75: HTCoord left_indent; /* @@@@ junk! etc etc*/
76: } HTParagraphStyle;
77:
78: typedef int HTColor; /* Sorry about the US spelling! */
79:
80: #endif
81:
82: typedef struct {
83: short kind; /* only NX_LEFTTAB implemented*/
84: HTCoord position; /* x coordinate for stop */
85: } HTTabStop;
86:
2.9 timbl 87: #else
88: typedef struct _HTParagraphStyle HTParagraphStyle;
89: #endif
90:
91:
92:
93: #define STYLE_NAME_LENGTH 80 /* @@@@@@@@@@@ */
94:
2.1 timbl 95:
96: /* The Style Structure
97: ** -------------------
98: */
99:
2.22 frystyk 100: typedef struct _HTStyle HTStyle;
2.1 timbl 101:
2.10 timbl 102: </pre>
103: <h2>Style Creation</h2>
104: <h3>HtStyleModify</h3>
105: This routine is passed the style for a particular SGML nesting state,
106: and the element number of a new element whithin that state.
107: The routine returns a suitable style for text within the new element.
108: It is passed a popinter tothe nesting state so that it can link
109: the style back to the nesting state for later manipulation
110: of the SGML nesting tree.
111: <pre>
112:
2.23 frystyk 113: extern HTStyle * HTStyleModify (
2.10 timbl 114: HTStyle * style,
115: HTNesting* nesting,
2.23 frystyk 116: int element_number);
2.10 timbl 117:
118:
2.1 timbl 119:
120: /* Style functions:
121: */
2.23 frystyk 122: extern HTStyle * HTStyleNew (void);
2.24 frystyk 123: extern HTStyle* HTStyleNewNamed (const char * name);
2.23 frystyk 124: extern HTStyle * HTStyleFree (HTStyle * self);
2.1 timbl 125: #ifdef SUPRESS
2.23 frystyk 126: extern HTStyle * HTStyleRead (HTStyle * self, HTStream * stream);
127: extern HTStyle * HTStyleWrite (HTStyle * self, HTStream * stream);
2.1 timbl 128: #endif
129: /* Style Sheet
130: ** -----------
131: */
132: typedef struct _HTStyleSheet {
133: char * name;
134: HTStyle * styles;
135: } HTStyleSheet;
136:
137:
138: /* Stylesheet functions:
139: */
2.23 frystyk 140: extern HTStyleSheet * HTStyleSheetNew (void);
141: extern HTStyleSheet * HTStyleSheetFree (HTStyleSheet * self);
2.24 frystyk 142: extern HTStyle * HTStyleNamed (HTStyleSheet * self, const char * name);
2.23 frystyk 143: extern HTStyle * HTStyleMatching (HTStyleSheet *self, HTStyle * style);
144: /* extern HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun * run); */
145: extern HTStyleSheet * HTStyleSheetAddStyle (HTStyleSheet * self,
146: HTStyle * style);
147: extern HTStyleSheet * HTStyleSheetRemoveStyle (HTStyleSheet * self,
148: HTStyle * style);
2.1 timbl 149: #ifdef SUPPRESS
2.23 frystyk 150: extern HTStyleSheet * HTStyleSheetRead (HTStyleSheet * self,
151: HTStream * stream);
152: extern HTStyleSheet * HTStyleSheetWrite (HTStyleSheet * self,
153: HTStream * stream);
2.1 timbl 154: #endif
155: #define CLEAR_POINTER ((void *)-1) /* Pointer value means "clear me" */
156: #endif /* HTStyle_H */
2.6 timbl 157:
2.7 timbl 158:
159: </BODY>
2.6 timbl 160: </HTML>
Webmaster