Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: eikscrlb.h
Link against: eikcoctl.lib

Class CEikScrollBar

CEikScrollBar

Support

Supported from 6.0

Description

A scroll bar. Scroll bars are used when all the content of another control cannot be seen at the same time. They may be oriented horizontally or vertically, and may be displayed in several ways.

Scroll bars represent integers, and have a maximum, a minimum, and a current position encapsulated within their model. The on-screen image of a scroll bar is calculated and displayed by the CEikScrollBar object, and user changes to the scroll bar (and hence its model) are reported to an interested class through the MEikScrollBarObserver interface.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CCoeControlControl base class from which all other controls are derived
CEikBorderedControlA control which is drawn surrounded by a rectangular border
CEikScrollBarA scroll bar
MCoeControlObserverInterface for a control to send events to another control, its observer

Defined in CEikScrollBar:
ActivateL(), CEikScrollBar(), ComponentControl(), ConstructL(), CountComponentControls(), DefaultScrollBarBreadth(), DoSetLengthL(), Draw(), EAll, EButtonsAtEndOfShaft, EButtonsAtStartOfShaft, EButtonsEitherSideOfShaft, EDecreaseButtonsDimmed, EDecreaseNudgeButton, EDecreaseOnly, EDecreasePageButton, EDecreaseShaft, EEikScrollBarHasHomeEndButtons, EEikScrollBarHasPageButtons, EEikScrollBarNoNudgeButtons, EEikScrollBarNoShaftOrThumb, EEikScrollBarShaftButNoThumb, EEndButton, EHomeButton, EHorizontal, EIncreaseButtonsDimmed, EIncreaseNudgeButton, EIncreaseOnly, EIncreasePageButton, EIncreaseShaft, ENoAutoDimming, ENoComponentsToDisplay, ENoRedrawRequired, ENone, ERedrawShaft, EThumb, EVertical, GetColorUseListL(), HandlePointerEventL(), HandleResourceChange(), MinVisibleLength(), Model(), NumberOfButtonPairs(), SEikScrollBarButtons, ScrollBarBreadth(), SetAllButtonsDimmed(), SetButtonPositionL(), SetDecreaseButtonsDimmed(), SetDimmed(), SetIncreaseButtonsDimmed(), SetLayoutL(), SetLengthAndModelL(), SetLengthL(), SetModelL(), SetModelThumbPosition(), SetScrollBarObserver(), TEikScrollBarFlags, TOrientation, TPointerDownOn, TPrivateScrollBarFlags, TShaftRedrawRequired, TWhichButtons, ThumbPosition(), iButtons, iDecreaseButtonsEnd, iDecreaseButtonsStart, iIncreaseButtonsEnd, iIncreaseButtonsStart, iLength, iOrientation, iPointerDownOn, iScrollBarDisplayFlags, iScrollBarFlags, iScrollBarObserver, ~CEikScrollBar()

Inherited from CBase:
operator new()

Inherited from CCoeControl:
ActivateGc(), BackedUpWindow(), CapturesPointer(), ClaimPointerGrab(), CloseWindow(), ConstructFromResourceL(), ControlContext(), ControlEnv(), CopyControlContextFrom(), CreateBackedUpWindowL(), CreateWindowL(), DeactivateGc(), DrawDeferred(), DrawNow(), DrawableWindow(), EnableDragEvents(), FocusChanged(), GetColor(), GetHelpContext(), GrabbingComponent(), HandleComponentControlsResourceChange(), HandlePointerBufferReadyL(), HandleRedrawEvent(), IgnoreEventsUntilNextPointerUp(), Index(), InputCapabilities(), IsActivated(), IsBackedUp(), IsBeingDestroyed(), IsBlank(), IsDimmed(), IsFocused(), IsNonFocusing(), IsReadyToDraw(), IsVisible(), MakeVisible(), MinimumSize(), Observer(), OfferKeyEventL(), OverrideColorL(), OwnsWindow(), Position(), PositionChanged(), PositionRelativeToScreen(), PrepareForFocusGainL(), PrepareForFocusLossL(), Rect(), RecursivelyMergedInputCapabilities(), ReportEventL(), ResetGc(), SetAllowStrayPointers(), SetBlank(), SetCanDrawOutsideRect(), SetComponentsToInheritVisibility(), SetContainerWindow(), SetContainerWindowL(), SetControlContext(), SetCornerAndSize(), SetCornerAndSizeL(), SetExtent(), SetExtentL(), SetExtentToWholeScreen(), SetExtentToWholeScreenL(), SetFocus(), SetFocusing(), SetGloballyCapturing(), SetNeighbor(), SetNonFocusing(), SetObserver(), SetPointerCapture(), SetPosition(), SetRect(), SetRectL(), SetSize(), SetSizeL(), SetSizeWithoutNotification(), SetSizeWithoutNotificationL(), Size(), SizeChanged(), SizeChangedL(), SystemGc(), Window()

Inherited from CEikBorderedControl:
Border(), HasBorder(), SetAdjacent(), SetBorder(), iBorder

Inherited from MCoeControlObserver:
EEventInteractionRefused, EEventPrepareFocusTransition, EEventRequestCancel, EEventRequestExit, EEventRequestFocus, EEventStateChanged, HandleControlEventL(), TCoeEvent


Construction and destruction


CEikScrollBar()

CEikScrollBar();

Description

Allocates memory for a CEikScrollBar, but does not initialise its fields.


ConstructL()

void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags);

Description

Completes the construction of the scroll bar.

Parameters

MEikScrollBarObserver* aScrollBarObserver

The scroll bar observer which is to be informed of scroll events by this scroll bar.

const CCoeControl* aParent

Parent control for this new scroll bar.

TOrientation aOrientation

Orientation of the new scroll bar.

TInt aLength

Length of the scroll bar.

TInt aScrollBarFlags

An OR-ed combination of TEikScrollbarFlags.

See also:


~CEikScrollBar()

~CEikScrollBar();

Description

Frees memory allocated during this object’s construction, and any resources it owns.

[Top]


Static functions


MinVisibleLength()

static TInt MinVisibleLength(const TInt aScrollBarFlags);

Description

Calculates the minimum length in which scrollbar can be drawn. Note that this does not mean that all scroll bar components will be drawn.

Parameters

const TInt aScrollBarFlags

Flags describing a scroll bar.

Return value

TInt

Minimum visible width of the described scroll bar.

[Top]


Setting state


SetLengthL()

void SetLengthL(TInt aLength);

Description

Changes the scroll bar’s on-screen length and redraws it.

Parameters

TInt aLength

New length of the scroll bar in pixels.


SetModelThumbPosition()

void SetModelThumbPosition(TInt aThumbPos);

Description

Changes the position within the model, and updates the on-screen image of the thumb within the scroll bar.

Parameters

TInt aThumbPos

New position for the thumb within the model.


SetLengthAndModelL()

void SetLengthAndModelL(TInt aLength, const TEikScrollBarModel* aModel);

Description

Change the length and model at once to avoid a double update of the scroll bar.

Parameters

TInt aLength

New length.

const TEikScrollBarModel* aModel

New scroll bar model.


SetModelL()

void SetModelL(const TEikScrollBarModel* aModel);

Description

Changes the model used by this scroll bar. The thumb will be updated.

Parameters

const TEikScrollBarModel* aModel

The new model to use.


SetScrollBarObserver()

void SetScrollBarObserver(MEikScrollBarObserver* aScrollBarObserver);

Description

Sets the scroll bar observer.

Parameters

MEikScrollBarObserver* aScrollBarObserver

The scroll bar observer.

[Top]


Information retrieval


ThumbPosition()

TInt ThumbPosition() const;

Description

Gets the position within the scroll bar model. This function would normally be called by an MEikScrollBarObserver implementation in response to a scroll bar event.

Return value

TInt

Current position within the scroll bar model’s range.


ScrollBarBreadth()

TInt ScrollBarBreadth() const;

Description

Gets the height of a horizontal scrollbar or width of a vertical scrollbar.

Return value

TInt

Scroll bar breadth.


Model()

const TEikScrollBarModel* Model() const;

Description

Gets the scroll bar model used by this scroll bar.

Return value

TEikScrollBarModel*

The scroll bar model.


DefaultScrollBarBreadth()

TInt DefaultScrollBarBreadth();

Description

Gets the default breadth of the scroll bar, which is the height of horizontal scroll bar or the width of a vertical scroll bar.

Return value

TInt

Default scroll bar breadth.


GetColorUseListL()

virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;

Description

Gets the list of logical colors employed in the drawing of the control, paired with an explanation of how they are used. Appends the list to aColorUseList.

Parameters

CArrayFix<TCoeColorUse>& aColorUseList

List of logical colors.

[Top]


Button dimming


SetDecreaseButtonsDimmed()

void SetDecreaseButtonsDimmed(TBool aDimmed);

Description

Sets the decrease buttons’ dim state. Dimming, or greying out, indicates user input is not accepted.

Parameters

TBool aDimmed

ETrue to dim the decrease buttons. EFalse to undim the decrease buttons.


SetIncreaseButtonsDimmed()

void SetIncreaseButtonsDimmed(TBool aDimmed);

Description

Sets the increase buttons’ dim state. Dimming, or greying out, indicates user input is not accepted.

Parameters

TBool aDimmed

ETrue to dim the increase buttons. EFalse to undim the increase buttons.


SetAllButtonsDimmed()

void SetAllButtonsDimmed(TBool aDimmed);

Description

Sets all buttons’ dim state. Dimming, or greying out, indicates user input is not accepted.

Parameters

TBool aDimmed

ETrue to dim all buttons. EFalse to undim all buttons.

[Top]


Control implementation

Description

The following member functions provide appropriate implementations of functions declared virtual in CCoeControl.


HandlePointerEventL()

virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);

Description

Called by the framework to handle pointer events.

Parameters

const TPointerEvent& aPointerEvent

A pointer event.


Draw()

virtual void Draw(const TRect& aRect) const;

Description

Draws the entire scroll bar.

Parameters

const TRect& aRect

The area to be redrawn.


ActivateL()

virtual void ActivateL();

Description

Sets the scrollbar as ready to be drawn.

See also:


SetDimmed()

virtual void SetDimmed(TBool aDimmed);

Description

Sets the dimmed state of the scroll bar, but does not redraw it.

Parameters

TBool aDimmed

ETrue to dim the scroll bar. EFalse to undim the scroll bar.

[Top]


Handle resource changes


HandleResourceChange()

virtual void HandleResourceChange(TInt aType);

Description

Handles a change to the control's resources which are shared across the environment. Colours or fonts for example.

Parameters

TInt aType

The ID of the resource type that has changed.

[Top]


Other protected functions


CountComponentControls()

TInt CountComponentControls() const;

Description

Gets the number of controls contained in this scrollbar.

Return value

TInt

The number of component controls contained by this scrollbar.


ComponentControl()

CCoeControl* ComponentControl(TInt aIndex) const;

Description

Gets the specified scrollbar component. Each component control is identified by an index, where the index depends on the order the controls were added: the first is given an index of 0, the next an index of 1.

Parameters

TInt aIndex

The index of the control to get.

Return value

CCoeControl*

The component control with an index of aIndex.


DoSetLengthL()

void DoSetLengthL(TInt aLength);

Description

Sets the scrollbar’s length and re-calculates required components and their layout.

Parameters

TInt aLength

The required scrollbar length.


NumberOfButtonPairs()

TInt NumberOfButtonPairs(TBool aUseDisplayFlags) const;

Description

Gets either the number of pairs of buttons requested or the number of pairs of buttons displayed.

Parameters

TBool aUseDisplayFlags

ETrue to get the number of displayed button pairs. EFalse to get the number of requested button pairs.

Return value

TInt

The number of pairs of buttons requested or displayed.


SetButtonPositionL()

void SetButtonPositionL(CEikScrollButton* aButton);

Description

Calculates and sets a button’s position, making necessary adjustments for densely packed buttons

Parameters

CEikScrollButton* aButton

The button for which the position is set.


SetLayoutL()

void SetLayoutL();

Description

Sets the position of various components according to the scroll bar’s flags.

[Top]


Member enums


Enum TEikScrollBarFlags

TEikScrollBarFlags

Description

Scroll bar initialisation flags. The default is for the scroll bar to have both a shaft and a thumb.

EEikScrollBarNoNudgeButtons

Does not display nudge buttons.

EEikScrollBarHasPageButtons

Has buttons which move it a page at a time.

EEikScrollBarHasHomeEndButtons

Has buttons which move it its entire extent.

EEikScrollBarNoShaftOrThumb

Central area is empty.

EEikScrollBarShaftButNoThumb

Central area has no scroll thumb.

EButtonsAtStartOfShaft

Buttons are placed at the start of the bar.

EButtonsAtEndOfShaft

Buttons are placed at the end of the bar.

EButtonsEitherSideOfShaft

Buttons are placed at either end of the bar (EButtonsAtStartOfShaft | EButtonsAtEndOfShaft).

ENoAutoDimming

Buttons do not automatically dim when scroll bar is at its maximum extent.


Enum TOrientation

TOrientation

Description

Scroll bar orientation.

EVertical

Scroll bar is oriented vertically.

EHorizontal

Scroll bar is oriented horizontally.


Enum TWhichButtons

TWhichButtons

Description

Determines which buttons are displayed.

EIncreaseOnly

Display the increase buttons only.

EDecreaseOnly

Display the decrease buttons only.

EAll

Display all buttons.


Enum TShaftRedrawRequired

TShaftRedrawRequired

Description

Determines whether to redraw the scroll bar shaft.

ENoRedrawRequired

Do not redraw the scroll bar shaft.

ERedrawShaft

Redraw the scroll bar shaft.


Enum TPrivateScrollBarFlags

TPrivateScrollBarFlags

Description

Flags to determine whether there are visible components and whether to dim the increase, or decrease, buttons.

ENoComponentsToDisplay

There are no visible components in the scroll bar.

EIncreaseButtonsDimmed

Dim the increase buttons.

EDecreaseButtonsDimmed

Dim the decrease buttons.


Enum TPointerDownOn

TPointerDownOn

Description

Determines where on a scroll bar a pointer down event occurred.

ENone

No pointer down event occurred on the scroll bar.

EHomeButton

A pointer down event occurred on the home button.

EDecreasePageButton

A pointer down event occurred on the decrease page button.

EDecreaseNudgeButton

A pointer down event occurred on the decrease nudge button.

EDecreaseShaft

A pointer down event occurred on the decrease shaft button.

EThumb

A pointer down event occurred on the scroll bar thumb.

EIncreaseShaft

A pointer down event occurred on the increase shaft button.

EIncreaseNudgeButton

A pointer down event occurred on the increase nudge button.

EIncreasePageButton

A pointer down event occurred on the increase page button.

EEndButton

A pointer down event occurred on the end button.

[Top]


Member structs


Struct SEikScrollBarButtons

SEikScrollBarButtons

Description

Encapsulates pointers to the scroll bar buttons. A maximum of three pairs of buttons are available, you may choose to use only one pair or two pairs.

Defined in CEikScrollBar::SEikScrollBarButtons:
iDecreaseNudge, iDecreasePage, iEnd, iHome, iIncreaseNudge, iIncreasePage

iDecreaseNudge


CEikScrollButton* iDecreaseNudge

Description

Pointer to the decrease nudge button.

iDecreasePage


CEikScrollButton* iDecreasePage

Description

Pointer to the decrease page button.

iEnd


CEikScrollButton* iEnd

Description

Pointer to the end button.

iHome


CEikScrollButton* iHome

Description

Pointer to the home button.

iIncreaseNudge


CEikScrollButton* iIncreaseNudge

Description

Pointer to the increase nudge button.

iIncreasePage


CEikScrollButton* iIncreasePage

Description

Pointer to the increase page button.

[Top]


Protected data


iButtons

SEikScrollBarButtons iButtons

Description

Scroll bar buttons struct.


iDecreaseButtonsEnd

TInt iDecreaseButtonsEnd

Description

End point of the set of decrease buttons.


iDecreaseButtonsStart

TInt iDecreaseButtonsStart

Description

Start point of the set of decrease buttons.


iIncreaseButtonsEnd

TInt iIncreaseButtonsEnd

Description

End point of the set of increase buttons.


iIncreaseButtonsStart

TInt iIncreaseButtonsStart

Description

Start point of the set of increase buttons.


iLength

TInt iLength

Description

Length of the scroll bar including the shaft, thumb and all buttons.


iOrientation

TOrientation iOrientation

Description

Scroll bar orientation.


iPointerDownOn

TPointerDownOn iPointerDownOn

Description

The scroll bar location on which a pointer down event occurred.


iScrollBarDisplayFlags

TInt iScrollBarDisplayFlags

Description

Flags to determine which scroll bar components are displayed.


iScrollBarFlags

TInt iScrollBarFlags

Description

Flags to determine the scroll bar’s components, layout and dim state.


iScrollBarObserver

MEikScrollBarObserver* iScrollBarObserver

Description

Observer to which scroll bar events are reported.