class_initialize man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

class_initialize()					    class_initialize()

Name
  class_initialize  -  Object class method for one-time class initializa‐
  tion.

Synopsis
  typedef void (*XtProc)(void);

Description
  The class_initialize() method is  registered	on  the	 class_initialize
  field	 of  the Object, RectObj, or Core class structures, and is called
  exactly once by the Intrinsics before any instances of  the  class  are
  created.

  The  class_initialize() method takes no arguments and returns no value.
  It performs initialization that should be done once for this class  and
  all  its  subclasses, such as registering type converters and interning
  atoms and quarks.  Compare this with the class_part_initialize() method
  which	 is called once for its class and also for every subclass, and is
  responsible for initializing fields in the class part structure.

  The class_initialize() method is not chained and cannot  be  inherited.
  If  a widget class does not need any one-time initialization, it should
  specify NULL in its class_initialize field.

  The fact that this method is not chained means that when a given widget
  class,  C,  is initialized, only the class_initialize() method for that
  class is called--the methods for the	superclasses  B	 and  A	 are  not
  called  during  the  initialization  of  C.	If the class_initialize()
  method were chained, then the	 method	 for  widget  class  A	would  be
  invoked  whenever  a subclass, such as B or C, were initialized.  Since
  the method is intended for one-time global initializations, this  would
  be  inappropriate.  Although this method is not chained, the Intrinsics
  ensure that the superclasses of a class will be initialized before  the
  class	 itself.  So, in fact, the class_initialize() methods for classes
  A and B are guaranteed to have been called  before  the  class_initial‐
  ize() method for C is called.

  See  the  "Background"  section below for more information on when this
  method is called.

Usage
  The class_initialize() performs one-time,  global  initializations  for
  the  class.	It  should  not initialize the fields of the class struc‐
  ture--that is the job of the class_part_initialize() method, which is a
  chained  method,  and	 is  invoked for class and all of its subclasses.
  class_initialize() and class_part_initialize()  perform  initialization
  of  the  widget  class.  It is the initialize() method that initializes
  the instance structure of the widget--it is invoked whenever	a  widget
  instance is created.

Example
  The  following  procedure  is	 the class_initialize() method of the Xaw
  Form widget.	Note that  it  registers  two  resource	 converters,  and
  interns  quarks (in global variables) for use by the String-to-EdgeType
  converter.

     static void ClassInitialize()
     {
	 static XtConvertArgRec parentCvtArgs[] = {
	     {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent),
		  sizeof(Widget)}
	 };
	 XawInitializeWidgetSet();
	 XtQChainLeft	= XrmPermStringToQuark("chainleft");
	 XtQChainRight	= XrmPermStringToQuark("chainright");
	 XtQChainTop	= XrmPermStringToQuark("chaintop");
	 XtQChainBottom = XrmPermStringToQuark("chainbottom");
	 XtQRubber	= XrmPermStringToQuark("rubber");

	 XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, NULL, 0 );
	 XtSetTypeConverter (XtRString, XtRWidget, XmuNewCvtStringToWidget,
			     parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone,
			     NULL);
     }

Background
  All widget classes, whether they have a  class_initialize()  method  or
  not, 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 process can also be performed explicitly, without creat‐
  ing a widget, by calling XtInitializeWidgetClass().

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

Xt - Intrinsics Methods					    class_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