Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xtinitializewidgetclass(3) [x11r4 man page]

XtInitializeWidgetClass(3)					   XT FUNCTIONS 					XtInitializeWidgetClass(3)

NAME
XtInitializeWidgetClass - initialize a widget class SYNTAX
void XtInitializeWidgetClass(WidgetClass object_class); ARGUMENTS
object_class Specifies the object class to initialize. DESCRIPTION
If the specified widget class is already initialized, XtInitializeWidgetClass returns immediately. If the class initialization procedure registers type converters, these type converters are not available until the first object of the class or subclass is created or XtInitializeWidgetClass is called. SEE ALSO
X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.0.5 XtInitializeWidgetClass(3)

Check Out this Related Man Page

class_initialize()														class_initialize()

Name
  class_initialize - Object class method for one-time class initialization.

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  struc-
  ture.

  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_initialize() 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
  superclass-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 creating a widget, by calling XtInitializeWidgetClass().

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

Xt - Intrinsics Methods 													class_initialize()
Man Page