class_part_initialize man page on HP-UX

Printed from http://www.polarhome.com/service/man/?qf=class_part_initialize&af=0&tf=2&of=HP-UX

class_part_initialize()				       class_part_initialize()

Name
  class_part_initialize	 -  Object  class method to initialize class part
  structure fields.

Synopsis
  typedef void (*XtWidgetClassProc)(WidgetClass);
	 WidgetClass subclass;

Inputs
  subclass  Specifies the pointer to a widget class structure.	It is the
	    class that registered this method or a subclass thereof.

Description
  The class_part_initialize() method is registered on the class_part_ini‐
  tialize field of the Object, RectObj, or Core class structure,  and  is
  called to dynamically initialize any fields in the class part structure
  of its widget class.

  During class initialization, the class_part_initialize() method for the
  class	 and for all its superclasses is called in superclass-to-subclass
  order on the class record.  These procedures do any dynamic initializa‐
  tions	 necessary to their class's part of the record, including resolu‐
  tion of any inherited methods defined in the class.  For example, if	a
  widget  class	 C  has	 superclasses Core, Composite, A, and B, then the
  class record for C is passed first  to  Core's  class_part_initialize()
  method.  This resolves any inherited Core methods and compiles the tex‐
  tual representations of the resource list and	 action	 table	that  are
  defined  in the Core class part.  Next, the Composite's class_part_ini‐
  tialize() is called to initialize  the  Composite  part  of  C's  class
  record.   Finally, the class_part_initialize() procedures for A, B, and
  C (in order) are called.  All these methods will  be	called	again  if
  subclass D of class C is initialized, this time to initialize the vari‐
  ous parts of D's class structure.

  The class_part_initialize() method is chained in superclass-to-subclass
  order	 and  cannot  be  inherited.   Classes that do not define any new
  class fields or that need no extra processing for them  can  set  their
  class_part_initialize field to be NULL.

  See  the "Background" section below for more details on when class ini‐
  tialization is performed.

Usage
  The subclass argument to a class_part_initialize() procedure may be the
  widget  class	 itself,  or any subclass of it.  You should cast it to a
  pointer to your widget class and use that pointer to access the  fields
  of  the  class  part structure that your class defines.  If you need to
  access the superclass, use the superclass field in the Object, RectObj,
  or Core class part.  This is shown in the example below.

  The  most common usage of the class_part_initialize() method is to han‐
  dle inheritance of class methods and other fields.   If  you	define	a
  class	 with  a  method or other field that can be inherited, you should
  define a special value that the writer  of  the  subclass  can  use  to
  inherit  the field (use the constant _XtInherit cast to the appropriate
  type, as shown in the example below) and provide a  class_part_initial‐
  ize()	 method which checks the inheritable field for this special value
  and overwrites it with the contents of the superclass's field.

Example
  The following procedure is the class_part_initialize() method	 for  the
  Xaw Form widget class.  Note how it determines the immediate superclass
  and handles the inheritance of the Form layout() class method.

  Note that it does not initialize the	Core,  Composite,  or  Constraint
  class	 part  fields, nor does it make any assumptions about its Widget‐
  Class argument except that it is a subclass of Form.	 Also  note  that
  when	this method is called for the Form widget class itself, the vari‐
  able super will be set to the superclass of  Form,  which  cannot  cor‐
  rectly be cast to FormWidgetClass.  This is a bug, but will never cause
  problems, because the Form class itself will never have to inherit  any
  fields.

  Note that the identifier class is a reserved word in C++, and your code
  will be more portable if you avoid using it as an argument  name  in	C
  code.

     static void ClassPartInitialize(class)
	 WidgetClass class;
     {
	 register FormWidgetClass c = (FormWidgetClass)class;
	 register FormWidgetClass super = (FormWidgetClass)
	     c->core_class.superclass;

	 if (c->form_class.layout == XtInheritLayout)
	     c->form_class.layout = super->form_class.layout;
     }

  The	 constant    XtInheritLayout	is   defined   as   follows   (in
  <X11/Xaw/FormP.h>):

     #define XtInheritLayout ((Boolean (*)())_XtInherit)

Background
  All widget classes, whether or not they have class and class part  ini‐
  tialization procedures, must start with their class_inited field False.

  The first time a widget of a class is created, XtCreateWidget() ensures
  that the widget class and all superclasses are initialized,  in  super‐
  class-to-subclass  order, by checking each class_inited field.  If this
  field is False, XtCreateWidget() calls the class_initialize()	 and  the
  class_part_initialize() methods for the class and all its superclasses.
  The Intrinsics then set the class_inited  field  to  a  nonzero  value.
  After the one-time initialization, a class structure is constant.  This
  initialization can also be performed	explicitly,  without  creating	a
  widget, by calling XtInitializeWidgetClass().

See Also
  XtInitializeWidgetClass(1),
  Core(3),
  class_initialize(4), initialize(4).

Xt - Intrinsics Methods				       class_part_initialize()
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net