1994689c1Smrg<sect1 id="Public_Header_File"> 2994689c1Smrg<title>Public Header File</title> 3994689c1Smrg<para> 4994689c1SmrgThe public header file contains declarations that will be required by any 5994689c1Smrgapplication module that needs to refer to the widget; whether to create 6994689c1Smrgan instance of the class, to perform an 7421c997bSmrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 8994689c1Smrgoperation, or to call a public routine implemented by the widget class. 9994689c1Smrg</para> 10994689c1Smrg<para> 11994689c1Smrg<!-- .LP --> 12994689c1SmrgThe contents of the Template public header file, 135ec34c4cSmrg<filename class="headerfile"><X11/Xaw/Template.h></filename>, 14994689c1Smrgare: 15994689c1Smrg</para> 16994689c1Smrg<literallayout class="monospaced"> 17994689c1Smrg.. 18994689c1Smrg<!-- .CB --> 19994689c1Smrg<!-- .\".so ../../lib/Xaw/Template.h --> 20994689c1Smrg/* Copyright (c) X Consortium 1987, 1988 */ 21994689c1Smrg 22994689c1Smrg#ifndef _Template_h 23994689c1Smrg#define _Template_h 24994689c1Smrg 25994689c1Smrg/**************************************************************** 26994689c1Smrg * 27994689c1Smrg * Template widget 28994689c1Smrg * 29994689c1Smrg ****************************************************************/ 30994689c1Smrg 31994689c1Smrg/* Resources: 32994689c1Smrg 335ec34c4cSmrg Name Class RepType Default Value 345ec34c4cSmrg ---- ----- ------- ------------- 355ec34c4cSmrg background Background Pixel XtDefaultBackground 365ec34c4cSmrg border BorderColor Pixel XtDefaultForeground 375ec34c4cSmrg borderWidth BorderWidth Dimension 1 385ec34c4cSmrg destroyCallback Callback Pointer NULL 395ec34c4cSmrg height Height Dimension 0 405ec34c4cSmrg mappedWhenManaged MappedWhenManaged Boolean True 415ec34c4cSmrg sensitive Sensitive Boolean True 425ec34c4cSmrg width Width Dimension 0 435ec34c4cSmrg x Position Position 0 445ec34c4cSmrg y Position Position 0 45994689c1Smrg 46994689c1Smrg*/ 47994689c1Smrg 48994689c1Smrg/* define any special resource names here that are not in <X11/StringDefs.h> */ 49994689c1Smrg 50994689c1Smrg#define XtNtemplateResource "templateResource" 51994689c1Smrg 52994689c1Smrg#define XtCTemplateResource "TemplateResource" 53994689c1Smrg 54994689c1Smrg/* declare specific TemplateWidget class and instance datatypes */ 55994689c1Smrg 56994689c1Smrgtypedef struct _TemplateClassRec* TemplateWidgetClass; 57994689c1Smrgtypedef struct _TemplateRec* TemplateWidget; 58994689c1Smrg 59994689c1Smrg/* declare the class constant */ 60994689c1Smrg 61994689c1Smrgextern WidgetClass templateWidgetClass; 62994689c1Smrg 63994689c1Smrg#endif /* _Template_h */ 64994689c1Smrg<!-- .CE --> 65994689c1Smrg</literallayout> 66994689c1Smrg<para> 67994689c1Smrg<!-- .LP --> 68994689c1Smrg<!-- .sp --> 69994689c1SmrgYou will notice that most of this file is documentation. The crucial 70994689c1Smrgparts are the last 8 lines where macros for any private resource names 71994689c1Smrgand classes are defined and where the widget class datatypes and class 72994689c1Smrgrecord pointer are declared. 73994689c1Smrg</para> 74994689c1Smrg<para> 75994689c1Smrg<!-- .LP --> 76994689c1SmrgFor the "WindowWidget", we want 2 drawing colors, a callback list for 77994689c1Smrguser input and an 78994689c1Smrg<function>exposeCallback</function> callback list, and we will declare three 79994689c1Smrgconvenience procedures, so we need to add 80994689c1Smrg</para> 81994689c1Smrg<literallayout class="monospaced"> 82994689c1Smrg<!-- .LP --> 83994689c1Smrg<!-- .sp --> 84994689c1Smrg<!-- .CB --> 85994689c1Smrg/* Resources: 86994689c1Smrg ... 875ec34c4cSmrg callback Callback Callback NULL 885ec34c4cSmrg drawingColor1 Color Pixel XtDefaultForeground 895ec34c4cSmrg drawingColor2 Color Pixel XtDefaultForeground 905ec34c4cSmrg exposeCallback Callback Callback NULL 915ec34c4cSmrg font Font XFontStruct* XtDefaultFont 92994689c1Smrg ... 93994689c1Smrg */ 94994689c1Smrg 95994689c1Smrg#define XtNdrawingColor1 "drawingColor1" 96994689c1Smrg#define XtNdrawingColor2 "drawingColor2" 97994689c1Smrg#define XtNexposeCallback "exposeCallback" 98994689c1Smrg 995ec34c4cSmrgextern Pixel WindowColor1( /* Widget */ ); 1005ec34c4cSmrgextern Pixel WindowColor2( /* Widget */ ); 1015ec34c4cSmrgextern Font WindowFont( /* Widget */ ); 102994689c1Smrg<!-- .CE --> 103994689c1Smrg</literallayout> 104994689c1Smrg<para> 105994689c1Smrg<!-- .LP --> 106994689c1SmrgNote that we have chosen to call the input callback list by the generic 107994689c1Smrgname, <function>callback</function>, rather than a specific name. If widgets that define 108994689c1Smrga single user-input action all choose the same resource name then there 109994689c1Smrgis greater possibility for an application to switch between widgets of 110994689c1Smrgdifferent types. 111994689c1Smrg</para> 112994689c1Smrg</sect1> 113