CAknSlider Class Reference

API published in: S60 1st Ed

Link against: avkon.lib

Capability Information

Required Capabilities

None


#include <aknslider.h>

Inherits CEikBorderedControl.


Public Types

enum   {
  EElemEmptyLeftCap, EElemEmptyRightCap, EElemEmptyLine, EElemFilledLine,
  EElemFilledLeftCap, EElemFilledRightCap, EElemMarker, EElemTickMark,
  EElemMarkerSelected
}
  Elements that currently support custom graphics. More...
enum   { EPosFilling = 0x01, EPosMarker = 0x02 }
  Supported slider position indicators. More...

Public Member Functions

IMPORT_C  CAknSlider ()
  Default Constructor.
IMPORT_C  ~CAknSlider ()
  Destructor.
IMPORT_C void  SetValueL (TInt aValue)
  Sets the value of the slider control and also updates the iValueLabel text.
IMPORT_C TInt  Value () const
  Returns the value of the slider control.
IMPORT_C void  SetRange (TInt aMinimumValue, TInt aMaximumValue)
  Sets the range of the slider control.
IMPORT_C void  GetRange (TInt &aMinimumValue, TInt &aMaximumValue)
  Gets the range of the slider control.
IMPORT_C void  SetStepSize (TInt aStepSize)
  Sets the step size.
IMPORT_C void  SetMinimumTextL (const TDesC &aText)
  Sets the text to the minimum label.
IMPORT_C void  SetMaximumTextL (const TDesC &aText)
  Sets the text to the maximum label.
IMPORT_C void  SetDecimalPlaces (TInt aDecimalPlaces)
  Sets the value of decimal places.
IMPORT_C TInt  DecimalPlaces () const
  Returns the value of decimal place.
IMPORT_C void  SetGraphics (TInt aElement, CFbsBitmap *aBitmap, CFbsBitmap *aMask)
  Allows setting custom graphics for a certain slider element.
IMPORT_C void  UseDefaultGraphics (TInt aElement)
  Makes an element to use default graphics.
IMPORT_C TBool  UsesDefaultGraphics (TInt aElement) const
  Queries whether some element is using default graphics.
IMPORT_C void  SetPositionIndicators (TUint32 aFlags)
  Configures line position indicators, which display the slider's current position.
IMPORT_C TUint32  PositionIndicators () const
  Queries the current status of position indicators.
IMPORT_C TAknOrientation  Orientation () const
  Queries the current orientation status.
IMPORT_C void  SetTicksEnabled (TBool aStatus)
  Enables/disables the tick marks.
IMPORT_C TBool  TicksEnabled () const
  Queries the current tick mark status.
IMPORT_C void  SetTickInterval (TUint aInterval)
  Sets the tick interval used for drawing the tick marks.
IMPORT_C TUint  TickInterval () const
  Queries the current tick interval value.
IMPORT_C void  EnableDrag ()
  Call CCoeControl::EnableDragEvents().
TSize  MinimumSize ()
  From CCoeControl, returns the size of the control.
TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
  From CCoeControl, Handles key event.
IMPORT_C void  ConstructFromResourceL (TResourceReader &aReader)
  From CCoeControl, essential for Dialog/Form construction.
IMPORT_C void  ConstructFromResourceL (CCoeControl *aParent, TInt aValue, TResourceReader &aReader)
  This function is used for constructing the control.
IMPORT_C void  HandleResourceChange (TInt aType)
  This function toggles between edit and view modes.
IMPORT_C TInt  NumberOfLines () const
  This function is used specifically in the forms.
IMPORT_C void  HandlePointerEventL (const TPointerEvent &aPointerEvent)
  From CCoeControl.

Static Public Member Functions

static IMPORT_C CFbsBitmap *  CreateBitmapL (TInt aValue, TInt aResourceId)
  Returns slider bitmap to "list pane for setting item" (setting option item slider graphic).
static IMPORT_C CFbsBitmap *  CreateBitmapL (TInt aValue, TInt aMinimumValue, TInt aMaximumValue)
  Returns slider bitmap to "list pane for setting item" (setting option item slider graphic).
static IMPORT_C CGulIcon *  CreateSetStyleListBoxIconL (TInt aValue, TInt aResourceId)
  Returns slider icon to "list pane for setting item" (setting option item slider graphic).
static IMPORT_C CGulIcon *  CreateSetStyleListBoxIconL (TInt aValue, TInt aMinimumValue, TInt aMaximumValue)
  Returns slider icon to "list pane for setting item" (setting option item slider graphic).
static IMPORT_C HBufC *  CreateValueTextInHBufCL (TInt aValue, TInt aResourceId)
  This routine can be used to combine the resource for a Slider with a value to get the same value text that you would get if you had the instantiated control.

Protected Member Functions

void  SizeChanged ()
  From CCoeControl, Called by framework when the view size is changed.
void  Draw (const TRect &aRect) const
  From CCoeControl, Drawing function which draws the control.
virtual IMPORT_C TInt  CountComponentControls () const
  From CCoeControl, Returns number of components.
virtual IMPORT_C CCoeControl *  ComponentControl (TInt aIndex) const
  From CCoeControl, Returns pointer to particular component.
IMPORT_C void  SetValueTextL ()
  Sets the text to the value label.

Member Enumeration Documentation

anonymous enum
 

Elements that currently support custom graphics.

Enumerator:
EElemEmptyLeftCap  Left cap component of the slider, without filling.

Left cap equals to bottom cap in vertical layout.

EElemEmptyRightCap  Right cap component of the slider, without filling.

Right cap equals to top cap in vertical layout.

EElemEmptyLine  Line component of the slider, without filling.
EElemFilledLine  Line component of the slider, with filling.
EElemFilledLeftCap  Left cap component of the slider, with filling.
EElemFilledRightCap  Right cap component of the slider, with filling.
EElemMarker  Marker component of the slider.
EElemTickMark  Tick mark component of the slider.

Small evenly spaced lines, placed vertically in relation to slider itself.

EElemMarkerSelected  Marker component of the slider when dragged.
anonymous enum
 

Supported slider position indicators.

Enumerator:
EPosFilling  Flag for enabling/disabling line filling.

With line filling different graphics will be used for the the slider line's left and right sides (the current marker position as pivot). The left side is considered filled line and the right side empty line.

When line filling is enabled the graphics element EElemFilledLine is used for the left side and EElemEmptyLine for the right. If line filling is disabled EElemEmptyLine is used for the whole line.

EPosMarker  Flag for enabling/disabling line marker (the knob).

While disabled marker is not visible, the marker area will still be used for touch input.


Constructor & Destructor Documentation

IMPORT_C CAknSlider::CAknSlider  ) 
 

Default Constructor.

IMPORT_C CAknSlider::~CAknSlider  ) 
 

Destructor.


Member Function Documentation

virtual IMPORT_C CCoeControl* CAknSlider::ComponentControl TInt  aIndex  )  const [protected, virtual]
 

From CCoeControl, Returns pointer to particular component.

Parameters:
aIndex  Index whose control's pointer has to returned.
Returns:
Pointer to component control
IMPORT_C void CAknSlider::ConstructFromResourceL CCoeControl *  aParent,
TInt  aValue,
TResourceReader &  aReader
 

This function is used for constructing the control.

Parameters:
aParent  Pointer to the parent control. aValue Current value of the slider control.
aReader  which reads the values specified in the resource file.
IMPORT_C void CAknSlider::ConstructFromResourceL TResourceReader &  aReader  ) 
 

From CCoeControl, essential for Dialog/Form construction.

Parameters:
aReader  which reads the values specified in the resource file
virtual IMPORT_C TInt CAknSlider::CountComponentControls  )  const [protected, virtual]
 

From CCoeControl, Returns number of components.

Returns:
Number of component controls
static IMPORT_C CFbsBitmap* CAknSlider::CreateBitmapL TInt  aValue,
TInt  aMinimumValue,
TInt  aMaximumValue
[static]
 

Returns slider bitmap to "list pane for setting item" (setting option item slider graphic).

Ownership of the returned bitmap is transfered to the caller.

Parameters:
aValue  Current value
aMinimumValue  Slider minimum value
aMaximumValue  Slider maximum value
Returns:
Slider bitmap. Ownership of the bitmap is transfered to the caller
static IMPORT_C CFbsBitmap* CAknSlider::CreateBitmapL TInt  aValue,
TInt  aResourceId
[static]
 

Returns slider bitmap to "list pane for setting item" (setting option item slider graphic).

Ownership of the returned bitmap is transfered to the caller.

Parameters:
aValue  Current value
aResourceId  Slider resource that contains minimum and maximum values
Returns:
Slider bitmap. Ownership of the bitmap is transfered to the caller.
static IMPORT_C CGulIcon* CAknSlider::CreateSetStyleListBoxIconL TInt  aValue,
TInt  aMinimumValue,
TInt  aMaximumValue
[static]
 

Returns slider icon to "list pane for setting item" (setting option item slider graphic).

Ownership of the returned icon is transfered to the caller.

Parameters:
aValue  Current value
aMinimumValue  Slider minimum value
aMaximumValue  Slider maximum value
Returns:
Slider bitmap. Ownership of the icon is transfered to the caller
static IMPORT_C CGulIcon* CAknSlider::CreateSetStyleListBoxIconL TInt  aValue,
TInt  aResourceId
[static]
 

Returns slider icon to "list pane for setting item" (setting option item slider graphic).

Ownership of the returned icon is transfered to the caller.

Parameters:
aValue  Current value
aResourceId  Slider resource that contains minimum and maximum values
Returns:
Slider icon. Ownership of the icon is transfered to the caller
static IMPORT_C HBufC* CAknSlider::CreateValueTextInHBufCL TInt  aValue,
TInt  aResourceId
[static]
 

This routine can be used to combine the resource for a Slider with a value to get the same value text that you would get if you had the instantiated control.

Parameters:
aValue  The value to format
aResourceId  AKN_SLIDER resource id
Returns:
Transfer of ownership of descriptor containing the value text
IMPORT_C TInt CAknSlider::DecimalPlaces  )  const
 

Returns the value of decimal place.

Returns:
the value of decimal place.
void CAknSlider::Draw const TRect &  aRect  )  const [protected]
 

From CCoeControl, Drawing function which draws the control.

Parameters:
aRect  Specified area to be drawn

Reimplemented from CEikBorderedControl.

IMPORT_C void CAknSlider::EnableDrag  ) 
 

Call CCoeControl::EnableDragEvents().

IMPORT_C void CAknSlider::GetRange TInt &  aMinimumValue,
TInt &  aMaximumValue
 

Gets the range of the slider control.

Maximum value must be greater than the minimum value, or the method will Panic.

Parameters:
aMinimumValue  The minimum value of the slider control
aMaximumValue  The maximum value of the slider control
IMPORT_C void CAknSlider::HandlePointerEventL const TPointerEvent &  aPointerEvent  ) 
 

From CCoeControl.

Handles pointer event

Parameters:
aPointerEvent  Pointer event to be handled

Reimplemented from CEikBorderedControl.

IMPORT_C void CAknSlider::HandleResourceChange TInt  aType  ) 
 

This function toggles between edit and view modes.

Parameters:
aType  Specifies the mode.

Reimplemented from CEikBorderedControl.

TSize CAknSlider::MinimumSize  ) 
 

From CCoeControl, returns the size of the control.

And yes, this method is non-const.

Returns:
size of the control
IMPORT_C TInt CAknSlider::NumberOfLines  )  const
 

This function is used specifically in the forms.

(For Forms/Dialogs to use with LAF) Returns the number of lines on the control.

Returns:
Number of lines
TKeyResponse CAknSlider::OfferKeyEventL const TKeyEvent &  aKeyEvent,
TEventCode  aType
 

From CCoeControl, Handles key event.

Parameters:
aKeyEvent  The key event.
aType  The type of the event.
Returns:
Indicates whether the key event was used by this control or not
IMPORT_C TAknOrientation CAknSlider::Orientation  )  const
 

Queries the current orientation status.

Returns:
The current orientation, see TAknOrientation.
IMPORT_C TUint32 CAknSlider::PositionIndicators  )  const
 

Queries the current status of position indicators.

Returns:
Bitmask containing flags as defined in EPositionIndicator
IMPORT_C void CAknSlider::SetDecimalPlaces TInt  aDecimalPlaces  ) 
 

Sets the value of decimal places.

The legal range is 0 - 9 inclusive.

Parameters:
aDecimalPlaces  The value of the decimal place
IMPORT_C void CAknSlider::SetGraphics TInt  aElement,
CFbsBitmap *  aBitmap,
CFbsBitmap *  aMask
 

Allows setting custom graphics for a certain slider element.

Existing icons (custom or default) for the element are discarded. Note that some elements might not be visible until the corresponding functionality is enabled, see SetPositionIndicators and SetTicksEnabled.

Slider takes care of scaling the given icons to the correct size, provided that they have been created with AknIconUtils or AknsUtils interfaces. It also handles re-scaling the icons if the slider layout changes.

If the custom icons are created by using skin items (e.g. using color from skin), remember to change the icons whenever skin changes, see CCoeControl::HandleResourceChange. In addition, note that slider can be with horizontal or vertical layout,

See also:
Orientation
Parameters:
aElement  The element ID to which the icons are assigned, one of TGfxElements.
aBitmap  The icon used for the element, must be non-NULL, ownership is transferred to slider.
aMask  Optional mask for the aBitmap, can be NULL, ownership is transferred to slider.
Exceptions:
Will panic with EAknPanicInvalidValue if the element ID is invalid or aBitmap is NULL.
IMPORT_C void CAknSlider::SetMaximumTextL const TDesC &  aText  ) 
 

Sets the text to the maximum label.

Parameters:
aText  The text passed is set to the maximum label
IMPORT_C void CAknSlider::SetMinimumTextL const TDesC &  aText  ) 
 

Sets the text to the minimum label.

Parameters:
aText  The text passed is set to the minimum label
IMPORT_C void CAknSlider::SetPositionIndicators TUint32  aFlags  ) 
 

Configures line position indicators, which display the slider's current position.

Possible indicators are defined in EPositionIndicator, at least one of them must be defined (to display some position information). Multiple values can be enabled by using bitwise or, e.g. EPosFilling | EPosMarker. The new flags will fully override the old values. The default value is EPosMarker.

Parameters:
aFlags  Bitmask containing flags from EPositionIndicator. At least one flag should be set.
Exceptions:
If none of the flags in EPositionIndicator is set, the code defaults silently to EPosMarker.
IMPORT_C void CAknSlider::SetRange TInt  aMinimumValue,
TInt  aMaximumValue
 

Sets the range of the slider control.

Maximum value must be greater than the minimum value, or the method will Panic.

Parameters:
aMinimumValue  The minimum value of the slider control
aMaximumValue  The maximum value of the slider control
IMPORT_C void CAknSlider::SetStepSize TInt  aStepSize  ) 
 

Sets the step size.

The step size must divide evenly into the Range. This routine should be called after SetRange if either is called.

Parameters:
aStepSize  The value of the step size
IMPORT_C void CAknSlider::SetTickInterval TUint  aInterval  ) 
 

Sets the tick interval used for drawing the tick marks.

Tick interval is in the slider range units (not in pixels). If interval value is set to 0, the slider step size is used as tick interval, see SetStepSize. The default interval value is 0.

Parameters:
aInterval  The value set as tick interval, always >= 0.
IMPORT_C void CAknSlider::SetTicksEnabled TBool  aStatus  ) 
 

Enables/disables the tick marks.

Tick marks are disabled by default. Enabling tick marks affects only the visual appearance of slider. That is, enabling slider step handling is not changed.

Parameters:
aStatus  ETrue to enable tick marks, EFalse to disable.
IMPORT_C void CAknSlider::SetValueL TInt  aValue  ) 
 

Sets the value of the slider control and also updates the iValueLabel text.

There are the following constraints on the value: it must be within the current range, it must be at a value that is minimum + N * stepsize. If these are not both true, then the method will Panic

Parameters:
aValue  Sets the value of the slider.
IMPORT_C void CAknSlider::SetValueTextL  )  [protected]
 

Sets the text to the value label.

void CAknSlider::SizeChanged  )  [protected]
 

From CCoeControl, Called by framework when the view size is changed.

IMPORT_C TUint CAknSlider::TickInterval  )  const
 

Queries the current tick interval value.

Returns:
Current tick interval, always >= 0.
IMPORT_C TBool CAknSlider::TicksEnabled  )  const
 

Queries the current tick mark status.

Returns:
ETrue if tick marks are enabled, EFalse otherwise.
IMPORT_C void CAknSlider::UseDefaultGraphics TInt  aElement  ) 
 

Makes an element to use default graphics.

Possible custom graphics for the element is discarded.

Parameters:
aElement  The element ID which should use default graphics, one of TGfxElements.
Exceptions:
Will panic with EAknPanicInvalidValue if the element index is invalid.
IMPORT_C TBool CAknSlider::UsesDefaultGraphics TInt  aElement  )  const
 

Queries whether some element is using default graphics.

Parameters:
aElement  The element ID which should use default graphics, one of TGfxElements.
Returns:
ETrue if default graphics is used for the element, EFalse otherwise (custom graphics used).
Exceptions:
Will panic with EAknPanicInvalidValue if the element index is invalid.
IMPORT_C TInt CAknSlider::Value  )  const
 

Returns the value of the slider control.

Returns:
Slider value.

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

Copyright © Nokia Corporation 2001-2008
Back to top