Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: eiktbar.h
Link against: eikcoctl.lib

Class CEikToolBar

CEikToolBar

Support

Supported from 6.0

Description

A vertical group of controls displayed down the left-hand side of an application containing buttons which are used to issue application commands, and other controls. A toolband may also be created using this class, by setting the EEikToolBarHorizontal flag and initialising from a TOOLBAND resource.

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
CEikToolBarA vertical group of controls displayed down the left-hand side of an application containing buttons which are used to issue application commands, and other controls
MCoeControlObserverInterface for a control to send events to another control, its observer
MEikButtonGroupBase class used in the derivation of CEikToolBar

Defined in CEikToolBar:
AddControlL(), CEikToolBar(), ConstructFromResourceL(), ConstructL(), CoordinateButtons(), DelayActivation(), GetColorUseListL(), HandleResourceChange(), InputCapabilities(), ReduceRect(), SetBoundingRectL(), SetButtonStateOn(), SetCommandObserver(), SetDimmed(), StaticConstructL(), ~CEikToolBar()

Inherited from CBase:
operator new()

Inherited from CCoeControl:
ActivateGc(), ActivateL(), BackedUpWindow(), CapturesPointer(), ClaimPointerGrab(), CloseWindow(), ComponentControl(), ControlContext(), ControlEnv(), CopyControlContextFrom(), CountComponentControls(), CreateBackedUpWindowL(), CreateWindowL(), DeactivateGc(), DrawDeferred(), DrawNow(), DrawableWindow(), EnableDragEvents(), FocusChanged(), GetColor(), GetHelpContext(), GrabbingComponent(), HandleComponentControlsResourceChange(), HandlePointerBufferReadyL(), HandlePointerEventL(), HandleRedrawEvent(), IgnoreEventsUntilNextPointerUp(), Index(), 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(), Draw(), HasBorder(), SetAdjacent(), SetBorder(), iBorder

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


Construction and destruction


CEikToolBar()

CEikToolBar();

Description

Constructor.

Creates a new toolbar object, but does not initialise any of its heap-stored members.


ConstructL()

void ConstructL
    (MEikCommandObserver* aCommandObserver,
     TInt aResourceId,
     const TRect& aBoundingRect);

Description

Completes construction of a default-constructed toolbar.

The command observer interface defines a method for creating custom controls on the toolbar from user-defined IDs specified in the resource aResourceId. IDs for controls which cannot be constructed using EikControlFactory::CreateByTypeL() are passed to this object’s command observer for construction; if that fails then this function panics with a code of EEikPanicToolBarNullControl and a category of Uikon.

Applications requiring custom controls in their toolbars should override their App UI’s CreateCustomCommandControlL() method, inherited from MEikCommandObserver.

Parameters

MEikCommandObserver* aCommandObserver

Sets the command observer for this toolbar. The observer’s ProcessCommandL() function is invoked when a toolbar command is invoked by the user. See MEikCommandObserver::ProcessCommandL(). Typically the observer is the application’s App UI.

TInt aResourceId

The ID of a TOOLBAR or TOOLBAND resource structure.

const TRect& aBoundingRect

Defines the rectangle to which the toolbar’s extent must be limited. This is typically given by CEikAppUi::ClientRect(), which returns the extent of the whole application window, less the extent of any toolbars that already exist and are owned by the App UI.

See also:


StaticConstructL()

void StaticConstructL(MEikCommandObserver* aCommandObserver,TInt aResourceId);

Description

Creates a toolbar from a resource definition, but does not set its extent or activate it. This function is used by ConstructL(), applications will not typically need to use it.

Parameters

MEikCommandObserver* aCommandObserver

Specifies the object in which HandleCommandL() is called when a toolbar command is invoked — typically the application’s App UI.

TInt aResourceId

The resource that defines the toolbar.


ConstructFromResourceL()

void ConstructFromResourceL(TResourceReader& aReader);

Description

Second-phase construction from a resource. This is called by StaticConstructL() with an appropriate reader.

Parameters

TResourceReader& aReader

A resource reader pointing at a TOOLBAR or TOOLBAND resource defining the toolbar.


DelayActivation()

TBool DelayActivation() const;

Description

Delays activation of the toolbar when constructed. This function sets the toolbar flag EEikToolBarDelayActivation. If this flag is set when ConstructL() is called on the toolbar, the toolbar will be constructed but not activated. The application can subsequently activate the toolbar by calling CCoeControl::ActivateL().

Return value

TBool

ETrue to delay activation of the toolbar.


~CEikToolBar()

~CEikToolBar();

Description

Destructor. Deletes the toolbar’s brush and pen context and control types.

[Top]


Bounding rectangle


SetBoundingRectL()

void SetBoundingRectL(const TRect& aRect);

Description

Sets the toolbar’s bounding rectangle. This function has a different effect on the toolbar’s extent, depending on whether the toolbar is vertical or horizontal.

For a vertical toolbar, sets the toolbar height to equal the height of the bounding rectangle.

For a horizontal toolbar (toolband), sets the toolband width to equal the width of the bounding rectangle.

Parameters

const TRect& aRect

The toolbar’s bounding rectangle.


ReduceRect()

void ReduceRect(TRect& aBoundingRect) const;

Description

Shrinks a rectangle to exclude the toolbar area. This function reduces the size of the rectangle passed into the function so that on return, the area occupied by the toolbar or toolband is removed from the rectangle. It is provided to prevent drawing over an existing toolbar or toolband.

Parameters

TRect& aBoundingRect

Specifies a rectangle which, on return, is shrunk to exclude the toolbar’s extent.

[Top]


Observer and coordinator


SetCommandObserver()

void SetCommandObserver(MEikCommandObserver* aCommandObserver);

Description

Sets the toolbar’s command observer. Applications will not typically need to use this function.

Parameters

MEikCommandObserver* aCommandObserver

The command observer for this toolbar. When a command is invoked in the toolbar, HandleCommandL() is called in the observer.


CoordinateButtons()

void CoordinateButtons(TInt aId,TInt aCount,TEikButtonCoordinator* aCoordinator);

Description

Sets the button coordinator for a group of buttons in a toolbar.

Parameters

TInt aId

Command identifying a toolbar button.

TInt aCount

The number of buttons in the group.

TEikButtonCoordinator* aCoordinator

The button coordinator.

[Top]


Buttons


SetButtonStateOn()

void SetButtonStateOn(TInt aId,TBool aState);

Description

Sets the state of the specified button and draws the button to show the new state.

Parameters

TInt aId

The command that identifies the button.

TBool aState

ETrue to set the button, EFalse to clear the button.

[Top]


Colour use


GetColorUseListL()

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

Description

Gets the list of logical colours used to draw the control. Appends the list to aColorUseList paired with an explanation of how the colours are used.

Parameters

CArrayFix<TCoeColorUse>& aColorUseList

The list of logical colours.

[Top]


Handling resource changes


HandleResourceChange()

void HandleResourceChange(TInt aType);

Description

Handles a change to the control's resources which are shared across the environment. For example, colors or fonts.

Parameters

TInt aType

The type of resource that has changed.

[Top]


Input capabilities


InputCapabilities()

TCoeInputCapabilities InputCapabilities() const;

Description

Gets toolbar input capabilities.

Return value

TCoeInputCapabilities

The toolbar’s input capabilities.

[Top]


Base class implementation

Description

The following functions override methods which are declared virtual in CCoeControl, CEikControlGroup and MCoeControlObserver.


SetDimmed()

void SetDimmed(TBool aDimmed);

Description

Sets toolbar dim state. Dimming usually indicates user input is not accepted.

Parameters

TBool

ETrue to set as dimmed , EFalse to set as not dimmed.


AddControlL()

void AddControlL(CCoeControl* aControl,TInt aId);

Description

Adds a control to the control group. Overrides CEikControlGroup::AddControlL().

Parameters

CCoeControl* aControl

The control to add to the control group.

TInt aId

The control’s ID.


AddControlL()

void AddControlL(TEikGroupControl& aGroupControl);

Description

Adds a control wrapped with its ID and length to the control group. Overrides CEikControlGroup::AddControlL().

Parameters

TEikGroupControl& aGroupControl

The wrapped control to add.