aboutsummaryrefslogtreecommitdiff
path: root/libXaw/specs/Template_private_header_file.xml
blob: a26e92eef9c4d8f6cc2cc1a949455cce4f3e944a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<sect1 id="Private_Header_File">
<title>Private Header File</title>
<para>
<!-- .LP -->
The private header file contains the complete declaration of the class
and instance structures for the widget and any additional private data
that will be required by anticipated subclasses of the widget.
Information in the private header file is normally hidden from the
application and is designed to be accessed only through other public
procedures; e.g.
<function>XtSetValues .</function>
</para>
<para>
<!-- .LP -->
The contents of the Template private header file,
<function>&lt; X11/Xaw/TemplateP.h &gt;, </function>
are:
</para>
<!-- .CB -->
<!-- .\".so ../../lib/Xaw/TemplateP.h -->
<literallayout class="monospaced">
/* Copyright (c) X Consortium 1987, 1988
 */

#ifndef _TemplateP_h
#define _TemplateP_h

#include &lt;X11/Xaw/Template.h&gt;
/* include superclass private header file */
#include &lt;X11/CoreP.h&gt;

/* define unique representation types not found in &lt;X11/StringDefs.h&gt; */

#define XtRTemplateResource "TemplateResource"

typedef struct {
	int empty;
} TemplateClassPart;

typedef struct _TemplateClassRec {
	CoreClassPart	core_class;
	TemplateClassPart	template_class;
} TemplateClassRec;

extern TemplateClassRec templateClassRec;

typedef struct {
	/* resources */
	char* resource;
	/* private state */
} TemplatePart;

typedef struct _TemplateRec {
	CorePart	core;
	TemplatePart	template;
} TemplateRec;

#endif /* _TemplateP_h */
<!-- .CE -->
</literallayout>
<para>
The private header file includes the private header file of its
superclass, thereby exposing the entire internal structure of the widget.
It may not always be advantageous to do this; your own project
development style will dictate the appropriate level of detail to expose
in each module.
</para>
<para>
The "WindowWidget" needs to declare two fields in its instance structure to
hold the drawing colors, a resource field for the font and a field for the
expose and user input callback lists:
</para>

<literallayout class="monospaced">
typedef struct {
	/* resources */
	Pixel color_1;
	Pixel color_2;
	XFontStruct* font;
	XtCallbackList expose_callback;
	XtCallbackList input_callback;
	/* private state */
	/* (none) */
} WindowPart;
</literallayout>

</sect1>