aknslider.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name         : CAknSlider from aknslider.h
00004 *  Part of      : Avkon
00005 *  Description  : Slider editor class
00006 *  Version      : %version: e003sa02#27 %
00007 *
00008 *  Copyright © 2005-2006 Nokia. All rights reserved.
00009 *  This material, including documentation and any related 
00010 *  computer programs, is protected by copyright controlled by 
00011 *  Nokia. All rights are reserved. Copying, including 
00012 *  reproducing, storing, adapting or translating, any 
00013 *  or all of this material requires the prior written consent of 
00014 *  Nokia. This material also contains confidential 
00015 *  information which may not be disclosed to others without the 
00016 *  prior written consent of Nokia.
00017 * ============================================================================
00018 */
00019 
00020 #ifndef __AKNSLIDER_H__
00021 #define __AKNSLIDER_H__
00022 
00023 // INCLUDES
00024 #include <eikbctrl.h>
00025 #include <eiklabel.h>
00026 #include <eikimage.h>
00027 #include <avkon.hrh> // For TAknOrientation
00028 
00029 // CONSTANTS
00030 
00031 // The following is max. length of the entire formatted value text including
00032 // number, special characters and supplied text.
00033 const TInt KValueLabelTextMaxLength = 30;
00034 
00035 // Forward declarations
00036 class CGulIcon;
00037 class MAknsSkinInstance;
00038 class CAknSliderExtension;
00039 class CAknSliderData;
00040 struct TAknSliderGfx;
00041 
00042 // CLASS DECLARATION
00043 class CAknSlider : public CEikBorderedControl
00044     {
00045 public: // Enumerations
00051     enum
00052         {
00057         EElemEmptyLeftCap,
00058 
00063         EElemEmptyRightCap,
00064         
00068         EElemEmptyLine,
00069         
00073         EElemFilledLine,
00074         
00078         EElemFilledLeftCap,
00079         
00083         EElemFilledRightCap,
00084         
00088         EElemMarker,
00089         
00094         EElemTickMark,
00095         
00099         EElemMarkerSelected
00100         };
00101 
00107     enum
00108         {
00120         EPosFilling  = 0x01,
00126         EPosMarker   = 0x02            
00127         };
00128 
00129 public:
00133     IMPORT_C CAknSlider();
00134 
00138     IMPORT_C ~CAknSlider();
00139 
00149     IMPORT_C void SetValueL( TInt aValue );
00150 
00156     IMPORT_C TInt Value() const;
00157 
00165     IMPORT_C void SetRange( TInt aMinimumValue, TInt aMaximumValue );
00166 
00175     IMPORT_C void GetRange( TInt& aMinimumValue, TInt& aMaximumValue );
00176     
00183     IMPORT_C void SetStepSize( TInt aStepSize );
00184 
00190     IMPORT_C void SetMinimumTextL( const TDesC& aText );
00191 
00197     IMPORT_C void SetMaximumTextL( const TDesC& aText );
00198 
00204     IMPORT_C void SetDecimalPlaces( TInt aDecimalPlaces );
00205 
00211     IMPORT_C TInt DecimalPlaces() const;
00212 
00244     IMPORT_C void SetGraphics( TInt aElement,
00245                                CFbsBitmap* aBitmap,
00246                                CFbsBitmap* aMask );
00247     
00260     IMPORT_C void UseDefaultGraphics( TInt aElement );
00261 
00276     IMPORT_C TBool UsesDefaultGraphics( TInt aElement ) const;
00277 
00295     IMPORT_C void SetPositionIndicators( TUint32 aFlags );
00296     
00297    
00305     IMPORT_C TUint32 PositionIndicators() const;
00306 
00314     IMPORT_C TAknOrientation Orientation() const;
00315 
00325     IMPORT_C void SetTicksEnabled( TBool aStatus );
00326 
00334     IMPORT_C TBool TicksEnabled() const;
00335 
00346     IMPORT_C void SetTickInterval( TUint aInterval );
00347 
00355     IMPORT_C TUint TickInterval() const;
00356 
00368     IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
00369                                                TInt aResourceId );
00370 
00382     IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
00383                                                TInt aMinimumValue,
00384                                                TInt aMaximumValue );
00385 
00396     IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
00397                                                           TInt aResourceId );
00398 
00409     IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
00410                                                           TInt aMinimumValue,
00411                                                           TInt aMaximumValue );
00417     IMPORT_C void EnableDrag();
00418 
00419 public:
00426     TSize MinimumSize();
00427 
00435     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
00436                                  TEventCode aType );
00437 
00443     IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
00444 
00452     IMPORT_C void ConstructFromResourceL( CCoeControl* aParent,
00453                                           TInt aValue,
00454                                           TResourceReader& aReader );
00455 
00461     IMPORT_C void HandleResourceChange( TInt aType );
00462 
00463 public:
00470     IMPORT_C TInt NumberOfLines() const;
00471 
00482     IMPORT_C static HBufC* CreateValueTextInHBufCL( TInt aValue,
00483                                                     TInt aResourceId );
00484 
00485 protected:
00489     void SizeChanged();
00490 
00496     void Draw( const TRect& aRect ) const;
00497 
00503     IMPORT_C virtual TInt CountComponentControls() const;
00504 
00511     IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
00512 
00513 public:
00519     IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
00520 
00521 private:
00525     IMPORT_C void* ExtensionInterface( TUid aInterface );
00526 
00527 protected:
00531     IMPORT_C void SetValueTextL();
00532 
00533 private:
00538     void ConstructL();
00539 
00540     void InitializeBitmapsL();
00541 
00551     static void DoSetValueTextL( TDes& valueBuf, TInt aValue,
00552                                  const CAknSliderData& aResourceData );
00556     TInt RepeatStepSize() const;
00557 
00564     CAknSliderData* SliderData() const;
00565 
00581     static void FormatWithOrWithoutTokenL( TDes& aOutput,
00582                                            const TDesC& aFormat,
00583                                            const TDesC& aValue );
00584 
00585     // layout methods
00586     void FormSliderLayout1();
00587     void FormSliderLayout2();
00588     void FormSliderLayout3();
00589     void SettingsItemSliderLayout();
00590     void VerticalSliderLayout();
00591     void MIDPFormSliderLayout();
00592     
00593     void SetLabelColor();
00594 
00595    
00596     void CreateDecoratorImageFromResourceL( TInt aImageResourceId );
00597 
00598     // Internal access methods
00599     TInt Layout() const;
00600     TInt StepSize() const;
00601     TInt MaximumValue() const;
00602     TInt MinimumValue() const;
00603     TInt Range() const;
00604 
00605     // Starts a timer for feedback effect visualization.
00606     void StartTimerL();
00607 
00608     // Callback for feedback effect.
00609     static TInt IndicationDrawCallbackL( TAny* aThis );
00610 
00611     // Implementation of the feedback effect.
00612     void SmallDirectionIndicationL();
00613 
00614     void DrawHorizontalTickMarks( CWindowGc& aGc ) const;
00615     void DrawVerticalTickMarks( CWindowGc& aGc ) const;
00616 
00617     void TranslateValueL( TInt aDelta );
00618 
00619     void GetMarkerRect( TRect& aRect ) const;
00620     TSize MarkerSize() const;
00621     TPoint MarkerPos() const;
00622 
00623     void DrawHorizontal( TBool aDrawMarker ) const;
00624     void DrawVertical( TBool aDrawMarker ) const;
00625 
00626     void DrawHorizontalLine( CWindowGc& aGc ) const;
00627     void DrawVerticalLine( CWindowGc& aGc ) const;
00628 
00629     void FetchGfx( TAknSliderGfx& aGfx, TInt aElement, const TSize& aSize ) const;
00630     
00631     // calculate the correct value according to the input point
00632     TInt CalcAlignedValue( const TPoint& aPoint ); 
00633 
00634 private:
00635     CEikImage* iImage;
00636     CEikLabel* iValueLabel;
00637     CEikLabel* iMinLabel;
00638     CEikLabel* iMaxLabel;
00639     CFbsBitmap* iMarkerBmp;
00640     CFbsBitmap* iMarkerMaskBmp;
00641     TRect iMarkerArea;
00642     TRect iLineRect;
00643     TInt iValue;
00644     TBool iEditable;
00645     TRgb iColor;
00646 
00647     // Not used, kept for binary compatibility. Another pointer with same name
00648     // in iData is really used
00649     HBufC* iSingularText;
00650 
00651     CAknSliderData* iData;
00652     CAknSliderExtension* iExt;
00653 
00654     TInt iSpare[4];
00655 };
00656 
00657 // __AKNSLIDER_H__
00658 #endif
00659 
00660 // End of File

Copyright © Nokia Corporation 2001-2008
Back to top