CK_Object
|
+----CK_Component
|
+----CK_Primitive
|
+----CK_ScrollHandle
The CK_ScrollHandle class represents a scroll bar. It is the scroll handle, as well as the channel along which the handle can move. The CK_ScrollHandle automatically responds to left mouse button clicks & drags. The mouse events are still sent to the CK_Screen's componentCB() method, allowing the application to respond to movement of the scroll bar.
The CP_Bitmap property specifies the bitmap that will represent the scroll handle. The scroll channel is transparent, but the CK_ScrollHandle can be the child of a manager component such as a CK_Frame, allowing the frame to provide the bitmap for the channel.
The scroll bar can be vertical or horizontal, and this is determined by the CP_LayoutDirection property. If the scroll bar is horizontal, the height of the channel is automatically set to the height of the handle bitmap. In this case, the CP_Width should be explicitly set, and it represents the width of the channel. If the scroll bar is vertical, the width of the channel is automatically set to the width of the handle bitmap. In this case, the CP_Height should be explicitly set, and it represents the height of the channel.
For horizontal scroll bars, the CP_Width represents the physical length, in pixels, of the channel. The channel can be given a logical length by setting the CP_ChannelLength property. The current position of the handle can be retrieved in logical units. The CP_HandlePosition property holds the current handle position. The handle position can range from 0 to (CP_ChannelLength - 1). If the scroll handle is at the top (or left) end of the channel, the CP_HandlePosition property will have the value 0. If the scroll handle is at the bottom (or right) end of the channel, the logical handle position is (CP_ChannelLength - 1).
Setting the CP_HandlePosition property will cause the scroll handle to move to that position.
Properties
Examples of creating a scroll handle:
extern CK_Bitmap *handle; extern CK_Frame *frame; CK_ScrollHandle *sHandle1 = (CK_ScrollHandle *) CreateComponent(CT_ScrollHandle, frame, CP_Bitmap, handle, CP_LayoutDirection, CV_LayoutVertical, CP_Height, 200, CP_ChannelLength, 1000, 0); CK_ScrollHandle *sHandle2 = (CK_ScrollHandle *) CreateComponent(CT_ScrollHandle, frame, CP_Bitmap, handle, CP_LayoutDirection, CV_LayoutHorizontal, CP_Width, 200, CP_ChannelLength, 1000, 0);