williamr@2: /*
williamr@2: * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: * All rights reserved.
williamr@2: * This component and the accompanying materials are made available
williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2: * which accompanies this distribution, and is available
williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2: *
williamr@2: * Initial Contributors:
williamr@2: * Nokia Corporation - initial contribution.
williamr@2: *
williamr@2: * Contributors:
williamr@2: *
williamr@2: * Description:  Slider editor class
williamr@2: *
williamr@2: */
williamr@2: 
williamr@2: 
williamr@2: #ifndef __AKNSLIDER_H__
williamr@2: #define __AKNSLIDER_H__
williamr@2: 
williamr@2: // INCLUDES
williamr@2: #include <eikbctrl.h>
williamr@2: #include <eiklabel.h>
williamr@2: #include <eikimage.h>
williamr@2: #include <avkon.hrh> // For TAknOrientation
williamr@2: 
williamr@2: // CONSTANTS
williamr@2: 
williamr@2: // The following is max. length of the entire formatted value text including
williamr@2: // number, special characters and supplied text.
williamr@2: const TInt KValueLabelTextMaxLength = 30;
williamr@2: 
williamr@2: // Forward declarations
williamr@2: class CGulIcon;
williamr@2: class MAknsSkinInstance;
williamr@2: class CAknSliderExtension;
williamr@2: class CAknSliderData;
williamr@2: struct TAknSliderGfx;
williamr@2: 
williamr@2: // CLASS DECLARATION
williamr@2: class CAknSlider : public CEikBorderedControl
williamr@2:     {
williamr@2: public: // Enumerations
williamr@2:     /**
williamr@2:     * Elements that currently support custom graphics.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     enum TSliderGfxElements
williamr@2:         {
williamr@2:         /**
williamr@2:         * Left cap component of the slider, without filling. Left cap equals
williamr@2:         * to bottom cap in vertical layout.
williamr@2:         */
williamr@2:         EElemEmptyLeftCap,
williamr@2: 
williamr@2:         /**
williamr@2:         * Right cap component of the slider, without filling. Right cap equals
williamr@2:         * to top cap in vertical layout.
williamr@2:         */
williamr@2:         EElemEmptyRightCap,
williamr@2:         
williamr@2:         /**
williamr@2:         * Line component of the slider, without filling.
williamr@2:         */
williamr@2:         EElemEmptyLine,
williamr@2:         
williamr@2:         /**
williamr@2:         * Line component of the slider, with filling.
williamr@2:         */
williamr@2:         EElemFilledLine,
williamr@2:         
williamr@2:         /**
williamr@2:         * Left cap component of the slider, with filling.
williamr@2:         */
williamr@2:         EElemFilledLeftCap,
williamr@2:         
williamr@2:         /**
williamr@2:         * Right cap component of the slider, with filling.
williamr@2:         */
williamr@2:         EElemFilledRightCap,
williamr@2:         
williamr@2:         /**
williamr@2:         * Marker component of the slider.
williamr@2:         */
williamr@2:         EElemMarker,
williamr@2:         
williamr@2:         /**
williamr@2:         * Tick mark component of the slider. Small evenly spaced lines,
williamr@2:         * placed vertically in relation to slider itself.
williamr@2:         */
williamr@2:         EElemTickMark,
williamr@2: 
williamr@2:         /**
williamr@2:         * Marker component of the slider when dragged
williamr@2:         */
williamr@2:         EElemMarkerSelected
williamr@2:         };
williamr@2: 
williamr@2:     /**
williamr@2:     * Supported slider position indicators.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     enum
williamr@2:         {
williamr@2:         /**
williamr@2:         * Flag for enabling/disabling line filling. With line filling different
williamr@2:         * graphics will be used for the the slider line's left and right sides
williamr@2:         * (the current marker position as pivot). The left side is considered
williamr@2:         * filled line and the right side empty line.
williamr@2:         *
williamr@2:         * When line filling is enabled the graphics element @c EElemFilledLine
williamr@2:         * is used for the left side and @c EElemEmptyLine for the right. If
williamr@2:         * line filling is disabled @c EElemEmptyLine is used for the whole
williamr@2:         * line.
williamr@2:         */
williamr@2:         EPosFilling  = 0x01,
williamr@2:         /**
williamr@2:         * Flag for enabling/disabling line marker (the knob). While disabled
williamr@2:         * marker is not visible, the marker area will still be used for touch
williamr@2:         * input.
williamr@2:         */
williamr@2:         EPosMarker   = 0x02            
williamr@2:         };
williamr@2: 
williamr@2:     /**
williamr@2:     * Event for slider thumb/marker dragging.
williamr@2:     *
williamr@2:     * @since 5.0
williamr@2:     */
williamr@2:     enum
williamr@2:         {
williamr@2:         /**
williamr@2:         * Slider thumb/marker drag start
williamr@2:         */
williamr@2:         EDragMarkerStart  = 1000,
williamr@2:         /**
williamr@2:         * Slider thumb/marker drag end
williamr@2:         */
williamr@2:         EDragMarkerEnd
williamr@2:         };
williamr@2:         
williamr@2: public:
williamr@2:     /**
williamr@2:     * Default Constructor.
williamr@2:     */
williamr@2:     IMPORT_C CAknSlider();
williamr@2: 
williamr@2:     /**
williamr@2:     * Destructor.
williamr@2:     */
williamr@2:     IMPORT_C ~CAknSlider();
williamr@2: 
williamr@2:     /**
williamr@2:     * Sets the value of the slider control and also updates the iValueLabel
williamr@2:     * text. There are the following constraints on the value:
williamr@2:     *    it must be within the current range,
williamr@2:     *    it must be at a value that is minimum + N * stepsize.
williamr@2:     * If these are not both true, then the method will Panic
williamr@2:     *
williamr@2:     * @param aValue Sets the value of the slider.
williamr@2:     */
williamr@2:     IMPORT_C void SetValueL( TInt aValue );
williamr@2: 
williamr@2:     /**
williamr@2:     * Returns the value of the slider control
williamr@2:     *
williamr@2:     * @return Slider value.
williamr@2:     */
williamr@2:     IMPORT_C TInt Value() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Sets the range of the slider control. Maximum value must be greater than
williamr@2:     * the minimum value, or the method will Panic.
williamr@2:     *
williamr@2:     * @param aMinimumValue The minimum value of the slider control
williamr@2:     * @param aMaximumValue The maximum value of the slider control
williamr@2:     */
williamr@2:     IMPORT_C void SetRange( TInt aMinimumValue, TInt aMaximumValue );
williamr@2: 
williamr@2:     /**
williamr@2:     * Gets the range of the slider control. Maximum value must be greater than
williamr@2:     * the minimum value, or the method will Panic.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     * @param aMinimumValue The minimum value of the slider control
williamr@2:     * @param aMaximumValue The maximum value of the slider control
williamr@2:     */
williamr@2:     IMPORT_C void GetRange( TInt& aMinimumValue, TInt& aMaximumValue );
williamr@2:     
williamr@2:     /**
williamr@2:     * Sets the step size. The step size must divide evenly into the Range. This
williamr@2:     * routine should be called after SetRange if either is called.
williamr@2:     *
williamr@2:     * @param aStepSize The value of the step size
williamr@2:     */
williamr@2:     IMPORT_C void SetStepSize( TInt aStepSize );
williamr@2: 
williamr@2:     /**
williamr@2:     * Sets the text to the minimum label.
williamr@2:     *
williamr@2:     * @param aText The text passed is set to the minimum label
williamr@2:     */
williamr@2:     IMPORT_C void SetMinimumTextL( const TDesC& aText );
williamr@2: 
williamr@2:     /**
williamr@2:     * Sets the text to the maximum label.
williamr@2:     *
williamr@2:     * @param aText The text passed is set to the maximum label
williamr@2:     */
williamr@2:     IMPORT_C void SetMaximumTextL( const TDesC& aText );
williamr@2: 
williamr@2:     /**
williamr@2:     * Sets the value of decimal places. The legal range is 0 - 9 inclusive.
williamr@2:     *
williamr@2:     * @param aDecimalPlaces The value of the decimal place
williamr@2:     */
williamr@2:     IMPORT_C void SetDecimalPlaces( TInt aDecimalPlaces );
williamr@2: 
williamr@2:     /**
williamr@2:     * Returns the value of decimal place.
williamr@2:     *
williamr@2:     * @return the value of decimal place.
williamr@2:     */
williamr@2:     IMPORT_C TInt DecimalPlaces() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Allows setting custom graphics for a certain slider element. Existing
williamr@2:     * icons (custom or default) for the element are discarded. Note that some
williamr@2:     * elements might not be visible until the corresponding functionality is
williamr@2:     * enabled, see @c SetPositionIndicators and @c SetTicksEnabled.
williamr@2:     *
williamr@2:     * Slider takes care of scaling the given icons to the correct size,
williamr@2:     * provided that they have been created with @c AknIconUtils or @c AknsUtils
williamr@2:     * interfaces. It also handles re-scaling the icons if the slider layout
williamr@2:     * changes.
williamr@2:     *
williamr@2:     * If the custom icons are created by using skin items (e.g. using color
williamr@2:     * from skin), remember to change the icons whenever skin changes, see
williamr@2:     * @c CCoeControl::HandleResourceChange. In addition, note that slider can
williamr@2:     * be with horizontal or vertical layout, @see Orientation
williamr@2:     *
williamr@2:     * @param aElement The element ID to which the icons are assigned, one of
williamr@2:     *                 @c TGfxElements.
williamr@2:     *
williamr@2:     * @param aBitmap The icon used for the element, must be non-NULL,
williamr@2:     *                ownership is transferred to slider.
williamr@2:     *
williamr@2:     * @param aMask Optional mask for the aBitmap, can be NULL, ownership
williamr@2:     *              is transferred to slider.
williamr@2:     *
williamr@2:     * @par Exceptions:
williamr@2:     *   Will panic with EAknPanicInvalidValue if the element ID is invalid or
williamr@2:     *   aBitmap is NULL.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C void SetGraphics( TInt aElement,
williamr@2:                                CFbsBitmap* aBitmap,
williamr@2:                                CFbsBitmap* aMask );
williamr@2:     
williamr@2:     /**
williamr@2:     * Makes an element to use default graphics. Possible custom graphics for
williamr@2:     * the element is discarded.
williamr@2:     *
williamr@2:     * @param aElement The element ID which should use default graphics, one of
williamr@2:     *                 @c TGfxElements.
williamr@2:     *
williamr@2:     * @par Exceptions:
williamr@2:     *   Will panic with EAknPanicInvalidValue if the element index is invalid.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C void UseDefaultGraphics( TInt aElement );
williamr@2: 
williamr@2:     /**
williamr@2:     * Queries whether some element is using default graphics.
williamr@2:     *
williamr@2:     * @param aElement The element ID which should use default graphics, one of
williamr@2:     *                 @c TGfxElements.
williamr@2:     *
williamr@2:     * @return ETrue if default graphics is used for the element, EFalse
williamr@2:     *         otherwise (custom graphics used).
williamr@2:     *
williamr@2:     * @par Exceptions:
williamr@2:     *   Will panic with EAknPanicInvalidValue if the element index is invalid.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C TBool UsesDefaultGraphics( TInt aElement ) const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Configures line position indicators, which display the slider's current
williamr@2:     * position. Possible indicators are defined in @c EPositionIndicator, at
williamr@2:     * least one of them must be defined (to display some position information).
williamr@2:     * Multiple values can be enabled by using bitwise or, e.g. @c EPosFilling |
williamr@2:     * EPosMarker. The new flags will fully override the old values. The default
williamr@2:     * value is @c EPosMarker.
williamr@2:     *
williamr@2:     * @param aFlags Bitmask containing flags from @c EPositionIndicator. At
williamr@2:     *               least one flag should be set.
williamr@2:     *
williamr@2:     * @par Exceptions:
williamr@2:     *   If none of the flags in @c EPositionIndicator is set, the code defaults
williamr@2:     *   silently to @c EPosMarker.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C void SetPositionIndicators( TUint32 aFlags );
williamr@2:     
williamr@2:    
williamr@2:     /**
williamr@2:     * Queries the current status of position indicators.
williamr@2:     *
williamr@2:     * @return Bitmask containing flags as defined in @c EPositionIndicator
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C TUint32 PositionIndicators() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Queries the current orientation status.
williamr@2:     *
williamr@2:     * @return The current orientation, see @c TAknOrientation.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C TAknOrientation Orientation() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Enables/disables the tick marks. Tick marks are disabled by default.
williamr@2:     * Enabling tick marks affects only the visual appearance of slider. That is,
williamr@2:     * enabling slider step handling is not changed.
williamr@2:     *
williamr@2:     * @param aStatus ETrue to enable tick marks, EFalse to disable.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C void SetTicksEnabled( TBool aStatus );
williamr@2: 
williamr@2:     /**
williamr@2:     * Queries the current tick mark status.
williamr@2:     *
williamr@2:     * @return ETrue if tick marks are enabled, EFalse otherwise.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C TBool TicksEnabled() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Sets the tick interval used for drawing the tick marks. Tick interval is
williamr@2:     * in the slider range units (not in pixels). If interval value is set to 0,
williamr@2:     * the slider step size is used as tick interval, see @c SetStepSize. The
williamr@2:     * default interval value is 0.
williamr@2:     *
williamr@2:     * @param aInterval The value set as tick interval, always >= 0.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C void SetTickInterval( TUint aInterval );
williamr@2: 
williamr@2:     /**
williamr@2:     * Queries the current tick interval value.
williamr@2:     *
williamr@2:     * @return Current tick interval, always >= 0.
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */
williamr@2:     IMPORT_C TUint TickInterval() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * Returns slider bitmap to "list pane for setting item" (setting option
williamr@2:     * item slider graphic). Ownership of the returned bitmap is transfered to
williamr@2:     * the caller.
williamr@2:     *
williamr@2:     * @param aValue Current value
williamr@2:     * @param aResourceId Slider resource that contains minimum and maximum
williamr@2:     *                    values
williamr@2:     * @return Slider bitmap. Ownership of the bitmap is transfered to the
williamr@2:     *         caller.
williamr@2:     */
williamr@2:     IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
williamr@2:                                                TInt aResourceId );
williamr@2: 
williamr@2:     /**
williamr@2:     * Returns slider bitmap to "list pane for setting item" (setting option
williamr@2:     * item slider graphic). Ownership of the returned bitmap is transfered to
williamr@2:     * the caller.
williamr@2:     *
williamr@2:     * @param aValue Current value
williamr@2:     * @param aMinimumValue Slider minimum value
williamr@2:     * @param aMaximumValue Slider maximum value
williamr@2:     * @return Slider bitmap. Ownership of the bitmap is transfered to the
williamr@2:     *         caller
williamr@2:     */
williamr@2:     IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
williamr@2:                                                TInt aMinimumValue,
williamr@2:                                                TInt aMaximumValue );
williamr@2: 
williamr@2:     /**
williamr@2:     * Returns slider icon to "list pane for setting item" (setting option item
williamr@2:     * slider graphic). Ownership of the returned icon is transfered to the
williamr@2:     * caller.
williamr@2:     *
williamr@2:     * @param aValue Current value
williamr@2:     * @param aResourceId Slider resource that contains minimum and maximum
williamr@2:     *                    values
williamr@2:     * @return Slider icon. Ownership of the icon is transfered to the caller
williamr@2:     */
williamr@2:     IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
williamr@2:                                                           TInt aResourceId );
williamr@2: 
williamr@2:     /**
williamr@2:     * Returns slider icon to "list pane for setting item" (setting option item
williamr@2:     * slider graphic). Ownership of the returned icon is transfered to the
williamr@2:     * caller.
williamr@2:     *
williamr@2:     * @param aValue Current value
williamr@2:     * @param aMinimumValue Slider minimum value
williamr@2:     * @param aMaximumValue Slider maximum value
williamr@2:     * @return Slider bitmap. Ownership of the icon is transfered to the caller
williamr@2:     */
williamr@2:     IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
williamr@2:                                                           TInt aMinimumValue,
williamr@2:                                                           TInt aMaximumValue );
williamr@2:     /**
williamr@2:     * Call CCoeControl::EnableDragEvents()
williamr@2:     *
williamr@2:     * @since 3.2
williamr@2:     */                                                      
williamr@2:     IMPORT_C void EnableDrag();
williamr@2: 
williamr@2: public:
williamr@2:     /**
williamr@2:     * From CCoeControl, returns the size of the control. And yes, this method
williamr@2:     * is non-const.
williamr@2:     *
williamr@2:     * @return size of the control
williamr@2:     */
williamr@2:     TSize MinimumSize();
williamr@2: 
williamr@2:     /**
williamr@2:     * From CCoeControl, Handles key event.
williamr@2:     *
williamr@2:     * @param aKeyEvent The key event.
williamr@2:     * @param aType The type of the event.
williamr@2:     * @return Indicates whether the key event was used by this control or not
williamr@2:     */
williamr@2:     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
williamr@2:                                  TEventCode aType );
williamr@2: 
williamr@2:     /**
williamr@2:     * From CCoeControl, essential for Dialog/Form construction.
williamr@2:     *
williamr@2:     * @param aReader which reads the values specified in the resource file
williamr@2:     */
williamr@2:     IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
williamr@2: 
williamr@2:     /**
williamr@2:     * This function is used for constructing the control.
williamr@2:     *
williamr@2:     * @param aParent Pointer to the parent control.
williamr@2:     * @paran aValue Current value of the slider control.
williamr@2:     * @param aReader which reads the values specified in the resource file.
williamr@2:     */
williamr@2:     IMPORT_C void ConstructFromResourceL( CCoeControl* aParent,
williamr@2:                                           TInt aValue,
williamr@2:                                           TResourceReader& aReader );
williamr@2: 
williamr@2:     /**
williamr@2:     * This function toggles between edit and view modes
williamr@2:     *
williamr@2:     * @param aType Specifies the mode.
williamr@2:     */
williamr@2:     IMPORT_C void HandleResourceChange( TInt aType );
williamr@2: 
williamr@2:     /**
williamr@2:      * This function will be called when focus changed.
williamr@2:      *
williamr@2:      * @param aDrawNow if the control needs to call DrawNow().
williamr@2:      */
williamr@2:     IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
williamr@2: 
williamr@2: public:
williamr@2:     /**
williamr@2:     * This function is used specifically in the forms. (For Forms/Dialogs to
williamr@2:     * use with LAF) Returns the number of lines on the control.
williamr@2:     *
williamr@2:     * @return Number of lines
williamr@2:     */
williamr@2:     IMPORT_C TInt NumberOfLines() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * This routine can be used to combine the resource for a Slider with a
williamr@2:     * value to get the same value text that you would get if you had the
williamr@2:     * instantiated control
williamr@2:     *
williamr@2:     * @param aValue The value to format
williamr@2:     * @param aResourceId AKN_SLIDER resource id
williamr@2:     *
williamr@2:     * @return Transfer of ownership of descriptor containing the value text
williamr@2:     */
williamr@2:     IMPORT_C static HBufC* CreateValueTextInHBufCL( TInt aValue,
williamr@2:                                                     TInt aResourceId );
williamr@2:                                                     
williamr@2:     void SuppressDrawing( TBool aSuppress );
williamr@2: 
williamr@2: protected:
williamr@2:     /**
williamr@2:     * From CCoeControl, Called by framework when the view size is changed.
williamr@2:     */
williamr@2:     void SizeChanged();
williamr@2: 
williamr@2:     /**
williamr@2:     * From CCoeControl, Drawing function which draws the control
williamr@2:     *
williamr@2:     * @param aRect Specified area to be drawn
williamr@2:     */
williamr@2:     void Draw( const TRect& aRect ) const;
williamr@2: 
williamr@2:    /**
williamr@2:     * From CCoeControl, Returns number of components.
williamr@2:     *
williamr@2:     * @return Number of component controls
williamr@2:     */
williamr@2:     IMPORT_C virtual TInt CountComponentControls() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * From CCoeControl, Returns pointer to particular component
williamr@2:     *
williamr@2:     * @param aIndex Index whose control's pointer has to returned.
williamr@2:     * @return Pointer to component control
williamr@2:     */
williamr@2:     IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
williamr@2: 
williamr@2: public:
williamr@2:     /**
williamr@2:     * From CCoeControl. Handles pointer event
williamr@2:     *
williamr@2:     * @param aPointerEvent Pointer event to be handled
williamr@2:     */
williamr@2:     IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@2:     TInt StepSize() const;
williamr@2: 
williamr@2: private:
williamr@2:     /**
williamr@2:     * From CAknControl
williamr@2:     */
williamr@2:     IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2: 
williamr@2: protected:
williamr@2:     /**
williamr@2:     * Sets the text to the value label
williamr@2:     */
williamr@2:     IMPORT_C void SetValueTextL();
williamr@2: 
williamr@2: public:
williamr@2: 
williamr@2:     /**
williamr@2:     * Report event for thumb/marker dragging via HandleControlEventL
williamr@2:     *
williamr@2:     * @since 5.0
williamr@2:     */ 
williamr@2:     void ReportMarkerDragEvent( TBool aEnable );
williamr@2:     
williamr@2: private:
williamr@2:     /**
williamr@2:     * This function creates the bitmaps and labels. Also it sets the
williamr@2:     * container window for the labels.
williamr@2:     */
williamr@2:     void ConstructL();
williamr@2: 
williamr@2:     void InitializeBitmapsL();
williamr@2: 
williamr@2:     /**
williamr@2:     * static routine for setting the value text.
williamr@2:     * @param valueBuf Buffer to hold the result. Must be big enough to hold
williamr@2:     *   value label as formatted from the resources and value provided, though
williamr@2:     *   it is protected from overflow. Contained text will be truncated to
williamr@2:     *   KValueLabelTextMaxLength
williamr@2:     * @param aValue Slider value to format
williamr@2:     * @param aResourceData    resource Id to read from
williamr@2:     */
williamr@2:     static void DoSetValueTextL( TDes& valueBuf, TInt aValue,
williamr@2:                                  const CAknSliderData& aResourceData );
williamr@2:     
williamr@2:     /**
williamr@2:     * This method is used to trap all the accesses to the internal data. It
williamr@2:     * panics with EAknPanicObjectNotFullyConstructed if iData is not
williamr@2:     * constructed, that is, if 2nd stage construction has not taken place (or
williamr@2:     * has failed).
williamr@2:     */
williamr@2:     CAknSliderData* SliderData() const;
williamr@2: 
williamr@2:     /**
williamr@2:     * This class is a utility to protect StringLoader::Format from being
williamr@2:     * called without a formatting token.
williamr@2:     *
williamr@2:     * StringLoader is used in current implementation. See StringLoader::Format
williamr@2:     * for the semantics of the parameters.
williamr@2:     *
williamr@2:     * The other thing to note is that the output for descriptor must be able
williamr@2:     * to accept up to KValueLabelTextMaxLength characters.
williamr@2:     *
williamr@2:     * @param aOutput Output of format operation
williamr@2:     * @param aFormat Formatting descriptor.
williamr@2:     * @param aValue  Descriptor to substitute for the %U token potentially
williamr@2:     *                present in the formatting descriptor.
williamr@2:     */
williamr@2:     static void FormatWithOrWithoutTokenL( TDes& aOutput,
williamr@2:                                            const TDesC& aFormat,
williamr@2:                                            const TDesC& aValue );
williamr@2: 
williamr@2:     // layout methods
williamr@2:     void FormSliderLayout1();
williamr@2:     void FormSliderLayout2();
williamr@2:     void FormSliderLayout3();
williamr@2:     void SettingsItemSliderLayout();
williamr@2:     void VerticalSliderLayout();
williamr@2:     void HorizontalSliderLayout();
williamr@2:     void MIDPFormSliderLayout();
williamr@2:     
williamr@2:     void SetLabelColor();
williamr@2: 
williamr@2:    
williamr@2:     void CreateDecoratorImageFromResourceL( TInt aImageResourceId );
williamr@2: 
williamr@2:     // Internal access methods
williamr@2:     TInt Layout() const;
williamr@2:     TInt MaximumValue() const;
williamr@2:     TInt MinimumValue() const;
williamr@2:     TInt Range() const;
williamr@2: 
williamr@2:     // Starts a timer for feedback effect visualization.
williamr@2:     void StartTimerL();
williamr@2: 
williamr@2:     // Callback for feedback effect.
williamr@2:     static TInt IndicationDrawCallbackL( TAny* aThis );
williamr@2: 
williamr@2:     // Implementation of the feedback effect.
williamr@2:     void SmallDirectionIndicationL();
williamr@2: 
williamr@2:     void DrawHorizontalTickMarks( CWindowGc& aGc ) const;
williamr@2:     void DrawVerticalTickMarks( CWindowGc& aGc ) const;
williamr@2: 
williamr@2:     void TranslateValueL( TInt aDelta, TBool aFeedback = EFalse );
williamr@2: 
williamr@2:     void GetMarkerRect( TRect& aRect ) const;
williamr@2:     TSize MarkerSize() const;
williamr@2:     TPoint MarkerPos() const;
williamr@2: 
williamr@2:     void DrawHorizontal( TBool aDrawMarker ) const;
williamr@2:     void DrawVertical( TBool aDrawMarker ) const;
williamr@2: 
williamr@2:     void DrawHorizontalLine( CWindowGc& aGc ) const;
williamr@2:     void DrawVerticalLine( CWindowGc& aGc ) const;
williamr@2: 
williamr@2:     void FetchGfx( TAknSliderGfx& aGfx, TInt aElement, const TSize& aSize ) const;
williamr@2:     
williamr@2:     // calculate the correct value according to the input point
williamr@2:     TInt CalcAlignedValue( const TPoint& aPoint ); 
williamr@2: 
williamr@2: private:
williamr@2:     CEikImage* iImage;
williamr@2:     CEikLabel* iValueLabel;
williamr@2:     CEikLabel* iMinLabel;
williamr@2:     CEikLabel* iMaxLabel;
williamr@2:     CFbsBitmap* iMarkerBmp;
williamr@2:     CFbsBitmap* iMarkerMaskBmp;
williamr@2:     TRect iMarkerArea;
williamr@2:     TRect iLineRect;
williamr@2:     TInt iValue;
williamr@2:     TBool iEditable;
williamr@2:     TRgb iColor;
williamr@2: 
williamr@2:     // Not used, kept for binary compatibility. Another pointer with same name
williamr@2:     // in iData is really used
williamr@2:     HBufC* iSingularText;
williamr@2: 
williamr@2:     CAknSliderData* iData;
williamr@2:     CAknSliderExtension* iExt;
williamr@2: 
williamr@2:     TInt iSpare[4];
williamr@2: };
williamr@2: 
williamr@2: #endif // __AKNSLIDER_H__
williamr@2: 
williamr@2: // End of File