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
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
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
00599 TInt Layout() const;
00600 TInt StepSize() const;
00601 TInt MaximumValue() const;
00602 TInt MinimumValue() const;
00603 TInt Range() const;
00604
00605
00606 void StartTimerL();
00607
00608
00609 static TInt IndicationDrawCallbackL( TAny* aThis );
00610
00611
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
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
00648
00649 HBufC* iSingularText;
00650
00651 CAknSliderData* iData;
00652 CAknSliderExtension* iExt;
00653
00654 TInt iSpare[4];
00655 };
00656
00657
00658 #endif
00659
00660