00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __AKNSLIDER_H__
00021 #define __AKNSLIDER_H__
00022
00023
00024 #include <eikbctrl.h>
00025 #include <eiklabel.h>
00026 #include <eikimage.h>
00027 #include <avkon.hrh>
00028
00029
00030
00031
00032
00033 const TInt KValueLabelTextMaxLength = 30;
00034
00035
00036 class CGulIcon;
00037 class MAknsSkinInstance;
00038 class CAknSliderExtension;
00039 class CAknSliderData;
00040 struct TAknSliderGfx;
00041
00042
00043 class CAknSlider : public CEikBorderedControl
00044 {
00045 public:
00051 enum TSliderGfxElements
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
00134 enum
00135 {
00139 EDragMarkerStart = 1000,
00143 EDragMarkerEnd
00144 };
00145
00146 public:
00150 IMPORT_C CAknSlider();
00151
00155 IMPORT_C ~CAknSlider();
00156
00166 IMPORT_C void SetValueL( TInt aValue );
00167
00173 IMPORT_C TInt Value() const;
00174
00182 IMPORT_C void SetRange( TInt aMinimumValue, TInt aMaximumValue );
00183
00192 IMPORT_C void GetRange( TInt& aMinimumValue, TInt& aMaximumValue );
00193
00200 IMPORT_C void SetStepSize( TInt aStepSize );
00201
00207 IMPORT_C void SetMinimumTextL( const TDesC& aText );
00208
00214 IMPORT_C void SetMaximumTextL( const TDesC& aText );
00215
00221 IMPORT_C void SetDecimalPlaces( TInt aDecimalPlaces );
00222
00228 IMPORT_C TInt DecimalPlaces() const;
00229
00261 IMPORT_C void SetGraphics( TInt aElement,
00262 CFbsBitmap* aBitmap,
00263 CFbsBitmap* aMask );
00264
00277 IMPORT_C void UseDefaultGraphics( TInt aElement );
00278
00293 IMPORT_C TBool UsesDefaultGraphics( TInt aElement ) const;
00294
00312 IMPORT_C void SetPositionIndicators( TUint32 aFlags );
00313
00314
00322 IMPORT_C TUint32 PositionIndicators() const;
00323
00331 IMPORT_C TAknOrientation Orientation() const;
00332
00342 IMPORT_C void SetTicksEnabled( TBool aStatus );
00343
00351 IMPORT_C TBool TicksEnabled() const;
00352
00363 IMPORT_C void SetTickInterval( TUint aInterval );
00364
00372 IMPORT_C TUint TickInterval() const;
00373
00385 IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
00386 TInt aResourceId );
00387
00399 IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
00400 TInt aMinimumValue,
00401 TInt aMaximumValue );
00402
00413 IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
00414 TInt aResourceId );
00415
00426 IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
00427 TInt aMinimumValue,
00428 TInt aMaximumValue );
00434 IMPORT_C void EnableDrag();
00435
00436 public:
00443 TSize MinimumSize();
00444
00452 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
00453 TEventCode aType );
00454
00460 IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
00461
00469 IMPORT_C void ConstructFromResourceL( CCoeControl* aParent,
00470 TInt aValue,
00471 TResourceReader& aReader );
00472
00478 IMPORT_C void HandleResourceChange( TInt aType );
00479
00480 public:
00487 IMPORT_C TInt NumberOfLines() const;
00488
00499 IMPORT_C static HBufC* CreateValueTextInHBufCL( TInt aValue,
00500 TInt aResourceId );
00501
00502 void SuppressDrawing( TBool aSuppress );
00503
00504 protected:
00508 void SizeChanged();
00509
00515 void Draw( const TRect& aRect ) const;
00516
00522 IMPORT_C virtual TInt CountComponentControls() const;
00523
00530 IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
00531
00532 public:
00538 IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
00539 TInt StepSize() const;
00540
00541 private:
00545 IMPORT_C void* ExtensionInterface( TUid aInterface );
00546
00547 protected:
00551 IMPORT_C void SetValueTextL();
00552
00553 public:
00554
00560 void ReportMarkerDragEvent( TBool aEnable );
00561
00562 private:
00567 void ConstructL();
00568
00569 void InitializeBitmapsL();
00570
00580 static void DoSetValueTextL( TDes& valueBuf, TInt aValue,
00581 const CAknSliderData& aResourceData );
00582
00589 CAknSliderData* SliderData() const;
00590
00606 static void FormatWithOrWithoutTokenL( TDes& aOutput,
00607 const TDesC& aFormat,
00608 const TDesC& aValue );
00609
00610
00611 void FormSliderLayout1();
00612 void FormSliderLayout2();
00613 void FormSliderLayout3();
00614 void SettingsItemSliderLayout();
00615 void VerticalSliderLayout();
00616 void HorizontalSliderLayout();
00617 void MIDPFormSliderLayout();
00618
00619 void SetLabelColor();
00620
00621
00622 void CreateDecoratorImageFromResourceL( TInt aImageResourceId );
00623
00624
00625 TInt Layout() const;
00626 TInt MaximumValue() const;
00627 TInt MinimumValue() const;
00628 TInt Range() const;
00629
00630
00631 void StartTimerL();
00632
00633
00634 static TInt IndicationDrawCallbackL( TAny* aThis );
00635
00636
00637 void SmallDirectionIndicationL();
00638
00639 void DrawHorizontalTickMarks( CWindowGc& aGc ) const;
00640 void DrawVerticalTickMarks( CWindowGc& aGc ) const;
00641
00642 void TranslateValueL( TInt aDelta, TBool aFeedback = EFalse );
00643
00644 void GetMarkerRect( TRect& aRect ) const;
00645 TSize MarkerSize() const;
00646 TPoint MarkerPos() const;
00647
00648 void DrawHorizontal( TBool aDrawMarker ) const;
00649 void DrawVertical( TBool aDrawMarker ) const;
00650
00651 void DrawHorizontalLine( CWindowGc& aGc ) const;
00652 void DrawVerticalLine( CWindowGc& aGc ) const;
00653
00654 void FetchGfx( TAknSliderGfx& aGfx, TInt aElement, const TSize& aSize ) const;
00655
00656
00657 TInt CalcAlignedValue( const TPoint& aPoint );
00658
00659 private:
00660 CEikImage* iImage;
00661 CEikLabel* iValueLabel;
00662 CEikLabel* iMinLabel;
00663 CEikLabel* iMaxLabel;
00664 CFbsBitmap* iMarkerBmp;
00665 CFbsBitmap* iMarkerMaskBmp;
00666 TRect iMarkerArea;
00667 TRect iLineRect;
00668 TInt iValue;
00669 TBool iEditable;
00670 TRgb iColor;
00671
00672
00673
00674 HBufC* iSingularText;
00675
00676 CAknSliderData* iData;
00677 CAknSliderExtension* iExt;
00678
00679 TInt iSpare[4];
00680 };
00681
00682 #endif // __AKNSLIDER_H__
00683
00684