12.07.2015 Views

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating New <strong>Widget</strong>s(Subclassing)extern TemplateClassRec templateClassRec;typedef struct {/* resources */char* resource;/* private state */} TemplatePart;typedef struct _TemplateRec {CorePart core;TemplatePart template;} TemplateRec;#endif /* _TemplateP_h */The private header file includes the private header file of its superclass, therebyexposing the entire internal structure of the widget. It may not always be advantageousto do this; your own project development style will dictate the appropriatelevel of detail to expose in each module.The "Window<strong>Widget</strong>" needs to declare two fields in its instance structure to holdthe drawing colors, a resource field for the font and a field for the expose and userinput callback lists:typedef struct {/* resources */Pixel color_1;Pixel color_2;XFontStruct* font;XtCallbackList expose_callback;XtCallbackList input_callback;/* private state *//* (none) */} WindowPart;<strong>Widget</strong> Source FileThe source code file implements the widget class itself. The unique part of this fileis the declaration and initialization of the widget class record structure and thedeclaration of all resources and action routines added by the widget class.The contents of the Template implementation file, < X11/Xaw/Template.c >, are:/* Copyright (c) X <strong>Consortium</strong> 1987, 1988*/#include #include #include "TemplateP.h"131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!