upload tizen2.0 source
[framework/uifw/xorg/lib/libxaw.git] / specs / Template_private_header_file.xml
1 <sect1 id="Private_Header_File">
2 <title>Private Header File</title>
3 <para>
4 <!-- .LP -->
5 The private header file contains the complete declaration of the class
6 and instance structures for the widget and any additional private data
7 that will be required by anticipated subclasses of the widget.
8 Information in the private header file is normally hidden from the
9 application and is designed to be accessed only through other public
10 procedures; e.g.
11 <function>XtSetValues .</function>
12 </para>
13 <para>
14 <!-- .LP -->
15 The contents of the Template private header file,
16 <function>&lt; X11/Xaw/TemplateP.h &gt;, </function>
17 are:
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
36 typedef struct {
37         int empty;
38 } TemplateClassPart;
39
40 typedef struct _TemplateClassRec {
41         CoreClassPart   core_class;
42         TemplateClassPart       template_class;
43 } TemplateClassRec;
44
45 extern TemplateClassRec templateClassRec;
46
47 typedef struct {
48         /* resources */
49         char* resource;
50         /* private state */
51 } TemplatePart;
52
53 typedef struct _TemplateRec {
54         CorePart        core;
55         TemplatePart    template;
56 } TemplateRec;
57
58 #endif /* _TemplateP_h */
59 <!-- .CE -->
60 </literallayout>
61 <para>
62 The private header file includes the private header file of its
63 superclass, thereby exposing the entire internal structure of the widget.
64 It may not always be advantageous to do this; your own project
65 development style will dictate the appropriate level of detail to expose
66 in each module.
67 </para>
68 <para>
69 The "WindowWidget" needs to declare two fields in its instance structure to
70 hold the drawing colors, a resource field for the font and a field for the
71 expose and user input callback lists:
72 </para>
73
74 <literallayout class="monospaced">
75 typedef 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>