CAknToolbar Class Reference

Link against: eikcoctl.lib


#include <AknToolbar.h>

Inherits CAknControl, and MAknFadedComponent.


Detailed Description

The class to provide toolbar for the application.
Dll eikcoctl.lib
Since:
Series 60 3.1

Public Types

enum   TEventModifiers { ELongPress = 1, ELongPressEnded = 2 }

Public Member Functions

  ~CAknToolbar ()
  Destructor.
IMPORT_C TInt  CountComponentControls () const
  From CCoeControl.
IMPORT_C CCoeControl *  ComponentControl (TInt aIndex) const
  From CCoeControl.
IMPORT_C void  HandlePointerEventL (const TPointerEvent &aPointerEvent)
  From CCoeControl.
IMPORT_C void  HandleResourceChange (TInt aType)
  From CCoeControl.
IMPORT_C void  HandleControlEventL (CCoeControl *aControl, TCoeEvent aEventType)
  From MCoeControlObserver.
IMPORT_C void  PositionChanged ()
  From CCoeControl.
IMPORT_C void  ProcessCommandL (TInt aCommandId)
  From MEikCommandObserver.
IMPORT_C void  SetDimmed (TBool aDimmed)
  From CCoeControl.
IMPORT_C TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
  From CCoeControl.
IMPORT_C TCoeInputCapabilities  InputCapabilities () const
  From CCoeControl.
IMPORT_C void  Draw (CWindowGc &aGc, const CCoeControl &aControl, const TRect &aRect) const
  From MCoeControlBackground.
IMPORT_C CCoeControl *  ControlOrNull (const TInt aControlId) const
  Gets a pointer to the specified control.
IMPORT_C void  SetToolbarVisibility (const TBool aVisible)
  Shows or hides toolbar.
IMPORT_C void  SetToolbarVisibility (const TBool aVisible, const TBool aFocusing)
  Shows or hides toolbar.
IMPORT_C void  SetItemDimmed (const TInt aCommandId, const TBool aDimmed, const TBool aDrawNow)
  Dims (greys out) or undims a toolbar item.
IMPORT_C void  HideItem (const TInt aCommandId, const TBool aHide, const TBool aDrawNow)
  Hides or unhides a toolbar item.
IMPORT_C void  SetToolbarObserver (MAknToolbarObserver *aObserver)
  Sets the observer for the toolbar.
IMPORT_C MAknToolbarObserver ToolbarObserver ()
  Returns a pointer to the toolbar observer.
IMPORT_C void  AddItemL (CCoeControl *aItem, const TInt aType, const TInt aCommandId, const TInt aFlags)
  Adds one item to the end of the toolbar.
IMPORT_C void  AddItemL (CCoeControl *aItem, const TInt aType, const TInt aCommandId, const TInt aFlags, const TInt aIndex)
  Adds one item to the specified place.
IMPORT_C void  RemoveItem (const TInt aCommandId)
  Removes one item from the toolbar.
IMPORT_C TBool  IsSupportedItemType (const TInt aType) const
  Returns ETrue if the type of the item can be included in the toolbar.
IMPORT_C void  SetInitialFocusedItem (const TInt aCommandId)
  Changes the command ID for the initially focused item when toolbar is shown or gain focus.
IMPORT_C void  SetEmphasis (const TBool aEmphasis)
  Called by the framework to handle the emphasising or de-emphasising of a toolbar window when it is needed.
IMPORT_C TBool  IsShown () const
  Returns toolbar visibility at this moment.
IMPORT_C void  SetWithSliding (const TBool aSlide)
  Specifies whether toolbar should be shown with sliding effect or not.
IMPORT_C void  SetCloseOnCommand (const TInt aCommandId, const TBool aClose)
  Sets whether the toolbar should be closed or remain open after the specified command is issued from the toolbar.
IMPORT_C void  SetCloseOnAllCommands (const TBool aClose)
  Sets whether the toolbar should be closed after a command is issued from the toolbar.
IMPORT_C void  SetOrientation (const TAknOrientation aOrientation)
  Sets toolbar orientation.
IMPORT_C void  UpdateBackground ()
  Updates transparent toolbar's background.
void  ShowToolbarForBackgroundUpdate ()
  Shows toolbar again after it has been hidden for background changing purposes.
IMPORT_C void  DisableToolbarL (TBool aDisable)
  Disables/Enables toolbar so that it cannot/can be activated from e.g.
IMPORT_C TBool  IsToolbarDisabled () const
  Checks if toolbar is disabled.
IMPORT_C void  SetFocusedItemL (const TInt aCommandId)
  Moves highlight from one item to another.
IMPORT_C TInt  FocusedItem () const
  Returns command id of focused item.
void  PrepareForFocusLossL ()
  Takes focus away from edwin or other controls if needed.
IMPORT_C TInt  EventModifiers () const
  Returns event modifiers defined in TEventModifiers in this header.
IMPORT_C TInt  ToolbarFlags () const
  Returns the flags of toolbar.
TInt  CountFadedComponents ()
  CountFadedComponents() returns number of items in the array.
CCoeControl *  FadedComponent (TInt aIndex)
  FadedComponent() returns specific controls from the array based on index.
void  ReduceRect (TRect &aBoundingRect) const
IMPORT_C void  SetSoftkeyResourceIdL (TInt aSoftkeyResourceId)
  Sets the resource id for toolbar softkeys.
void  ExtensionEventL (TInt aCommandId)
  Extension notifies of its events using this method aCommandId command id of the button.
TInt  ToolbarVisibleIndexByControl (const CCoeControl *aControl) const
  Returns the index of the toolbar item inside of the iVisibleItems array.
IMPORT_C CAknToolbarExtension ToolbarExtension () const
  Returns pointer to toolbar extension if available.
void  DynInitExtensionL (CCoeControl *aControl)
  Calls DynInitToolbar with extensions commmand id.
void  SlideWithIdle ()
  Slide toolbar.
IMPORT_C void  HideItemsAndDrawOnlyBackground (TBool aHide)
  Hides/Unhides toolbar items temporarily.
IMPORT_C void  HideItemsAndDrawOnlyBackground (TBool aHide, TInt aPriority)
  Hides/Unhides toolbar items temporarily.

Static Public Member Functions

static IMPORT_C CAknToolbar NewL (const TInt aResourceId)
  Two-phased constructor.
static IMPORT_C CAknToolbar NewLC (const TInt aResourceId)
  Two-phased constructor.
static TInt  ReadyToSlide (TAny *aThis)
  Callback for sliding toolbar.

Protected Member Functions

IMPORT_C void  SizeChanged ()
  From CCoeControl.
IMPORT_C void  FocusChanged (TDrawNow aDrawNow)
  From CCoeControl.
IMPORT_C void ExtensionInterface (TUid aInterface)
  From CAknControl.
IMPORT_C TTypeUid::Ptr  MopSupplyObject (TTypeUid aId)
  From CCoeControl.

Member Enumeration Documentation

enum CAknToolbar::TEventModifiers
 
Enumerator:
ELongPress 
ELongPressEnded 

Constructor & Destructor Documentation

CAknToolbar::~CAknToolbar  ) 
 

Destructor.


Member Function Documentation

IMPORT_C void CAknToolbar::AddItemL CCoeControl *  aItem,
const TInt  aType,
const TInt  aCommandId,
const TInt  aFlags,
const TInt  aIndex
 

Adds one item to the specified place.

Takes ownership. Leaves with value KErrNotSupported, if the control type is not supported by toolbar (see CAknToolbar::IsSupportedItemType()).

Parameters:
aItem  The control.
aType  The type of the new toolbar item.
aCommandId  The command ID for this item.
aFlags  The flags.
aIndex  The index in array at which item should be added.
IMPORT_C void CAknToolbar::AddItemL CCoeControl *  aItem,
const TInt  aType,
const TInt  aCommandId,
const TInt  aFlags
 

Adds one item to the end of the toolbar.

Takes ownership. Leaves with value KErrNotSupported, if the control type is not supported by toolbar (see CAknToolbar::IsSupportedItemType()).

Parameters:
aItem  The control.
aType  The type of the new toolbar item.
aCommandId  The command ID for this item.
aFlags  The flags.
IMPORT_C CCoeControl* CAknToolbar::ComponentControl TInt  aIndex  )  const
 

From CCoeControl.

Gets the specified component of a compound control.

Parameters:
aIndex  The index of the control to get
Returns:
The component control with an index of aIndex.
IMPORT_C CCoeControl* CAknToolbar::ControlOrNull const TInt  aControlId  )  const
 

Gets a pointer to the specified control.

Parameters:
aControlId  The ID of the control for which a pointer is required.
Returns:
Pointer to the control with the specified ID.
IMPORT_C TInt CAknToolbar::CountComponentControls  )  const
 

From CCoeControl.

Gets the number of controls contained in a compound control.

Returns:
The number of component controls contained by this control.
TInt CAknToolbar::CountFadedComponents  )  [virtual]
 

CountFadedComponents() returns number of items in the array.

Reimplemented from MAknFadedComponent.

IMPORT_C void CAknToolbar::DisableToolbarL TBool  aDisable  ) 
 

Disables/Enables toolbar so that it cannot/can be activated from e.g.

touch pane. Needed especially if a dialog is on the screen and toolbar is not wished to be shown. Leaves with value KErrToolbarShown if called when toolbar is shown.

Parameters:
aDisable  ETrue if toolbar should be disabled
Since:
S60 3.2
IMPORT_C void CAknToolbar::Draw CWindowGc &  aGc,
const CCoeControl &  aControl,
const TRect &  aRect
const
 

From MCoeControlBackground.

Draw the background for a given control. The text drawer that shall be used to draw text on the specific background can be fetched through the GetTextDrawer() method.

Parameters:
aGc  Graphics context used for drawing.
aControl  The control being drawn (may be a child of the drawer).
aRect  The area to be redrawn.
void CAknToolbar::DynInitExtensionL CCoeControl *  aControl  ) 
 

Calls DynInitToolbar with extensions commmand id.

IMPORT_C TInt CAknToolbar::EventModifiers  )  const
 

Returns event modifiers defined in TEventModifiers in this header.

This can be used by applications in OfferToolbarEventL to know if the event sent was for example a long press event. Information is valid only during OfferToolbarEventL.

Returns:
event modifiers
Since:
S60 3.2
void CAknToolbar::ExtensionEventL TInt  aCommandId  ) 
 

Extension notifies of its events using this method aCommandId command id of the button.

IMPORT_C void* CAknToolbar::ExtensionInterface TUid  aInterface  )  [protected, virtual]
 

From CAknControl.

For future extensions.

Parameters:
aInterface  The ID for the extension interface.

Reimplemented from CAknControl.

CCoeControl* CAknToolbar::FadedComponent TInt  aIndex  )  [virtual]
 

FadedComponent() returns specific controls from the array based on index.

Reimplemented from MAknFadedComponent.

IMPORT_C void CAknToolbar::FocusChanged TDrawNow  aDrawNow  )  [protected]
 

From CCoeControl.

This function is called whenever a control gains or loses focus.

Parameters:
aDrawNow  Contains the value that was passed to it by SetFocus().
IMPORT_C TInt CAknToolbar::FocusedItem  )  const
 

Returns command id of focused item.

Returns:
command id of focused item. Returns KErrNotFound if no item is focused.
Since:
S60 3.2
IMPORT_C void CAknToolbar::HandleControlEventL CCoeControl *  aControl,
TCoeEvent  aEventType
 

From MCoeControlObserver.

Handles an event from an observed toolbar item.

Parameters:
aControl  The control which sent the event
aEventType  The event type
IMPORT_C void CAknToolbar::HandlePointerEventL const TPointerEvent &  aPointerEvent  ) 
 

From CCoeControl.

Handles pointer events.

Parameters:
aPointerEvent  The pointer event.
IMPORT_C void CAknToolbar::HandleResourceChange TInt  aType  ) 
 

From CCoeControl.

Handles a change to the control's resources.

Parameters:
aType  A message UID value.
IMPORT_C void CAknToolbar::HideItem const TInt  aCommandId,
const TBool  aHide,
const TBool  aDrawNow
 

Hides or unhides a toolbar item.

Parameters:
aCommandId  The command (as defined in an .hrh file) associated with this toolbar item. This identifies the toolbar item, which will be set to hidden or unhidden.
aHide  Use ETrue to hide this toolbar item or EFalse to unhide this toolbar item.
aDrawNow  Should be ETrue for the toolbar to be redrawn.
IMPORT_C void CAknToolbar::HideItemsAndDrawOnlyBackground TBool  aHide,
TInt  aPriority
 

Hides/Unhides toolbar items temporarily.

When called with ETrue toolbar draws just background in landscape and is hidden in portrait. Toolbar window priority is changed to priority passed in parameter. Priority should be one of the window priority values defined in TCoeWinPriority. Default priority is ECoeWinPriorityLow. Note that if toolbar is already hidden, the toolbar window priority is still changed to priority passed in parameter. Calling the function HideItemsAndDrawOnlyBackground with EFalse returns the situation to normal, so drawing the items normally in portrait and landscape. Use this method only with fixed toolbar!

Parameters:
aHide  ETrue if hiding items, EFalse if unhiding.
aPriority  Ordinal priority of toolbar window.
IMPORT_C void CAknToolbar::HideItemsAndDrawOnlyBackground TBool  aHide  ) 
 

Hides/Unhides toolbar items temporarily.

When called with ETrue toolbar draws just background in landscape and is hidden in portrait. Calling with EFalse returns the situation to normal, so drawing the items normally in portrait and landscape. Use this method only with fixed toolbar!

Parameters:
aHide  ETrue if hiding items, EFalse if unhiding.
IMPORT_C TCoeInputCapabilities CAknToolbar::InputCapabilities  )  const
 

From CCoeControl.

Gets the control's input capabilities.

Returns:
The control's input capabilities.
IMPORT_C TBool CAknToolbar::IsShown  )  const
 

Returns toolbar visibility at this moment.

Returns:
ETrue, if toolbar is shown.
IMPORT_C TBool CAknToolbar::IsSupportedItemType const TInt  aType  )  const
 

Returns ETrue if the type of the item can be included in the toolbar.

Returns:
ETrue for the supported type, otherwise EFalse.
IMPORT_C TBool CAknToolbar::IsToolbarDisabled  )  const
 

Checks if toolbar is disabled.

Returns:
ETrue if toolbar is disabled, EFalse if not
Since:
S60 3.2
IMPORT_C TTypeUid::Ptr CAknToolbar::MopSupplyObject TTypeUid  aId  )  [protected]
 

From CCoeControl.

Retrieves an object of the same type as that encapsulated in aId.

Parameters:
aId  An encapsulated object type ID.
Returns:
Encapsulated pointer to the object provided. Note that the encapsulated pointer may be NULL.
static IMPORT_C CAknToolbar* CAknToolbar::NewL const TInt  aResourceId  )  [static]
 

Two-phased constructor.

Parameters:
aResourceId  The ID for this component's resource
Returns:
Pointer to the created toolbar object
static IMPORT_C CAknToolbar* CAknToolbar::NewLC const TInt  aResourceId  )  [static]
 

Two-phased constructor.

Parameters:
aResourceId  The ID for this component's resource
Returns:
Pointer to the created toolbar object
IMPORT_C TKeyResponse CAknToolbar::OfferKeyEventL const TKeyEvent &  aKeyEvent,
TEventCode  aType
 

From CCoeControl.

Handles key events.

Parameters:
aKeyEvent  The key event
aType  The type of key event: EEventKey, EEventKeyUp or EEventKeyDown.
Returns:
TKeyResponse Indicates whether or not the key event was used by this control.
IMPORT_C void CAknToolbar::PositionChanged  ) 
 

From CCoeControl.

Responds to changes in the position of a toolbar.

void CAknToolbar::PrepareForFocusLossL  ) 
 

Takes focus away from edwin or other controls if needed.

Called by AknAppUi from HandleWsEventL when a pointer event is targeted to other control than toolbar.

Since:
S60 3.2
IMPORT_C void CAknToolbar::ProcessCommandL TInt  aCommandId  ) 
 

From MEikCommandObserver.

Processes user commands.

Parameters:
TInt  aCommandId ID of the command to respond to.
static TInt CAknToolbar::ReadyToSlide TAny *  aThis  )  [static]
 

Callback for sliding toolbar.

void CAknToolbar::ReduceRect TRect &  aBoundingRect  )  const
 
IMPORT_C void CAknToolbar::RemoveItem const TInt  aCommandId  ) 
 

Removes one item from the toolbar.

Parameters:
aCommandId  The ID of the item which should be removed.
IMPORT_C void CAknToolbar::SetCloseOnAllCommands const TBool  aClose  ) 
 

Sets whether the toolbar should be closed after a command is issued from the toolbar.

This method affects every command on the toolbar.

Parameters:
aClose  ETrue, if toolbar should be closed.
IMPORT_C void CAknToolbar::SetCloseOnCommand const TInt  aCommandId,
const TBool  aClose
 

Sets whether the toolbar should be closed or remain open after the specified command is issued from the toolbar.

Parameters:
aCommandId  The command.
aClose  ETrue, if toolbar should be close.
IMPORT_C void CAknToolbar::SetDimmed TBool  aDimmed  ) 
 

From CCoeControl.

Sets toolbar dimmed. Doesn't redraw.

Parameters:
aDimmed  is ETrue to dim the toolbar, EFalse to set the toolbar as not dimmed
IMPORT_C void CAknToolbar::SetEmphasis const TBool  aEmphasis  ) 
 

Called by the framework to handle the emphasising or de-emphasising of a toolbar window when it is needed.

Parameters:
aEmphasis  ETrue to emphasize the menu, EFalse otherwise.
IMPORT_C void CAknToolbar::SetFocusedItemL const TInt  aCommandId  ) 
 

Moves highlight from one item to another.

Leaves with value KErrNotFound if item not found.

Parameters:
aCommandId  command id of the item to be focused.
Since:
S60 3.2
IMPORT_C void CAknToolbar::SetInitialFocusedItem const TInt  aCommandId  ) 
 

Changes the command ID for the initially focused item when toolbar is shown or gain focus.

Notice that, if this item is not visible, then focus will be according default behaviour. Normally, focus will be on the first item, if KAknToolbarMiddleItemFocused flag was not used.

Parameters:
aCommandId  The command ID for the item to get focus.
IMPORT_C void CAknToolbar::SetItemDimmed const TInt  aCommandId,
const TBool  aDimmed,
const TBool  aDrawNow
 

Dims (greys out) or undims a toolbar item.

Parameters:
aCommandId  The command (as defined in an .hrh file) associated with this toolbar item. This identifies the toolbar item, whose text is to be dimmed or un-dimmed.
aDimmed  Use ETrue to dim this toolbar item or EFalse to un-dim this toolbar item.
aDrawNow  Should be ETrue for the item to be redrawn.
IMPORT_C void CAknToolbar::SetOrientation const TAknOrientation  aOrientation  ) 
 

Sets toolbar orientation.

Parameters:
aOrientation  Orientation that should be used for toolbar.
Since:
3.2
IMPORT_C void CAknToolbar::SetSoftkeyResourceIdL TInt  aSoftkeyResourceId  ) 
 

Sets the resource id for toolbar softkeys.

If cba allready exists then changes the existing softkeys and redraws toolbar cba.

Parameters:
aSoftkeyResourceId  ID of the resource structure specifying the command buttons.
Since:
S60 3.2
IMPORT_C void CAknToolbar::SetToolbarObserver MAknToolbarObserver aObserver  ) 
 

Sets the observer for the toolbar.

Parameters:
aObserver  A pointer to the observer. Ownership is not changed.
IMPORT_C void CAknToolbar::SetToolbarVisibility const TBool  aVisible,
const TBool  aFocusing
 

Shows or hides toolbar.

Position of the top left corner should be set in advance. This overload of the method allows toolbar to be set non-focusing. Does nothing if toolbar is disabled.

Parameters:
aVisible  ETrue to show it, EFalse to hide it.
aFocusing  ETrue to set toolbar focusing, otherwise EFalse.
IMPORT_C void CAknToolbar::SetToolbarVisibility const TBool  aVisible  ) 
 

Shows or hides toolbar.

Position of the top left corner should be set in advance. Toolbar set visible with this method is by default focusing. Does nothing if toolbar is disabled.

Parameters:
aVisible  ETrue to show it, EFalse to hide it.
IMPORT_C void CAknToolbar::SetWithSliding const TBool  aSlide  ) 
 

Specifies whether toolbar should be shown with sliding effect or not.

By default toolbar is shown with sliding.

Parameters:
aSlide  ETrue for sliding effect, EFalse without sliding.
void CAknToolbar::ShowToolbarForBackgroundUpdate  ) 
 

Shows toolbar again after it has been hidden for background changing purposes.

Since:
3.2
IMPORT_C void CAknToolbar::SizeChanged  )  [protected]
 

From CCoeControl.

Responds to size changes to sets the size and position of the contents of this control.

void CAknToolbar::SlideWithIdle  ) 
 

Slide toolbar.

IMPORT_C CAknToolbarExtension* CAknToolbar::ToolbarExtension  )  const
 

Returns pointer to toolbar extension if available.

Returns:
toolbar extension or NULL
IMPORT_C TInt CAknToolbar::ToolbarFlags  )  const
 

Returns the flags of toolbar.

Flags are defined in eikon.hrh.

Returns:
toolbar flags
Since:
S60 3.2
IMPORT_C MAknToolbarObserver* CAknToolbar::ToolbarObserver  ) 
 

Returns a pointer to the toolbar observer.

Returns:
Pointer to the toolbar observer.
TInt CAknToolbar::ToolbarVisibleIndexByControl const CCoeControl *  aControl  )  const
 

Returns the index of the toolbar item inside of the iVisibleItems array.

Parameters:
aControl  The control which index is needed.
Returns:
Index of the toolbar item.
IMPORT_C void CAknToolbar::UpdateBackground  ) 
 

Updates transparent toolbar's background.

Since:
3.2

The documentation for this class was generated from the following file:

Copyright © Nokia Corporation 2001-2007
Back to top