Annotation of libwww/Library/src/HTStyle.html, revision 2.23
2.6 timbl 1: <HTML>
2: <HEAD>
2.19 frystyk 3: <TITLE>Style Manager</TITLE>
2.23 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 19-Nov-1995 -->
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
2.14 frystyk 63: #include <appkit/appkit.h>
2.1 timbl 64: typedef NXCoord HTCoord;
65: #define HTParagraphStyle NXTextStyle
66: #define HTCoord NXCoord
67: typedef struct _color {
2.15 frystyk 68: double grey;
2.1 timbl 69: int RGBColor;
70: } HTColor;
71: #else
72:
2.15 frystyk 73: typedef double HTCoord;
2.1 timbl 74:
75: typedef struct _HTParagraphStyle {
76: HTCoord left_indent; /* @@@@ junk! etc etc*/
77: } HTParagraphStyle;
78:
79: typedef int HTColor; /* Sorry about the US spelling! */
80:
81: #endif
82:
83: typedef struct {
84: short kind; /* only NX_LEFTTAB implemented*/
85: HTCoord position; /* x coordinate for stop */
86: } HTTabStop;
87:
2.9 timbl 88: #else
89: typedef struct _HTParagraphStyle HTParagraphStyle;
90: #endif
91:
92:
93:
94: #define STYLE_NAME_LENGTH 80 /* @@@@@@@@@@@ */
95:
2.1 timbl 96:
97: /* The Style Structure
98: ** -------------------
99: */
100:
2.22 frystyk 101: typedef struct _HTStyle HTStyle;
2.1 timbl 102:
2.10 timbl 103: </pre>
104: <h2>Style Creation</h2>
105: <h3>HtStyleModify</h3>
106: This routine is passed the style for a particular SGML nesting state,
107: and the element number of a new element whithin that state.
108: The routine returns a suitable style for text within the new element.
109: It is passed a popinter tothe nesting state so that it can link
110: the style back to the nesting state for later manipulation
111: of the SGML nesting tree.
112: <pre>
113:
2.23 ! frystyk 114: extern HTStyle * HTStyleModify (
2.10 timbl 115: HTStyle * style,
116: HTNesting* nesting,
2.23 ! frystyk 117: int element_number);
2.10 timbl 118:
119:
2.1 timbl 120:
121: /* Style functions:
122: */
2.23 ! frystyk 123: extern HTStyle * HTStyleNew (void);
! 124: extern HTStyle* HTStyleNewNamed (CONST char * name);
! 125: extern HTStyle * HTStyleFree (HTStyle * self);
2.1 timbl 126: #ifdef SUPRESS
2.23 ! frystyk 127: extern HTStyle * HTStyleRead (HTStyle * self, HTStream * stream);
! 128: extern HTStyle * HTStyleWrite (HTStyle * self, HTStream * stream);
2.1 timbl 129: #endif
130: /* Style Sheet
131: ** -----------
132: */
133: typedef struct _HTStyleSheet {
134: char * name;
135: HTStyle * styles;
136: } HTStyleSheet;
137:
138:
139: /* Stylesheet functions:
140: */
2.23 ! frystyk 141: extern HTStyleSheet * HTStyleSheetNew (void);
! 142: extern HTStyleSheet * HTStyleSheetFree (HTStyleSheet * self);
! 143: extern HTStyle * HTStyleNamed (HTStyleSheet * self, CONST char * name);
! 144: extern HTStyle * HTStyleMatching (HTStyleSheet *self, HTStyle * style);
! 145: /* extern HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun * run); */
! 146: extern HTStyleSheet * HTStyleSheetAddStyle (HTStyleSheet * self,
! 147: HTStyle * style);
! 148: extern HTStyleSheet * HTStyleSheetRemoveStyle (HTStyleSheet * self,
! 149: HTStyle * style);
2.1 timbl 150: #ifdef SUPPRESS
2.23 ! frystyk 151: extern HTStyleSheet * HTStyleSheetRead (HTStyleSheet * self,
! 152: HTStream * stream);
! 153: extern HTStyleSheet * HTStyleSheetWrite (HTStyleSheet * self,
! 154: HTStream * stream);
2.1 timbl 155: #endif
156: #define CLEAR_POINTER ((void *)-1) /* Pointer value means "clear me" */
157: #endif /* HTStyle_H */
2.6 timbl 158:
2.7 timbl 159:
160: </BODY>
2.6 timbl 161: </HTML>
Webmaster