Developer

API Reference

AEECLSID_ScaleWidget

Brew Release
Brew MP 1.0.2
See Also
-Model Events
-Border Widget Class
-IWidget_SetExtent()
-IWidget_SetProperty()
-IWidget_SetModel()
-IWidget_SetTransparency()
-ISHELL_CreateInstance()
Description
The scale widget is derived from the decorator object and is used to scale a child widget before it is drawn into the display. Certain widgets support scaling e.g. one can apply scale to Image within ImageWidget. ScaleWidget takes that a step further and it can apply scaling to any child widget it is holding.
A scale widget is created by calling ISHELL_CreateInstance() and passing AEECLSID_ScaleWidget as the class id. If successful, a pointer to the scale widget object will be returned in the 'ppobj' parameter of ISHELL_CreateInstance().
Applications may control the values by which the underlying widget will be scaled by setting the PROP_SCALEDWIDTH and PROP_SCALEDHEIGHT properties. The scale widget can be used to either blow up or shrink the child widget.

To create a scale widget, an application would do the following:
       1. Call ISHELL_CreateInstance() with a class ID of AEECLSID_ScaleWidget to
          retrieve a reference counted instance of the scale widget.
       2. Create and set the child widget. Typically some extent would be
          set on the child widget. 
       3. Set the properties on scale widget PROP_SCALEDWIDTH and PROP_SCALEDHEIGHT. 


The child widget will be scaled from its own extent to SCALEDWIDTH and SCALEDHEIGHT values provided to ScaleWidget.

Supported Events: The scale widget handles events to get or set the properties that will control how the scaling will be applied to widget it decorates. Events not identified below will be routed to the base decorator widget from which the scale widget is derived.
Event                 Description
-----                 ------------------------------------------------------------
EVT_WDG_SETPROPERTY:  The scale widget responds to this event by attempting to set the
                      property identified by the 'wParam' parameter.  The scale widget
                      allows the following properties to be set.
                      
                           PROP_SCALEDWIDTH    --   Sets the size in pixels in x direction
                                               (width) to which the child should be scaled.
                           PROP_SCALEDHEIGHT    --   Sets the size in pixels in y direction
                                               (height) to which the child should be scaled.
                           PROP_FLAGS     --   Sets the flags of the widget.

                      These properties are discussed below in greater detail.

                      The scale widget will route the EVT_WDG_SETPROPERTY event to the
                      base decorator widget if 'wParam' identifies a property that does
                      not appear in the list above.

EVT_WDG_GETPROPERTY:  The scale widget responds to this event by attempting to retrieve
                      the property identified by the 'wParam' parameter.  The scale widget
                      allows the following properties to be retrieved.
                      
                           PROP_SCALEDWIDTH    --   Gets the size in pixels in x direction
                                               (width) to which the child should be scaled.
                           PROP_SCALEDHEIGHT    --   Gets the size in pixels in y direction
                                               (height) to which the child should be scaled.
                           PROP_FLAGS     --   Gets the flags of the widget.
                          
                      These properties are discussed below in greater detail.

                      The scale widget will route the EVT_WDG_GETPROPERTY event to the
                      base decorator widget if 'wParam' identifies a property that does
                      not appear in the list above.


Properties:
Property             Description
--------             ------------------------------------------------------------
PROP_SCALEDWIDTH :        This property controls the width to which the underlying widget will
                     be scaled.  A value of 0 would make child widget invisible. A value less
                     than the child widget's extent width will make child widget shrink in width 
                     while value greater than the child widget's extent width will make it zoomed.
                     If a negative value is set for PROP_SCALEDWIDTH, child widget's extent will be
                     scaled to fit the decorator's own extent width.

PROP_SCALEDHEIGHT :        This property controls the height to which the underlying widget will
                     be scaled.  A value of 0 would make child widget invisible. A value less
                     than the child widget's extent height will make child widget shrink in height 
                     while value greater than the child widget's extent height will make it zoomed.
                     If a negative value is set for PROP_SCALEDHEIGHT, child widget's extent will be
                     scaled to fit the decorator's own extent height.

PROP_FLAGS :         This property controls flags of the Scale Widget. Scalewidget supports 
                     following flags.
                           
                     SWF_AUTOSIZEWIDTH
                     -------------
                     When this flag is set, the scale widget will ignore PROP_SCALEDWIDTH and 
                     automatically scale the child widget's width to the width of the 
                     scale widget.

                     SWF_AUTOSIZEHEIGHT
                     -------------
                     When this flag is set, the scale widget will ignore PROP_SCALEDHEIGHT and 
                     automatically scale the child widget's height to the height of the 
                     scale widget.

                     SWF_KEEPASPECTRATIO
                     -------------
                     This flag is used in conjuction with the SWF_AUTOSIZEWIDTH and 
                     SWF_AUTOSIZEHEIGHT flags. When this flag is set, instead of autosizing
                     to the match the scale widget's extent it will autosize to preserve
                     the original aspect ratio. For example, let's say the child widget
                     has a square extent of 20 by 20. Then we set the SWF_AUTOSIZEHEIGHT
                     flag. If we set the PROP_SCALEDWIDTH to 200, PROP_SCALEHEIGHT 
                     will be ignored and the rendered height will automatically be scaled 
                     to 200 to keep the aspect ratio.

                     If all three flags SWF_AUTOSIZEWIDTH, SWF_AUTOSIZEHEIGHT and
                     SWF_KEEPASPECTRATIO are set, then the child widget will
                     be automatically scaled to fit the scalewidget's extent, keeping
                     the aspect ratio. This will mean the child will be scaled
                     to the largest posible size that can fit in the scalewidget
                     without altering the aspect ratio.


Required Model: None
Instantiaion
Scale Widget is instantiated by passing AEECLSID_ScaleWidget into ISHELL_CreateInstance.
Cleanup
The Scale Widget is reference counted. When you are done with your reference to the Scale widget, you should Release that reference. Any widget specific cleanup will be handled for you when all references have been released.
Default Interface Name
Other Interfaces
Side Effect
None
Comment
The scale widget accepts and handles the following events:
       EVT_WDG_SETPROPERTY
       EVT_WDG_GETPROPERTY


  • Follow