1<sect1 id="Private_Header_File">
2<title>Private Header File</title>
3<para>
4<!-- .LP -->
5The private header file contains the complete declaration of the class
6and instance structures for the widget and any additional private data
7that will be required by anticipated subclasses of the widget.
8Information in the private header file is normally hidden from the
9application and is designed to be accessed only through other public
10procedures; e.g.
11<function>XtSetValues</function>.
12</para>
13<para>
14<!-- .LP -->
15The contents of the Template private header file,
16<filename class="headerfile">&lt;X11/Xaw/TemplateP.h&gt;</filename>,
17are:
18</para>
19<!-- .CB -->
20<!-- .\".so ../../lib/Xaw/TemplateP.h -->
21<literallayout class="monospaced">
22/* Copyright (c) X Consortium 1987, 1988
23 */
24
25#ifndef _TemplateP_h
26#define _TemplateP_h
27
28#include &lt;X11/Xaw/Template.h&gt;
29/* include superclass private header file */
30#include &lt;X11/CoreP.h&gt;
31
32/* define unique representation types not found in &lt;X11/StringDefs.h&gt; */
33
34#define XtRTemplateResource "TemplateResource"
35
36typedef struct {
37	int empty;
38} TemplateClassPart;
39
40typedef struct _TemplateClassRec {
41	CoreClassPart	core_class;
42	TemplateClassPart	template_class;
43} TemplateClassRec;
44
45extern TemplateClassRec templateClassRec;
46
47typedef struct {
48	/* resources */
49	char* resource;
50	/* private state */
51} TemplatePart;
52
53typedef struct _TemplateRec {
54	CorePart	core;
55	TemplatePart	template;
56} TemplateRec;
57
58#endif /* _TemplateP_h */
59<!-- .CE -->
60</literallayout>
61<para>
62The private header file includes the private header file of its
63superclass, thereby exposing the entire internal structure of the widget.
64It may not always be advantageous to do this; your own project
65development style will dictate the appropriate level of detail to expose
66in each module.
67</para>
68<para>
69The "WindowWidget" needs to declare two fields in its instance structure to
70hold the drawing colors, a resource field for the font and a field for the
71expose and user input callback lists:
72</para>
73
74<literallayout class="monospaced">
75typedef struct {
76	/* resources */
77	Pixel color_1;
78	Pixel color_2;
79	XFontStruct* font;
80	XtCallbackList expose_callback;
81	XtCallbackList input_callback;
82	/* private state */
83	/* (none) */
84} WindowPart;
85</literallayout>
86
87</sect1>
88