Scale.doc   [plain text]



Scale Widget

Header file 		Scale.h
Class			scaleWidgetClass
Class Name		Scale
Superclass		Simple

The Scale widget is an immutable image displayed within a rectangular
region of the screen.  When the widget is selected, it is highlighted, 
and an application callback routine is invoked.  When the
widget is resized the image can be autoscaled to fit new size of the 
widget window.  The widget can also cut and paste its contents.

When creating a Scale widget instance, the following resources are
retreived from the argument list or from the resource database:

All the Simple Widget resources plus...
-------------------------------------------------------------------------------
 Name                Cass               Type            Default Value
-------------------------------------------------------------------------------
 aspectRatio         AspectRatio        Float           1.0
 autoscale           Autoscale          Boolean         True
 bufferSize          BufferSize         Cardinal        1024
 foreground          Foreground         Pixel           XtDefaultForeground
 gravity             Gravity            XtGravity       ForgetGravity
 image               Image              XImage*         NULL
 internalHeight      Height             Dimension       2
 internalWidth       Width              Dimension       2
 pasteBuffer         PasteBuffer        Boolean         False
 precision           Precision          Float           0.001
 proportional        Proportional       Boolean         True
 resize              Resize             Boolean         True
 scaleX              ScaleFactor        Float           DefaultScaleValue
 scaleY              ScaleFactor        Float           DefaultScaleValue
 exponent            Exponent           integer         -3
-------------------------------------------------------------------------------

 aspectRatio	This resource specifies the aspect ratio of the scaled image
		in the x / y * aspectRatio = 1 form.  It is effective within
		the precision resource only if proportional resource is set 
		to true.  AspectRatio resource can be any positive number 
		greater than zero.

 autoscale	If this resource is set to True then the image will be
		autoscaled to fit the window size within internal width
		and internal height resource values.  If the resource is
		False, the widget will only reposition the image
		according to the gravity resource value.

 bufferSize	This resource specifies the buffer size in XRectangle's for
		buffering the XFillRectangle calls.  It is effective only 
		for XYBitmap image type.

 background	This resource has the same meaning as for the Simple widget.
		However, it is worth mentioning that if the most frequent
		pixel value in the XYPixmap or ZPixmap image is specified
		as backgroud, the scaling process can be speeded up noticably.

 foreground	The color used to paint the image if in XYBitmap format.
		If the image is XYPixmap or ZPixmap format, the foreground
		resource has no effect.

 gravity	This resource will determine where to put the image if it does 
		not fit the window size minus internal width and height.
		The widget will try to preserve gravity rather than internal
		width and height resources.

 image		This is the image to be displayed in the widget window.
		If no image is desired, the NULL value can be passed.  
		The passed image is copied and set to the resource value.
		Applications should destroy the passed image argument
		if they do not intend to use it at some later time.

 internalHeight	
 internalWidth	These resources specify the minimum distance from the boarder 
		of the widget window to be maintanied when manipulating the 
		image.  If image is too big or small to satisfy given 
		conditions, the	widget will position the image to preserve 
		gravity rather than internalWidth or internalHeight.

 pasteBuffer	If this resource is true then the widget owns the paste
		selection buffer.  This resource can only be queried.

 precision	This resource specifies the precision of the scale factors
		when scaling the image.  The precision resource can be any 
		positive number greater than zero. (For example, if precision
		is 1.0 then the image will be scaled only by integer values.)

 proportional	If this resource is set to true it will make sure that the 
                image proportions, as specified by aspectRatio resource,
                are being kept whenever it is scaled.  
		
 resize		If this resource is true the widget will try to resize when
		addopting a new image thus preserveing the scale values.
		If it is false the scale values will not be preserved unless
		the image can fit in the current window size with the same
		scale values.

 scaleX
 scaleY		These resources specify the scaling values for the widget
		image.  They will be floored to satisfy precision resource
		values.  If uniform resource is true the scale values will
		be only integers.  These resources can be any positive number
		greater than zero.

 shiftFactor	...