CAknButton Class Reference

Link against: eikcoctl.lib


#include <
AknButton.h>

Inherits CAknControl.

Inherited by CAknToolbarExtension.


Detailed Description

Generic button class.
Dll eikcoctl.lib
Since:
Series 60 3.1

Public Types

enum  TAlignment {
  ECenter, ETop, EBottom, ERight,
  ELeft
}
enum  TTooltipPosition { EPositionTop = 1, EPositionBottom, EPositionLeft, EPositionRight }
enum  TTextAndIconAlignment {
  EIconBeforeText, EIconAfterText, EIconUnderText, EIconOverText,
  EOverlay
}
enum  TButtonEvent { ELongPressEvent = 100, ELongPressEndedEvent }

Public Member Functions

virtual IMPORT_C ~CAknButton ()
 Destructor.
IMPORT_C void ActivateL ()
 Sets control as ready to be drawn.
IMPORT_C void ConstructFromResourceL (TResourceReader &aReader)
 Constructs controls from a resource file.
IMPORT_C void HandleResourceChange (TInt aType)
 Handles a change to the control's resources.
IMPORT_C TSize MinimumSize ()
 Returns the control's minimum required size.
IMPORT_C void SetDimmed (TBool aDimmed)
 Sets button dimmed.
IMPORT_C TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
 Handles key events.
IMPORT_C void MakeVisible (TBool aVisible)
 Sets this control as visible or invisible.
IMPORT_C void PrepareForFocusLossL ()
 This function is called by the dialog framework immediately before it removes keyboard focus from a control within a dialog.
IMPORT_C void PrepareForFocusGainL ()
 Prepares the control for gaining focus.
IMPORT_C void HandlePointerEventL (const TPointerEvent &aPointerEvent)
 Handles pointer events.
virtual IMPORT_C void PositionChanged ()
 Responds to changes in the position of a control.
IMPORT_C void ConstructFromResourceL (const TInt aResourceId)
 Constructs controls from a resource file.
virtual IMPORT_C void SetCurrentState (const TInt aStateIndex, const TBool aDrawNow)
 Sets button state.
virtual IMPORT_C void AddStateL (CGulIcon *aIcon, CGulIcon *aDimmedIcon, CGulIcon *aPressedIcon, CGulIcon *aHoverIcon, const TDesC &aText, const TDesC &aHelpText, const TInt aStateFlags)
 Adds one more state for the button to the end of state array.
virtual IMPORT_C void AddStateL (const TDesC &aFilePath, const TInt aBmpId, const TInt aMaskId, const TInt aDimmedBmpId, const TInt aDimmedMaskId, const TInt aPressedBmpId, const TInt aPressedMaskId, const TInt aHoverBmpId, const TInt aHoverMaskId, const TDesC &aText, const TDesC &aHelpText, const TInt aStateFlags, const TAknsItemID &aId, const TAknsItemID &aDimmedId, const TAknsItemID &aPressedId, const TAknsItemID &aHoverId)
 Adds one more state for the button.
void AddStateL (CGulIcon *aIcon, CGulIcon *aDimmedIcon, CGulIcon *aPressedIcon, CGulIcon *aHoverIcon, const TDesC &aText, const TDesC &aHelpText, const TInt aStateFlags, const TInt aCommandId)
 Adds one more state for the button to the end of state array.
IMPORT_C void SetButtonFlags (const TInt aFlags)
 Sets the button flags.
IMPORT_C void SetFrameAndCenterIds (const TAknsItemID &aFrameId, const TAknsItemID &aCenterId, const TAknsItemID &aLatchedFrameId, const TAknsItemID &aLatchedCenterId, const TAknsItemID &aDimmedFrameId, const TAknsItemID &aDimmedCenterId, const TAknsItemID &aPressedFrameId, const TAknsItemID &aPressedCenterId, const TAknsItemID &aLatchedDimmedFrameId, const TAknsItemID &aLatchedDimmedCenterId)
 Sets specified frame IDs.
IMPORT_C void SetBackgroundIds (const TAknsItemID &aBackgroundId, const TAknsItemID &aLatchedBackgroundId, const TAknsItemID &aDimmedBackgroundId, const TAknsItemID &aPressedBackgroundId, const TAknsItemID &aLatchedDimmedBackgroundId)
 Sets specified background IDs.
IMPORT_C void SetTextFont (const CFont *aFont)
 Sets some specific text font.
IMPORT_C void SetTextColorIds (const TAknsItemID &aTextColorTableId, const TInt aTextColorIndex)
 Sets the color table and color index for the button text.
IMPORT_C void SetTextHorizontalAlignment (const CGraphicsContext::TTextAlign aHorizontalAlignment)
 Sets the horizontal alignment for the text inside the button.
IMPORT_C void SetTextVerticalAlignment (const CAknButton::TAlignment aVerticalAlignment)
 Sets the vertical alignment for the text inside the button.
IMPORT_C void SetTextAndIconAlignment (const CAknButton::TTextAndIconAlignment aAlignment)
 Sets the icon and text alignment for a button having both.
IMPORT_C void SetTextUnderlineStyle (TFontUnderline aUnderlineStyle)
 Sets the text underline style for the text inside the button.
IMPORT_C void SetIconScaleMode (const TScaleMode aScaleMode)
 Sets the scale mode for the icon inside the button.
IMPORT_C void SetIconHorizontalAlignment (const CAknButton::TAlignment aHorizontalAlignment)
 Sets the horizontal alignment for the icon inside the button.
IMPORT_C void SetIconVerticalAlignment (const CAknButton::TAlignment aVerticalAlignment)
 Sets the vertical alignment for the icon inside the button.
IMPORT_C void SetHelpNoteTimeouts (const TInt aBeforeTimeout, const TInt aInViewTimeout)
 Sets the delay before the help text is shown and also specifies the time for how long help text is visible.
IMPORT_C void SetKeyRepeatInterval (const TInt aKeyRepeatDelay, const TInt aKeyRepeatInterval)
 Sets the interval for key repeat.
IMPORT_C void SetLongPressInterval (const TInt aLongPressInterval)
 Sets the interval for long press.
IMPORT_C TInt StateIndex () const
 Returns the index of the button state.
IMPORT_C void EnablePictographsL (CAknPictographInterface &aInterface)
 Enables pictograph drawing in the button text.
IMPORT_C void DisablePictographs ()
 Disables pictograph drawing in the button text.
IMPORT_C void SetHighlightRect (const TRect &aRect)
 It will change the default highlight rectangle around the focused button.
IMPORT_C TRect HighlightRect () const
 Gets the highlight rectangle around the button.
IMPORT_C void SetTooltipPosition (const TTooltipPosition aPosition)
 Sets the tooltip position.
IMPORT_C void SetRequestExit (const TBool aRequestExit)
 Sets whether button should send an EEventRequestExit event to command observer on button up event.
IMPORT_C TBool IsDimmed () const
 Tests if the control is dimmed.
IMPORT_C void SetDimmedHelpTextL (const TDesC &aHelpText)
 Sets the help text for dimmed button.
TBool HitAreaContainsL (const TPoint &aPoint, TBool aCheckHitArea) const
 Check if point is within buttons visible area, when KAknButtonHitTest flag is enabled.
IMPORT_C CAknButtonStateState () const
 Returns the current state of the button.
IMPORT_C CAknButtonStateState (const TInt aStateIndex) const
 Returns the state of the button under specified index.
IMPORT_C TInt ButtonFlags () const
 Returns the flags of button.
IMPORT_C void SetMargins (const TMargins8 &aMargins)
 Sets button's margins.
IMPORT_C TInt SetIconSize (const TSize &aSize)
 Sets icon size for the button.
TBool UsesDefaultMargins () const
 Checks if the button uses default margins.
void HideTooltipWhenAppFaded (TBool aHide)
 Sets tooltip to hide or show itself when background faded.
void CheckHitArea ()
IMPORT_C void ResetState ()
 Resets button to unpressed state.
void UseMaskedDraw (TBool aMaskedDraw)
 Sets button to use additional masks during drawing.
void RegisterResourceProvider (CAknResourceProvider *aProvider)
 Registers resource provider.
void UnregisterResourceProvider ()
 Unregisters resource provider.
CAknsFrameBackgroundControlContextBgContext ()
void RemoveCurrentState ()
 Removes the currently active state from the button, and sets the current state to the previous one.
TRect TouchArea () const
 Returns the button touchable area.

Static Public Member Functions

static IMPORT_C CAknButtonNewL ()
 Two-phased constructor.
static IMPORT_C CAknButtonNewLC ()
 Two-phased constructor.
static IMPORT_C CAknButtonNewL (TResourceReader &aReader)
 Two-phased constructor.
static IMPORT_C CAknButtonNewLC (TResourceReader &aReader)
 Two-phased constructor.
static IMPORT_C CAknButtonNewL (const TInt aResourceId)
 Two-phased constructor.
static IMPORT_C CAknButtonNewLC (const TInt aResourceId)
 Two-phased constructor.
static IMPORT_C CAknButtonNewL (CGulIcon *aIcon, CGulIcon *aDimmedIcon, CGulIcon *aPressedIcon, CGulIcon *aHoverIcon, const TDesC &aText, const TDesC &aHelpText, const TInt aButtonFlags, const TInt aStateFlags)
 Two-phased constructor.
static IMPORT_C CAknButtonNewLC (CGulIcon *aIcon, CGulIcon *aDimmedIcon, CGulIcon *aPressedIcon, CGulIcon *aHoverIcon, const TDesC &aText, const TDesC &aHelpText, const TInt aFlags, const TInt aStateFlags)
 Two-phased constructor.
static IMPORT_C CAknButtonNewL (const TDesC &aFilePath, const TInt aBmpId, const TInt aMaskId, const TInt aDimmedBmpId, const TInt aDimmedMaskId, const TInt aPressedBmpId, const TInt aPressedMaskId, const TInt aHoverBmpId, const TInt aHoverMaskId, const TDesC &aText, const TDesC &aHelpText, const TInt aButtonFlags, const TInt aStateFlags, const TAknsItemID &aId=KAknsIIDNone, const TAknsItemID &aDimmedId=KAknsIIDNone, const TAknsItemID &aPressedId=KAknsIIDNone, const TAknsItemID &aHoverId=KAknsIIDNone)
 Two-phased constructor.
static IMPORT_C CAknButtonNewLC (const TDesC &aFilePath, const TInt aBmpId, const TInt aMaskId, const TInt aDimmedBmpId, const TInt aDimmedMaskId, const TInt aPressedBmpId, const TInt aPressedMaskId, const TInt aHoverBmpId, const TInt aHoverMaskId, const TDesC &aText, const TDesC &aHelpText, const TInt aButtonFlags, const TInt aStateFlags, const TAknsItemID &aId=KAknsIIDNone, const TAknsItemID &aDimmedId=KAknsIIDNone, const TAknsItemID &aPressedId=KAknsIIDNone, const TAknsItemID &aHoverId=KAknsIIDNone)
 Two-phased constructor.

Protected Member Functions

IMPORT_C CAknButton (const TInt aFlags)
 C++ constructor for the one state button.
IMPORT_C void ConstructL ()
 Symbian 2nd phase constructor.
IMPORT_C void ConstructL (CGulIcon *aIcon, CGulIcon *aDimmedIcon, CGulIcon *aPressedIcon, CGulIcon *aHoverIcon, const TDesC &aText, const TDesC &aHelpText, const TInt aStateFlags)
 Symbian 2nd phase constructor.
IMPORT_C void ConstructL (const TDesC &aFilePath, const TInt aBmpId, const TInt aMaskId, const TInt aDimmedBmpId, const TInt aDimmedMaskId, const TInt aPressedBmpId, const TInt aPressedMaskId, const TInt aHoverBmpId, const TInt aHoverMaskId, const TDesC &aText, const TDesC &aHelpText, const TInt aStateFlags, const TAknsItemID &aId=KAknsIIDNone, const TAknsItemID &aDimmedId=KAknsIIDNone, const TAknsItemID &aPressedId=KAknsIIDNone, const TAknsItemID &aHoverId=KAknsIIDNone)
 Symbian 2nd phase constructor.
IMPORT_C void SizeChanged ()
 Responds to size changes to sets the size and position of the contents of this control.
IMPORT_C void FocusChanged (TDrawNow aDrawNow)
 This function is called whenever a control gains or loses focus.
IMPORT_C voidExtensionInterface (TUid aInterface)
 For future extensions.
IMPORT_C TInt ChangeState (TBool aDrawNow)
 Changes the state of the button to the next one.
IMPORT_C const TDesC & GetCurrentText () const
 Returns the text, which will be displayed inside the button for the current state.
IMPORT_C const CGulIcon * GetCurrentIcon () const
 Returns icon for the current state.
IMPORT_C void ShowHelpL ()
 Shows help text for a certain period of time.
IMPORT_C void HideHelp ()
 Hides help text after certain interval.

Protected Attributes

CArrayPtrFlat< CAknButtonState > * iStates
TInt iFlags
TInt iStateIndex
TBool iButtonPressed
TInt iNumberOfDragEvents
TBool iKeyDownReported
CAknsFrameBackgroundControlContextiBgContext
TRect iHighlightRect
const CFont * iFont
TAlignment iVerticalAlignment
CGraphicsContext::TTextAlign iHorizontalAlignment
TAknsItemID iTextColorTableId
TInt iTextColorIndex
TScaleMode iScaleMode
TInt iHelpNoteWaitInterval
TInt iHelpNoteInViewInterval
CAknInfoPopupNoteControlleriHelpNote
HBufC * iDimmedHelpText
TBool iShowHelp
CPeriodic * iKeyRepeatTimer
TInt iKeyRepeatDelay
TInt iKeyRepeatInterval

Member Enumeration Documentation

enum CAknButton::TAlignment
 
Enumerator:
ECenter 
ETop 
EBottom 
ERight 
ELeft 
enum CAknButton::TButtonEvent
 
Enumerator:
ELongPressEvent 
ELongPressEndedEvent 
enum CAknButton::TTextAndIconAlignment
 
Enumerator:
EIconBeforeText 
EIconAfterText 
EIconUnderText 
EIconOverText 
EOverlay 
enum CAknButton::TTooltipPosition
 
Enumerator:
EPositionTop 
EPositionBottom 
EPositionLeft 
EPositionRight 

Constructor & Destructor Documentation

virtual IMPORT_C CAknButton::~CAknButton  )  [virtual]
 

Destructor.

IMPORT_C CAknButton::CAknButton const TInt  aFlags  )  [protected]
 

C++ constructor for the one state button.

Parameters:
aFlags The flags for the button

Member Function Documentation

IMPORT_C void CAknButton::ActivateL  ) 
 

Sets control as ready to be drawn.

void CAknButton::AddStateL CGulIcon *  aIcon,
CGulIcon *  aDimmedIcon,
CGulIcon *  aPressedIcon,
CGulIcon *  aHoverIcon,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aStateFlags,
const TInt  aCommandId
 

Adds one more state for the button to the end of state array.

Parameters:
aIcon The icon object containing a bitmap and a mask (if there is one) for the button.
aDimmedIcon The icon object containing a bitmap and a mask (if there is one) for the dimmed case.
aPressedIcon The icon object containing a bitmap and a mask (if there is one) for the case when button is pressed.
aHoverIcon The icon object containingg a bitmap and a mask for the case when the pointer is hovering over the button.
aText is the text.
aHelpText is the text for the tooltip.
aStateFlags The flags for the state.
aCommandId Command to be attached with the state.
virtual IMPORT_C void CAknButton::AddStateL const TDesC &  aFilePath,
const TInt  aBmpId,
const TInt  aMaskId,
const TInt  aDimmedBmpId,
const TInt  aDimmedMaskId,
const TInt  aPressedBmpId,
const TInt  aPressedMaskId,
const TInt  aHoverBmpId,
const TInt  aHoverMaskId,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aStateFlags,
const TAknsItemID aId,
const TAknsItemID aDimmedId,
const TAknsItemID aPressedId,
const TAknsItemID aHoverId
[virtual]
 

Adds one more state for the button.

Parameters:
aFilePath The path to the file which contains icons.
aBmpId The bitmap ID for the normal state icon.
aMaskId The mask ID for the normal state icon.
aDimmedBmpId The bitmap ID for the dimmed state icon.
aDimmedMaskId The mask ID for the dimmed state icon.
aPressedBmpId The bitmap ID for the pressed down state.
aPressedMaskId The mask ID for the pressed down state.
aHoverBmpId The bitmap ID for the hover state.
aHoverMaskId The mask ID for the hover state.
aHoverId Item ID of the hover state masked bitmap to be created for skin specific icon.
aText is the text.
aHelpText is the text for the tooltip.
aStateFlags The flags for the state.
aId Item ID of the masked bitmap to be created for skin specific icon. Use KAknsIIDNone when it is not needed.
aDimmedId Item ID of the dimmed masked bitmap to be created for skin specific icon. Use KAknsIIDNone when it is not needed.
aPressedId Item ID of the pressed masked bitmap to be created for skin specific icon. Use KAknsIIDNone when it is not needed.
aHoverId Item ID of the hover state masked bitmap to be created for skin specific icon.
virtual IMPORT_C void CAknButton::AddStateL CGulIcon *  aIcon,
CGulIcon *  aDimmedIcon,
CGulIcon *  aPressedIcon,
CGulIcon *  aHoverIcon,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aStateFlags
[virtual]
 

Adds one more state for the button to the end of state array.

Parameters:
aIcon The icon object containing a bitmap and a mask (if there is one) for the button.
aDimmedIcon The icon object containing a bitmap and a mask (if there is one) for the dimmed case.
aPressedIcon The icon object containing a bitmap and a mask (if there is one) for the case when button is pressed.
aHoverIcon The icon object containingg a bitmap and a mask for the case when the pointer is hovering over the button.
aText is the text.
aHelpText is the text for the tooltip.
aStateFlags The flags for the state.
CAknsFrameBackgroundControlContext* CAknButton::BgContext  ) 
 
IMPORT_C TInt CAknButton::ButtonFlags  )  const
 

Returns the flags of button.

The flags are defined in eikon.hrh.

Returns:
Button flags.
Since:
S60 3.2
IMPORT_C TInt CAknButton::ChangeState TBool  aDrawNow  )  [protected]
 

Changes the state of the button to the next one.

Returns:
the current state index
void CAknButton::CheckHitArea  ) 
 
IMPORT_C void CAknButton::ConstructFromResourceL const TInt  aResourceId  ) 
 

Constructs controls from a resource file.

Parameters:
aResourceId The ID for this component's resource.
IMPORT_C void CAknButton::ConstructFromResourceL TResourceReader &  aReader  ) 
 

Constructs controls from a resource file.

Parameters:
aReader The resource reader, with which to access the control's resource values.

Reimplemented in CAknToolbarExtension.

IMPORT_C void CAknButton::ConstructL const TDesC &  aFilePath,
const TInt  aBmpId,
const TInt  aMaskId,
const TInt  aDimmedBmpId,
const TInt  aDimmedMaskId,
const TInt  aPressedBmpId,
const TInt  aPressedMaskId,
const TInt  aHoverBmpId,
const TInt  aHoverMaskId,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aStateFlags,
const TAknsItemID aId = KAknsIIDNone,
const TAknsItemID aDimmedId = KAknsIIDNone,
const TAknsItemID aPressedId = KAknsIIDNone,
const TAknsItemID aHoverId = KAknsIIDNone
[protected]
 

Symbian 2nd phase constructor.

Parameters:
aFilePath The path to the file which contains icons.
aBmpId The bitmap ID for the normal state icon.
aMaskId The mask ID for the normal state icon.
aDimmedBmpId The bitmap ID for the dimmed state icon.
aDimmedMaskId The mask ID for the dimmed state icon.
aPressedBmpId The bitmap ID for the pressed down state.
aPressedMaskId The mask ID for the pressed down state.
aHoverBmpId The bitmap ID for the hover state icon.
aHoverMaskId The mask ID for the hover state icon.
aText The text inside the button.
aHelpText The text for the tooltip.
aStateFlags The flags for the first state.
aId Item ID of the masked bitmap to be created for skin specific icon.
aDimmedId Item ID of the dimmed masked bitmap to be created for skin specific icon.
aPressedId Item ID of the pressed masked bitmap to be created for skin specific icon.
aHoverId Item ID of the masked hover bitmap to be created for skin specific icon.
IMPORT_C void CAknButton::ConstructL CGulIcon *  aIcon,
CGulIcon *  aDimmedIcon,
CGulIcon *  aPressedIcon,
CGulIcon *  aHoverIcon,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aStateFlags
[protected]
 

Symbian 2nd phase constructor.

Parameters:
aIcon The icon for the normal state. Takes ownership.
aDimmedIcon The icon for the dimmed state. Takes ownership.
aPressedIcon The icon for the pressed down. Takes ownership.
aHoverIcon The icon for the hover state.
aText The text inside the button.
aHelpText The text for the tooltip.
aStateFlags The flags for the first state.
IMPORT_C void CAknButton::ConstructL  )  [protected]
 

Symbian 2nd phase constructor.

IMPORT_C void CAknButton::DisablePictographs  ) 
 

Disables pictograph drawing in the button text.

Only effective in Japanese variant. By default, it is disabled.

IMPORT_C void CAknButton::EnablePictographsL CAknPictographInterface aInterface  ) 
 

Enables pictograph drawing in the button text.

Only effective in Japanese variant. By default, it is disabled.

Parameters:
aInterface Used pictograph interface owned by the caller.
IMPORT_C void* CAknButton::ExtensionInterface TUid  aInterface  )  [protected, virtual]
 

For future extensions.

Parameters:
aInterface The ID for the extension interface.

Reimplemented from CAknControl.

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

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 const CGulIcon* CAknButton::GetCurrentIcon  )  const [protected]
 

Returns icon for the current state.

IMPORT_C const TDesC& CAknButton::GetCurrentText  )  const [protected]
 

Returns the text, which will be displayed inside the button for the current state.

IMPORT_C void CAknButton::HandlePointerEventL const TPointerEvent &  aPointerEvent  ) 
 

Handles pointer events.

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

Handles a change to the control's resources.

Parameters:
aType is a message UID value.

Reimplemented in CAknToolbarExtension.

IMPORT_C void CAknButton::HideHelp  )  [protected]
 

Hides help text after certain interval.

void CAknButton::HideTooltipWhenAppFaded TBool  aHide  ) 
 

Sets tooltip to hide or show itself when background faded.

Since:
S60 3.2
Parameters:
aHide should be ETrue if hiding, EFalse if showing
IMPORT_C TRect CAknButton::HighlightRect  )  const
 

Gets the highlight rectangle around the button.

Returns:
The higlight rectangle around the button.
TBool CAknButton::HitAreaContainsL const TPoint &  aPoint,
TBool  aCheckHitArea
const
 

Check if point is within buttons visible area, when KAknButtonHitTest flag is enabled.

Parameters:
aPoint Location to check.
aCheckHitArea if need to check the hit area for fixed toolbar button
IMPORT_C TBool CAknButton::IsDimmed  )  const
 

Tests if the control is dimmed.

This function overrides the function declared in CCoeControl, and returns the value which is set and unset using CAknButton::SetDimmed().

Returns:
ETrue if the control is dimmed, EFalse if it is not dimmed.
IMPORT_C void CAknButton::MakeVisible TBool  aVisible  ) 
 

Sets this control as visible or invisible.

Parameters:
aVisible ETrue to make the control visible, EFalse to make it invisible.

Reimplemented in CAknToolbarExtension.

IMPORT_C TSize CAknButton::MinimumSize  ) 
 

Returns the control's minimum required size.

It does not include the size of the highlight. However, it includes current margins. Use HighlightRect() function to get highlight rectangle for the focused button.

Returns:
The minimum size required by the control.
static IMPORT_C CAknButton* CAknButton::NewL const TDesC &  aFilePath,
const TInt  aBmpId,
const TInt  aMaskId,
const TInt  aDimmedBmpId,
const TInt  aDimmedMaskId,
const TInt  aPressedBmpId,
const TInt  aPressedMaskId,
const TInt  aHoverBmpId,
const TInt  aHoverMaskId,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aButtonFlags,
const TInt  aStateFlags,
const TAknsItemID aId = KAknsIIDNone,
const TAknsItemID aDimmedId = KAknsIIDNone,
const TAknsItemID aPressedId = KAknsIIDNone,
const TAknsItemID aHoverId = KAknsIIDNone
[static]
 

Two-phased constructor.

Constructs one state button.

Parameters:
aFilePath The path to the file which contains icons.
aBmpId The bitmap ID for the normal state icon.
aMaskId The mask ID for the normal state icon.
aDimmedBmpId The bitmap ID for the dimmed state icon.
aDimmedMaskId The mask ID for the dimmed state icon.
aPressedBmpId The bitmap ID for the pressed down state.
aPressedMaskId The mask ID for the pressed down state.
aHoverBmpId The bitmap ID for the hover state.
aHoverMaskId The mask ID for the hover state.
aText The text inside the button.
aHelpText The text for the tooltip.
aButtonFlags The flags for the button.
aStateFlags The flags for the first state.
aId Item ID of the masked bitmap to be created for skin specific icon.
aDimmedId Item ID of the dimmed masked bitmap to be created for skin specific icon.
aPressedId Item ID of the pressed masked bitmap to be created for skin specific icon.
aHoverId Item ID of the masked hover bitmap to be created for skin specific icon.
static IMPORT_C CAknButton* CAknButton::NewL CGulIcon *  aIcon,
CGulIcon *  aDimmedIcon,
CGulIcon *  aPressedIcon,
CGulIcon *  aHoverIcon,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aButtonFlags,
const TInt  aStateFlags
[static]
 

Two-phased constructor.

Constructs one state button.

Parameters:
aIcon The icon for the normal state. Takes ownership.
aDimmedIcon The icon for the dimmed state. Takes ownership.
aPressedIcon The icon for the pressed down. Takes ownership.
aHoverIcon The icon for the hover state. Takes ownership.
aText The text inside the button.
aHelpText The text for the tooltip.
aButtonFlags The flags for the button.
aStateFlags The flags for the first state.
static IMPORT_C CAknButton* CAknButton::NewL const TInt  aResourceId  )  [static]
 

Two-phased constructor.

Constructs the button from resources.

Parameters:
aResourceId is the ID for this component's resource.

Reimplemented in CAknToolbarExtension.

static IMPORT_C CAknButton* CAknButton::NewL TResourceReader &  aReader  )  [static]
 

Two-phased constructor.

Constructs the button from resources.

Parameters:
aReader is the resource reader with which to access the control's resource values.
static IMPORT_C CAknButton* CAknButton::NewL  )  [static]
 

Two-phased constructor.

Constructs an empty button.

Reimplemented in CAknToolbarExtension.

static IMPORT_C CAknButton* CAknButton::NewLC const TDesC &  aFilePath,
const TInt  aBmpId,
const TInt  aMaskId,
const TInt  aDimmedBmpId,
const TInt  aDimmedMaskId,
const TInt  aPressedBmpId,
const TInt  aPressedMaskId,
const TInt  aHoverBmpId,
const TInt  aHoverMaskId,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aButtonFlags,
const TInt  aStateFlags,
const TAknsItemID aId = KAknsIIDNone,
const TAknsItemID aDimmedId = KAknsIIDNone,
const TAknsItemID aPressedId = KAknsIIDNone,
const TAknsItemID aHoverId = KAknsIIDNone
[static]
 

Two-phased constructor.

Constructs one state button.

Parameters:
aFilePath The path to the file which contains icons.
aBmpId The bitmap ID for the normal state icon.
aMaskId The mask ID for the normal state icon.
aDimmedBmpId The bitmap ID for the dimmed state icon.
aDimmedMaskId The mask ID for the dimmed state icon.
aPressedBmpId The bitmap ID for the pressed down state.
aPressedMaskId The mask ID for the pressed down state.
aHoverBmpId The bitmap ID for the hover state.
aHoverMaskId The mask ID for the hover state.
aText The text inside the button.
aHelpText The text for the tooltip.
aButtonFlags The flags for the button.
aStateFlags The flags for the first state.
aId Item ID of the masked bitmap to be created for skin specific icon.
aDimmedId Item ID of the dimmed masked bitmap to be created for skin specific icon.
aPressedId Item ID of the pressed masked bitmap to be created for skin specific icon.
aHoverId Item ID of the hover state masked bitmap to be created for skin specific icon.
static IMPORT_C CAknButton* CAknButton::NewLC CGulIcon *  aIcon,
CGulIcon *  aDimmedIcon,
CGulIcon *  aPressedIcon,
CGulIcon *  aHoverIcon,
const TDesC &  aText,
const TDesC &  aHelpText,
const TInt  aFlags,
const TInt  aStateFlags
[static]
 

Two-phased constructor.

Constructs one state button.

Parameters:
aIcon The icon for the normal state. Takes ownership.
aDimmedIcon The icon for the dimmed state. Takes ownership.
aPressedIcon The icon for the pressed down. Takes ownership.
aHoverIcon The icon for the hover state. Takes ownership.
aText The text inside the button.
aHelpText The text for the tooltip.
aButtonFlags The flags for the button.
aStateFlags The flags for the first state.
static IMPORT_C CAknButton* CAknButton::NewLC const TInt  aResourceId  )  [static]
 

Two-phased constructor.

Constructs the button from resources.

Parameters:
aResourceId is the ID for this component's resource.

Reimplemented in CAknToolbarExtension.

static IMPORT_C CAknButton* CAknButton::NewLC TResourceReader &  aReader  )  [static]
 

Two-phased constructor.

Constructs the button from resources.

Parameters:
aReader is the resource reader with which to access the control's resource values.
static IMPORT_C CAknButton* CAknButton::NewLC  )  [static]
 

Two-phased constructor.

Constructs an empty button.

IMPORT_C TKeyResponse CAknButton::OfferKeyEventL const TKeyEvent &  aKeyEvent,
TEventCode  aType
 

Handles key events.

Parameters:
aKeyEvent The key event.
aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown.

Reimplemented in CAknToolbarExtension.

virtual IMPORT_C void CAknButton::PositionChanged  )  [virtual]
 

Responds to changes in the position of a control.

IMPORT_C void CAknButton::PrepareForFocusGainL  ) 
 

Prepares the control for gaining focus.

Must be used before calling SetFocus() function in case when help note should be shown.

IMPORT_C void CAknButton::PrepareForFocusLossL  ) 
 

This function is called by the dialog framework immediately before it removes keyboard focus from a control within a dialog.

Currently has empty implementation.

void CAknButton::RegisterResourceProvider CAknResourceProvider *  aProvider  ) 
 

Registers resource provider.

Parameters:
aProvider New resource provider.
void CAknButton::RemoveCurrentState  ) 
 

Removes the currently active state from the button, and sets the current state to the previous one.

IMPORT_C void CAknButton::ResetState  ) 
 

Resets button to unpressed state.

Since:
S60 5.0
IMPORT_C void CAknButton::SetBackgroundIds const TAknsItemID aBackgroundId,
const TAknsItemID aLatchedBackgroundId,
const TAknsItemID aDimmedBackgroundId,
const TAknsItemID aPressedBackgroundId,
const TAknsItemID aLatchedDimmedBackgroundId
 

Sets specified background IDs.

Can be used when default frame is not suitable and the backgound is composed of only single image instead of frame and center. SetFrameAndCenterIds() function can also be used for this purpose by giving the same backround ID for both frame and center. This allows also some of the states to be composed of frames and the others from single backgound images. Use KAknsIIDNone value in case when some backgound drawing is not needed or KAknsIIDDefault when the default button frame should be used.

Parameters:
aBackgroundId The item ID of the entire frame.
aLatchedBackgroundId The item ID of the background for the button in latched state.
aDimmedBackgroundId The item ID of the background for the button in dimmed state.
aPressedBackgroundId The item ID of the background for the button in pressed state.
aLatchedDimmedBackgroundId The item ID of the background for the button in latched and dimmed state.
IMPORT_C void CAknButton::SetButtonFlags const TInt  aFlags  ) 
 

Sets the button flags.

Parameters:
aFlags which can be combination of: KAknButtonTextLeft, KAknButtonSizeFitText, KAknButtonNoFrame, KAknButtonKeyRepeat, KAknButtonReportOnKeyDown, KAknButtonNoFramePressEvent, KAknButtonRequestExitOnButtonUpEvent, KAknButtonReportOnLongPress.
virtual IMPORT_C void CAknButton::SetCurrentState const TInt  aStateIndex,
const TBool  aDrawNow
[virtual]
 

Sets button state.

Parameters:
aStateIndex The index for the state, starts from 0.
aDrawNow ETrue to redraw the button.
IMPORT_C void CAknButton::SetDimmed TBool  aDimmed  ) 
 

Sets button dimmed.

Does not redraw the button. Note: This function does not affect the flag set with function CCoeControl::SetDimmed(), since button needs to get pointer events, even if it is dimmed. The value of the flag can be enquired using CAknButotn::IsDimmed().

Parameters:
aDimmed is ETrue to dim the button, EFalse to set the button as not dimmed.
IMPORT_C void CAknButton::SetDimmedHelpTextL const TDesC &  aHelpText  ) 
 

Sets the help text for dimmed button.

Parameters:
aHelpText The text inside the tooltip.
IMPORT_C void CAknButton::SetFrameAndCenterIds const TAknsItemID aFrameId,
const TAknsItemID aCenterId,
const TAknsItemID aLatchedFrameId,
const TAknsItemID aLatchedCenterId,
const TAknsItemID aDimmedFrameId,
const TAknsItemID aDimmedCenterId,
const TAknsItemID aPressedFrameId,
const TAknsItemID aPressedCenterId,
const TAknsItemID aLatchedDimmedFrameId,
const TAknsItemID aLatchedDimmedCenterId
 

Sets specified frame IDs.

Can be used when default frame is not suitable. Use KAknsIIDNone value in case when some frame or center drawing is not needed or KAknsIIDDefault when the default button frame should be used.

Parameters:
aFrameId The item ID of the entire frame.
aCenterId The item ID of the center part of the frame.
aLatchedFrameId The item ID of the entire frame for button in latched state.
aLatchedCenterId The item ID of the center part of the frame for button in latched state.
aDimmedFrameId The item ID of the entire frame for a button in dimmed state.
aDimmedCenterId The item ID of the center part of the frame for a button in dimmed state.
aPressedFrameId The item ID of the entire frame for a button in pressed state.
aPressedCenterId is the item ID of the center part of the frame for a button in pressed state.
aLatchedDimmedFrameId The item ID of the entire frame for a button in latched and dimmed state.
aLatchedDimmedCenterId The item ID of the center part of the frame for a button in latched and dimmed state.
IMPORT_C void CAknButton::SetHelpNoteTimeouts const TInt  aBeforeTimeout,
const TInt  aInViewTimeout
 

Sets the delay before the help text is shown and also specifies the time for how long help text is visible.

Parameters:
aBeforeTimeout The delay in milliseconds before text help note is shown. The default is 150 milliseconds.
aInViewTimeout The interval in milliseconds during which help text note is shown. The default is 3000 milliseconds.
IMPORT_C void CAknButton::SetHighlightRect const TRect &  aRect  ) 
 

It will change the default highlight rectangle around the focused button.

Parameters:
aRect The highlight rectangle.
IMPORT_C void CAknButton::SetIconHorizontalAlignment const CAknButton::TAlignment  aHorizontalAlignment  ) 
 

Sets the horizontal alignment for the icon inside the button.

By default it will be centered.

Parameters:
aHorizontalAlignment The horizontal alignment for the icon.
IMPORT_C void CAknButton::SetIconScaleMode const TScaleMode  aScaleMode  ) 
 

Sets the scale mode for the icon inside the button.

The default is EAspectRatioNotPreserved.

Parameters:
aScaleMode The scale mode.
IMPORT_C TInt CAknButton::SetIconSize const TSize &  aSize  ) 
 

Sets icon size for the button.

Calling this function overrides the default size that is scaled automatically depending on the current screen layout. If this function is called then the caller is responsible for updating icon size whenever the layout changes.

Since:
S60 3.2
Parameters:
aSize New icon size.
Returns:
KErrNone if the operation succeeded, otherwise an error code.
IMPORT_C void CAknButton::SetIconVerticalAlignment const CAknButton::TAlignment  aVerticalAlignment  ) 
 

Sets the vertical alignment for the icon inside the button.

By default it will be centered.

Parameters:
aVerticalAlignment The vertical alignment for the icon.
IMPORT_C void CAknButton::SetKeyRepeatInterval const TInt  aKeyRepeatDelay,
const TInt  aKeyRepeatInterval
 

Sets the interval for key repeat.

Parameters:
aKeyRepeatDelay The initial delay, after which the key repeat is started. The default is 500 milliseconds.
aKeyRepeatInterval The interval in milliseconds, in which key repeat events should be reported. The default is 500 milliseconds.
IMPORT_C void CAknButton::SetLongPressInterval const TInt  aLongPressInterval  ) 
 

Sets the interval for long press.

When KAknButtonReportOnLongPress flag is set for the button, button will notify observer with KAknButtonLongPressEvent as the event type, after button has been pressed for the specified time.

Parameters:
aLongPressInterval The time interval in milliseconds, after which the long press event should be reported. The default value is 800 milliseconds.
IMPORT_C void CAknButton::SetMargins const TMargins8 &  aMargins  ) 
 

Sets button's margins.

These define the free area inside the button where content is placed. Note that calling this function overrides default margins that are scaled automatically depending on the current screen layout. If this function is called then the caller is responsible for updating margins whenever the layout changes.

Since:
S60 3.2
Parameters:
aMargins New marginals.
IMPORT_C void CAknButton::SetRequestExit const TBool  aRequestExit  ) 
 

Sets whether button should send an EEventRequestExit event to command observer on button up event.

Parameters:
aRequestExit ETrue if button should request exit.
IMPORT_C void CAknButton::SetTextAndIconAlignment const CAknButton::TTextAndIconAlignment  aAlignment  ) 
 

Sets the icon and text alignment for a button having both.

Parameters:
aAlignment. TTextAndIconAlignment
IMPORT_C void CAknButton::SetTextColorIds const TAknsItemID aTextColorTableId,
const TInt  aTextColorIndex
 

Sets the color table and color index for the button text.

It will be used on button drawing, if color of the text shouldn't be taken from text layout.

Parameters:
aTextColorTableId Id for the color table
aTextColorIndex Index of the color inside color table.
IMPORT_C void CAknButton::SetTextFont const CFont *  aFont  ) 
 

Sets some specific text font.

Parameters:
aFont The font, which should be used for the text inside the text button.
IMPORT_C void CAknButton::SetTextHorizontalAlignment const CGraphicsContext::TTextAlign  aHorizontalAlignment  ) 
 

Sets the horizontal alignment for the text inside the button.

It will be used, if alignment shouldn't be taken from text layout. By default it will be centered.

Parameters:
aHorizontalAlignment The horizontal alignment for the text.
IMPORT_C void CAknButton::SetTextUnderlineStyle TFontUnderline  aUnderlineStyle  ) 
 

Sets the text underline style for the text inside the button.

By default no underline is used.

Parameters:
aUnderlineStyle The style of underline.
IMPORT_C void CAknButton::SetTextVerticalAlignment const CAknButton::TAlignment  aVerticalAlignment  ) 
 

Sets the vertical alignment for the text inside the button.

It will be used if alignment shouldn't be taken from text layout. By default it will be centered.

Parameters:
aVerticalAlignment The vertical alignment for the text.
IMPORT_C void CAknButton::SetTooltipPosition const TTooltipPosition  aPosition  ) 
 

Sets the tooltip position.

Parameters:
aPosition The position of the tooltip.
IMPORT_C void CAknButton::ShowHelpL  )  [protected]
 

Shows help text for a certain period of time.

IMPORT_C void CAknButton::SizeChanged  )  [protected]
 

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

IMPORT_C CAknButtonState* CAknButton::State const TInt  aStateIndex  )  const
 

Returns the state of the button under specified index.

Parameters:
aStateIndex The index for the state.
Returns:
the state of the button.
IMPORT_C CAknButtonState* CAknButton::State  )  const
 

Returns the current state of the button.

Returns:
the current state of the button
IMPORT_C TInt CAknButton::StateIndex  )  const
 

Returns the index of the button state.

TRect CAknButton::TouchArea  )  const
 

Returns the button touchable area.

Since:
S60 5.0
Returns:
Button touch area
void CAknButton::UnregisterResourceProvider  ) 
 

Unregisters resource provider.

void CAknButton::UseMaskedDraw TBool  aMaskedDraw  ) 
 

Sets button to use additional masks during drawing.

Calling this method forces button to bypass the normal drawing routine i.e. method DrawMaskedL is executed instead of Draw.

Since:
S60 5.0
Parameters:
aMaskedDraw ETrue to use additional mask.
TBool CAknButton::UsesDefaultMargins  )  const
 

Checks if the button uses default margins.

Since:
S60 3.2
Returns:
ETrue if default margins are used.

Field Documentation

CAknsFrameBackgroundControlContext* CAknButton::iBgContext [protected]
 
TBool CAknButton::iButtonPressed [protected]
 
HBufC* CAknButton::iDimmedHelpText [protected]
 
TInt CAknButton::iFlags [protected]
 
const CFont* CAknButton::iFont [protected]
 
CAknInfoPopupNoteController* CAknButton::iHelpNote [protected]
 
TInt CAknButton::iHelpNoteInViewInterval [protected]
 
TInt CAknButton::iHelpNoteWaitInterval [protected]
 
TRect CAknButton::iHighlightRect [protected]
 
CGraphicsContext::TTextAlign CAknButton::iHorizontalAlignment [protected]
 
TBool CAknButton::iKeyDownReported [protected]
 
TInt CAknButton::iKeyRepeatDelay [protected]
 
TInt CAknButton::iKeyRepeatInterval [protected]
 
CPeriodic* CAknButton::iKeyRepeatTimer [protected]
 
TInt CAknButton::iNumberOfDragEvents [protected]
 
TScaleMode CAknButton::iScaleMode [protected]
 
TBool CAknButton::iShowHelp [protected]
 
TInt CAknButton::iStateIndex [protected]
 
CArrayPtrFlat<CAknButtonState>* CAknButton::iStates [protected]
 
TInt CAknButton::iTextColorIndex [protected]
 
TAknsItemID CAknButton::iTextColorTableId [protected]
 
TAlignment CAknButton::iVerticalAlignment [protected]
 

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

Copyright © Nokia Corporation 2001-2007
Back to top