Product Home Class IndexDownload

CK_Component

CK_Object
   |
   +----CK_Component

Components are visual elements used to build user interfaces in applications that incorporate custom artwork, such as game programs or children's educational programs. All components are rectangular in shape. (Transparency can be used to make it appear as though a component is not rectangular.) The CK_Component is the base class for all components.

A component can be a primitive component or a manager component. Manager components have child components and are responsible for the layout of the child components. Examples of manager components are bulletin boards (CK_BBoard) and row-columns (CK_RowColumn). Primitive components have no children. Examples of primitive components are labels and buttons (CK_Label), or viewports (CK_Viewport).

All components have properties. Some properties are common to all components, such as width and height. Other properties are specific to particular components, or shared by a number of components. The value of any property can be obtained by calling the overloaded getProp() function. Properties can be set by calling the overloaded setProp() function. Some properties are automatically set by the component, such as the width and height property for row-column components. In this case, the width and height are automatically determined by the components that are the children of the row-column.

When a property is modified by calling setProp(), the modification will be automatically be updated to the screen. If multiple properties are modified, all the updates to the component will occur simultaneously. Component updates are made visible in the next iteration of the CK_ddEngine's mainLoop().

If a component's size is changed by modifying a property, the Chilkat engine (CK_ddEngine) will automatically resize all other affected components, and the changes will automatically be visible on the screen in the next iteration of the CK_ddEngine's mainLoop().

When a component is drawn, the CK_ddEngine will clip to the component's boundaries. If a CK_Label has text, the text will be guaranteed to not extend beyond the boundaries of the label component. As another example, bulletin board components have a fixed width and height, regardless of the child components and where they are positioned. Because of clipping, none of the bulletin board's child components can extend beyond the boundaries.

All CK_Component objects are created by the CreateComponent() global function.


Public Methods

getProp(int property, int *)
Gets the value of an integer type property.
getProp(int property, const CK_Bitmap **)
Gets a const pointer to a bitmap for bitmap typed properties.
getProp(int property, const CK_Font **)
Gets a const pointer to a font for font typed properties.
getProp(int property, CK_Movie **)
Gets a pointer to a component's movie object.
getProp(int property, const char **)
Gets a const pointer to a character string for string typed properties.
getProp(int property, RGBQUAD *)
Gets an RGBQUAD for properties that are colors.
getProp(int property, CK_Render **)
Gets a pointer to a CK_Render object for render callback properties.
getProp(int property, CK_Cursor **) (v1.02)
Gets a pointer to a CK_Cursor object for cursor properties.
getProp(int property, CK_Rect *) (v1.02)
Gets a CK_Rect for rectangle properties.
setDirty
Forces the component to be redrawn.
setProp(int property, int)
Sets the value of an integer typed property.
setProp(int property, const CK_Bitmap *)
Sets the value of a bitmap typed property.
setProp(int property, const CK_Font *)
Sets the value of a font typed property.
setProp(int propery, CK_Movie *)
Sets the value of a component's movie. 
setProp(int property, const char *)
Sets the value of a string typed property.
setProp(int property, const RGBQUAD *)
Sets the value of an RGBQUAD typed property.
setProp(int property, CK_Render *)
Sets the value of a render callback typed property.
setProp(int property, CK_Cursor *) (v1.02)
Sets the value of a cursor property.
setProp(int property, CK_Rect *) (v1.02)
Sets the value of a rectangle property.
setResized
Indicates to the engine that the property was resized.

Gets the value of an integer typed property. The following properties are integers: CP_AdjustmentType, CP_AdjustmentVal, CP_BitmapX, CP_BitmapY, CP_BlinkDelay, CP_BorderX, CP_BorderY, CP_CallbackArg1, CP_CallbackArg2, CP_ChannelLength, CP_ComponentSpacing, CP_HandlePosition, CP_Height, CP_HorizontalAlign, CP_LayoutDirection, CP_PaletteIndex, CP_RelativeX, CP_RelativeY, CP_TiledBitmap, CP_VerticalAlign, CP_Width, CP_X, CP_Y, CP_ZOrder.

Parameters

property
The property whose value is retrieved.
value
Pointer to an integer that will be set to the property's value.

Gets the value of a bitmap typed property. The following properties are bitmaps: CP_Bitmap, CP_Caret.

Parameters

property
The property whose value is retrieved.
bitmap
Will receive a const pointer to the bitmap.

Gets the value of a font typed property. The following properties are fonts: CP_Font.

Parameters

property
The property whose value is retrieved.
value
Will receive a const pointer to the font.

Gets the value of a movie property (CP_Movie).

Parameters

property
The property whose value is retrieved.
movie
Will receive a pointer to the movie.

Gets the value of a string typed property. The following properties are strings: CP_Text.

Parameters

property
The property whose value is retrieved.
string
Will receive a const pointer to the string.

Gets the value of an RGBQUAD typed property. The following properties are RGBQUAD: CP_BgColor, CP_FgColor.

Parameters

property
The property whose value is retrieved.
color
Pointer to an RGBQUAD to be filled with the property's value.

Gets the value of a render callback typed property. The following properties are CK_Render objects: CP_Render.

Parameters

property
The property whose value is retrieved.
renderCB
Will receive a pointer to a CK_Render callback object.

Gets the value of a cursor property. The following properties are CK_Cursor objects: CP_Cursor.

Parameters

property
The property whose value is retrieved.
cursor
Will receive a pointer to a CK_Cursor object.

Gets the value of a rectangle property. The following properties are CK_Rect objects: CP_BitmapRect.

Parameters

property
The property whose value is retrieved.
rect
The contents of this structure will be filled.

Marks the component as dirty and needing to be redrawn. This shouldn't need to be called by the application, as modifying properties will automatically cause the component to be marked as dirty.

Sets the value of an integer typed property. The following properties are integers: CP_AdjustmentType, CP_AdjustmentVal, CP_BitmapX, CP_BitmapY, CP_BlinkDelay, CP_BorderX, CP_BorderY, CP_CallbackArg1, CP_CallbackArg2, CP_ChannelLength, CP_ComponentSpacing, CP_HandlePosition, CP_Height, CP_HorizontalAlign, CP_LayoutDirection, CP_PaletteIndex, CP_RelativeX, CP_RelativeY, CP_TiledBitmap, CP_VerticalAlign, CP_Width, CP_X, CP_Y, CP_ZOrder.

Parameters

property
The property whose value is set.
value
The new value of the property.

Sets the value of a bitmap typed property. A component will observe it's bitmap, so any change in the bitmap will automatically be visibly updated in the component. The following properties are bitmaps: CP_Bitmap, CP_Caret.

Parameters

property
The property whose value is set.
bitmap
The new value of the property.

Sets the value of a font typed property. The following properties are fonts: CP_Font.

Parameters

property
The property whose value is set.
font
The new value of the property.

Sets the value of the CP_Movie property.  Currently, only CK_Label components can display a movie.

Parameters

property
The property whose value is set.
movie
The new value of the property.

Sets the value of a string typed property. The following properties are strings: CP_Text.

Parameters

property
The property whose value is set.
string
The new value of the property.

Sets the value of an RGBQUAD typed property. The following properties are RGBQUAD: CP_BgColor, CP_FgColor.

Parameters

property
The property whose value is set.
color
The new value of the property.

Sets the value of a render callback typed property. The following properties are CK_Render objects: CP_Render.

Parameters

property
The property whose value is set.
renderCB
The new value of the property.

Sets the value of a cursor  property. The following properties are CK_Cursor objects: CP_Cursor.

Parameters

property
The property whose value is set.
cursor
The new value of the property.

Sets the value of a rectangle  property. The following properties are CK_Rect objects: CP_BitmapRect.

Parameters

property
The property whose value is set.
rect
The new value of the property.

Marks the component as needing to be resized. This shouldn't need to be called by the application, as modifying properties affecting it's size and/or position will automatically cause the component to be marked as resized.