00001
00002
00003
00004
00005
00006 #if !defined(__EIKSCRLB_H__)
00007 #define __EIKSCRLB_H__
00008
00009 #if !defined(__EIKBCTRL_H__)
00010 #include <eikbctrl.h>
00011 #endif
00012
00013 #if !defined(__EIKSBOBS_H__)
00014 #include <eiksbobs.h>
00015 #endif
00016
00017 #if !defined(__AKNSCBUT_H__)
00018 #include <aknscbut.h>
00019 #endif
00020
00021 #include <lafpublc.h>
00022
00023 class CEikCba;
00024 class CAknDoubleSpanScrollIndicator;
00025 class CEikScrollBarExtensionImpl;
00026 class CEikScrollBarExtension;
00027 class CAknDoubleSpanScrollBarExtension;
00028
00029 const TInt KEikScrollEventFromVBar=0;
00030 const TInt KEikScrollEventFromHBar=0x01;
00031 const TInt KEikScrollEventBarMask=0x01;
00032
00033
00034 const TInt KButtonPositionMask=KLafScrollBarButtonPositionMask;
00035
00036
00037 const TInt KDisplayComponentsMask=0x1f;
00038
00039
00047 class TEikScrollBarModel
00048 {
00049
00050 public:
00051
00056 inline TEikScrollBarModel();
00057
00068 IMPORT_C TEikScrollBarModel(TInt aScrollSpan,
00069 TInt aThumbSpan=0,
00070 TInt aThumbPosition=0);
00071
00080 IMPORT_C TBool operator==(const TEikScrollBarModel aModel) const;
00081
00089 inline TBool operator!=(const TEikScrollBarModel aModel) const;
00090
00091 public:
00092
00099 IMPORT_C TBool ScrollBarUseful() const;
00100
00107 IMPORT_C TInt MaxThumbPos() const;
00108
00113 IMPORT_C void CheckBounds();
00114
00120 enum TEikScrollBarModelType
00121 {
00122
00124 EEikScrollBarModel = 0x00000000,
00125
00127 EAknDoubleSpanScrollBarModel = 0x80000000
00128 };
00129
00134 TEikScrollBarModel::TEikScrollBarModelType ScrollBarModelType() const;
00135
00136 public:
00137
00139 TInt iScrollSpan;
00140
00142 TInt iThumbSpan;
00143
00145 TInt iThumbPosition;
00146 };
00147
00148 inline TEikScrollBarModel::TEikScrollBarModel() {}
00149 inline TBool TEikScrollBarModel::operator!=(const TEikScrollBarModel aModel) const { return !(*this==aModel); }
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 class TAknDoubleSpanScrollBarModel : public TEikScrollBarModel
00166 {
00167
00168 public:
00169
00173 IMPORT_C TAknDoubleSpanScrollBarModel();
00174
00201 IMPORT_C TAknDoubleSpanScrollBarModel(const TEikScrollBarModel& aEikModel);
00202
00203
00227 IMPORT_C void SetScrollSpan(TInt aValue);
00228 IMPORT_C void SetFocusPosition(TInt aValue);
00229 IMPORT_C void SetWindowSize(TInt aValue);
00230 IMPORT_C void SetFieldSize(TInt aValue);
00231 IMPORT_C void SetFieldPosition(TInt aValue);
00232
00233
00246 IMPORT_C TInt ScrollSpan() const;
00247 IMPORT_C TInt FocusPosition() const;
00248 IMPORT_C TInt WindowSize() const;
00249 IMPORT_C TInt FieldSize() const;
00250 IMPORT_C TInt FieldPosition() const;
00251
00252
00271 static TBool ModelIsSupported();
00272
00273 private:
00281 TUint16 Scale() const;
00282
00290 void SetScale(TUint16 aScale);
00291
00292 private:
00300 TInt16 ScrollSpanValue() const;
00301 TInt16 FocusPositionValue() const;
00302 TInt16 FieldPositionValue() const;
00303 TInt16 FieldSizeValue() const;
00304 TInt16 WindowSizeValue() const;
00305
00313 void SetScrollSpanValue(TInt16 aValue);
00314 void SetFocusPositionValue(TInt16 aValue);
00315 void SetFieldPositionValue(TInt16 aValue);
00316 void SetFieldSizeValue(TInt16 aValue);
00317 void SetWindowSizeValue(TInt16 aValue);
00318
00326 TInt16 LowBytes(TInt aInt) const;
00327
00335 TInt16 HighBytes(TInt aInt) const;
00336
00337
00345 void SetLowBytes(TInt& aInt, TInt16 aValue);
00346
00354 void SetHighBytes(TInt& aInt, TInt16 aValue);
00355
00356
00365 TInt16 PrepareScaledValue(TInt aNonScaledValue);
00366
00375 void ReScale(TUint16 aNewScale);
00376
00385 void SetScrollBarModelType(TEikScrollBarModelType aModelType);
00386
00396 TInt CheckMinMaxValue(TInt aValue);
00397 };
00398
00399
00400
00401
00402
00403
00404 class CEikScrollThumb;
00405 class CEikScrollBarFrame;
00406
00414 class CEikScrollBar : public CEikBorderedControl, public MCoeControlObserver
00415 {
00416 friend class CEikScrollBarExtension;
00417 friend class CAknDoubleSpanScrollBarExtension;
00418
00419 public:
00420
00422 enum TOrientation
00423 {
00425 EVertical = SLafScrollBar::EVertical,
00426
00428 EHorizontal = SLafScrollBar::EHorizontal
00429 };
00430
00432 enum TScrollBarType
00433 {
00435 ENormalScrollBar =0x0,
00436
00438 EArrowHead =0x200,
00439
00445 EDoubleSpan =0x400
00446 };
00447
00452 enum TEikScrollBarFlags
00453 {
00455 EEikScrollBarDefaultBehaviour =
00456 SLafScrollBar::EEikScrollBarDefaultBehaviour,
00457
00459 EEikScrollBarNoNudgeButtons =
00460 SLafScrollBar::EEikScrollBarNoNudgeButtons,
00461
00463 EEikScrollBarHasPageButtons =
00464 SLafScrollBar::EEikScrollBarHasPageButtons,
00465
00467 EEikScrollBarHasHomeEndButtons =
00468 SLafScrollBar::EEikScrollBarHasHomeEndButtons,
00469
00471 EEikScrollBarNoShaftOrThumb =
00472 SLafScrollBar::EEikScrollBarNoShaftOrThumb,
00473
00475 EEikScrollBarShaftButNoThumb =
00476 SLafScrollBar::EEikScrollBarShaftButNoThumb,
00477
00479 EButtonsAtStartOfShaft =
00480 SLafScrollBar::EButtonsAtStartOfShaft,
00481
00483 EButtonsAtEndOfShaft =
00484 SLafScrollBar::EButtonsAtEndOfShaft,
00485
00490 EButtonsEitherSideOfShaft =
00491 SLafScrollBar::EButtonsEitherSideOfShaft,
00492
00497 ENoAutoDimming =
00498 SLafScrollBar::ENoAutoDimming,
00499
00501 EEnableNudgeButtons = 0x0200,
00502
00504 EDisableExpandedTouchArea = 0x0400
00505 };
00506
00508 enum TScrollBarExtensionAreaType
00509 {
00511 ENormalExpandedTouchArea,
00512
00514 EScaleExpandedTouchArea,
00515
00517 ENoExpandedTouchArea
00518 };
00519 typedef TEikScrollBarFlags TAknScrollBarFlags;
00520
00521 public:
00522
00526 IMPORT_C ~CEikScrollBar();
00527
00531 IMPORT_C CEikScrollBar();
00532
00533 public:
00534
00545 IMPORT_C virtual void ConstructL(
00546 MEikScrollBarObserver* aScrollBarObserver,
00547 const CCoeControl* aParent,
00548 TOrientation aOrientation,
00549 TInt aLength,
00550 TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
00551
00557 IMPORT_C void SetLengthL(TInt aLength);
00558
00564 IMPORT_C void SetModelL(const TEikScrollBarModel* aModel);
00565
00571 IMPORT_C void SetModel(const TEikScrollBarModel* aModel);
00572
00579 IMPORT_C void SetLengthAndModelL(TInt aLength,
00580 const TEikScrollBarModel* aModel);
00581
00587 IMPORT_C void SetModelThumbPosition(TInt aThumbPos);
00588
00594 IMPORT_C void SetFocusPosToThumbPos(TInt aFocusPosition);
00595
00601 IMPORT_C static TInt DefaultScrollBarBreadth();
00602
00610 void SetScrollBarObserver(MEikScrollBarObserver* aScrollBarObserver);
00611
00615 inline const TEikScrollBarModel* Model() const;
00616
00624 IMPORT_C TInt ThumbPosition() const;
00625
00632 IMPORT_C TInt ScrollBarBreadth() const;
00633
00641 IMPORT_C static TInt MinVisibleLength(const TInt aScrollBarFlags);
00642
00648 IMPORT_C void SetDecreaseButtonsDimmed(TBool aDimmed);
00649
00655 IMPORT_C void SetIncreaseButtonsDimmed(TBool aDimmed);
00656
00662 IMPORT_C void SetAllButtonsDimmed(TBool aDimmed);
00663
00672 inline CAknScrollButton* IncreaseNudgeButton() const;
00673
00682 inline CAknScrollButton* DecreaseNudgeButton() const;
00683
00684
00693 IMPORT_C void SetContainingCba(CEikCba* aCba);
00694
00707 IMPORT_C void MakeVisible(TBool aVisible);
00708
00709
00717 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00718
00729 IMPORT_C void SetExtensionAreaType(TScrollBarExtensionAreaType aType);
00730 protected:
00731
00744 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00745
00753 IMPORT_C TInt CountComponentControls() const;
00754
00755 private:
00756 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,
00757 TCoeEvent aEventType);
00758 private:
00759 IMPORT_C virtual void Reserved_2();
00760 private:
00764 IMPORT_C void* ExtensionInterface( TUid aInterface );
00765
00766 protected:
00767
00779 friend class CEikScrollBarFrame;
00780
00781
00786 enum TPrivateScrollBarFlags
00787 {
00788
00790 ENoComponentsToDisplay =0x10000,
00791
00793 EIncreaseButtonsDimmed =0x20000,
00794
00796 EDecreaseButtonsDimmed =0x40000
00797 };
00798
00800 enum TPointerDownOn
00801 {
00803 ENone,
00804
00806 EHomeButton,
00807
00809 EDecreasePageButton,
00810
00812 EDecreaseNudgeButton,
00813
00815 EDecreaseShaft,
00816
00818 EThumb,
00819
00821 EIncreaseShaft,
00822
00824 EIncreaseNudgeButton,
00825
00827 EIncreasePageButton,
00828
00830 EEndButton
00831 };
00832
00834 enum TShaftRedrawRequired
00835 {
00837 ENoRedrawRequired,
00838
00840 ERedrawShaft
00841 };
00842
00844 enum TWhichButtons
00845 {
00847 EIncreaseOnly,
00848
00850 EDecreaseOnly,
00851
00853 EAll
00854 };
00855
00861 struct SEikScrollBarButtons
00862 {
00864 CAknScrollButton* iDecreaseNudge;
00865
00867 CAknScrollButton* iIncreaseNudge;
00868 };
00869
00870
00871 private:
00872
00873 IMPORT_C virtual void CreateButtonL(CAknScrollButton*& aButton,
00874 CAknScrollButton::TType aType);
00875
00876 void SizeChanged();
00877
00878
00879 void DoSetModel(const TEikScrollBarModel* aModel);
00880
00881 CEikCba* Cba() const;
00882
00883
00884 void AddExternalFrameL(CEikScrollBarFrame* aFrame);
00885 void RemoveExternalFrame(CEikScrollBarFrame* aFrame);
00886
00887 void DisconnectExternalFrames();
00888
00889 protected:
00890
00894 void CreateRequiredComponentsL();
00895
00901 void DestroyButton(CAknScrollButton*& aButton);
00902
00908 IMPORT_C virtual void SetButtonPositionL(CAknScrollButton* aButton);
00909
00910 public:
00911
00917 TScrollBarType ScrollBarType();
00918
00919 public:
00920
00922 TDblQueLink iSBLink;
00923
00924 protected:
00925
00927 SEikScrollBarButtons iButtons;
00928
00930 TOrientation iOrientation;
00931
00932 private:
00933 TEikScrollBarModel iModel;
00934
00935 protected:
00936
00938 CEikScrollBarExtensionImpl* iExtension;
00939 };
00940
00941
00952 class CEikArrowHeadScrollBar : public CEikScrollBar
00953 {
00954 public:
00955 IMPORT_C CEikArrowHeadScrollBar(CCoeControl* aParentWindow);
00956 IMPORT_C ~CEikArrowHeadScrollBar();
00957 public:
00958 IMPORT_C void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
00959 TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
00960 public:
00961 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00962 private:
00963 void CreateButtonL(CAknScrollButton*& aButton,CAknScrollButton::TType aType);
00964 void SetButtonPositionL(CAknScrollButton* aButton);
00965 private:
00966 private:
00970 IMPORT_C void* ExtensionInterface( TUid aInterface );
00971 private:
00972 CCoeControl* iParentControl;
00973 TInt iSpare;
00974 };
00975
00976
00991 class CAknDoubleSpanScrollBar : public CEikScrollBar
00992 {
00993 public:
00994 IMPORT_C CAknDoubleSpanScrollBar(CCoeControl* aParentWindow);
00995 IMPORT_C ~CAknDoubleSpanScrollBar();
00996
01005 IMPORT_C void SetFixedLayoutRect(TRect aScrollBarRect);
01006
01019 IMPORT_C void ConstructL(TBool aWindowOwning, MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
01020 TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
01021
01031 IMPORT_C void SetScrollPopupInfoTextL( const TDesC& aText );
01032
01039 TRect FixedLayoutRect();
01040
01041 public:
01042 IMPORT_C void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
01043 TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
01044 IMPORT_C void MakeVisible(TBool aVisible);
01045
01046 public:
01047 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
01048
01049 protected:
01050 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
01051 IMPORT_C TInt CountComponentControls() const;
01052
01053 private:
01054 IMPORT_C void SizeChanged();
01055
01056 public:
01057
01058 TBool DrawBackgroundState();
01059
01060 void DrawBackground(TBool aDrawHorizontal);
01061
01062 private:
01066 IMPORT_C void* ExtensionInterface( TUid aInterface );
01067 private:
01068 void CreateButtonL(CAknScrollButton*& aButton,CAknScrollButton::TType aType);
01069 void SetButtonPositionL(CAknScrollButton* aButton);
01070
01078 void SetTransparentBackground(TBool aTransparentBackground);
01079
01083 TRect ExtensionArea() const;
01084 private:
01085 CCoeControl* iParentControl;
01086 TInt iSpare;
01087 };
01088
01089
01090
01091
01092
01093
01094
01095 inline const TEikScrollBarModel* CEikScrollBar::Model() const
01096 { return &iModel; }
01097
01098 inline CAknScrollButton* CEikScrollBar::IncreaseNudgeButton() const
01099 { return iButtons.iIncreaseNudge; }
01100
01101 inline CAknScrollButton* CEikScrollBar::DecreaseNudgeButton() const
01102 { return iButtons.iDecreaseNudge; }
01103
01104
01105 #endif