eikscrlb.h

Go to the documentation of this file.
00001 // EIKSCRLB.H
00002 //
00003 // Copyright (c) 1997-2006 Symbian Ltd.  All rights reserved.
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 // sets all bits in EButtonsXxx range
00034 const TInt KButtonPositionMask=KLafScrollBarButtonPositionMask; 
00035 
00036 // sets all bits in determining which components exist
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 // TAknDoubleSpanScrollBarModel class
00154 //
00155 // This class is binary compatible with TEikScrollBarModel and can
00156 // be used in places where TEikScrollBarModel is used but few restrictions exist:
00157 //
00158 // - Base class (TEikScrollBarModel) public members must NOT be accessed directly.
00159 // - Base class (TEikScrollBarModel) public methods must NOT be called.
00160 //
00161 // If this model is not supported by the scrollbar system, then values are stored
00162 // as in the base class for compatibility resons. See ModelIsSupported()-method 
00163 // documentation for more information.
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);    // Size of the scrolled list. 
00228     IMPORT_C void SetFocusPosition(TInt aValue); // Position of the current field in the list.
00229     IMPORT_C void SetWindowSize(TInt aValue);    // Size of the visible part of the list. 
00230     IMPORT_C void SetFieldSize(TInt aValue);     // Size of the current field. (Optional double span)
00231     IMPORT_C void SetFieldPosition(TInt aValue); // Position inside the current field. (Optional double span)  
00232     
00233     
00246     IMPORT_C TInt ScrollSpan() const;    // Size of the scrolled list.
00247     IMPORT_C TInt FocusPosition() const; // Position of the current field in the list.
00248     IMPORT_C TInt WindowSize() const;    // Size of the visible part of the list. 
00249     IMPORT_C TInt FieldSize() const;     // Size of the current field. (Optional double span)
00250     IMPORT_C TInt FieldPosition() const; // Position inside the current field. (Optional double span)
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 // CEikScrollBar
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         };
00500 
00501     typedef TEikScrollBarFlags TAknScrollBarFlags;
00502 
00503 public:
00504 
00508     IMPORT_C ~CEikScrollBar();
00509 
00513     IMPORT_C CEikScrollBar();
00514 
00515 public:
00516 
00527     IMPORT_C virtual void ConstructL(
00528                 MEikScrollBarObserver* aScrollBarObserver,
00529                 const CCoeControl* aParent,
00530                 TOrientation aOrientation,
00531                 TInt aLength,
00532                 TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
00533 
00539     IMPORT_C void SetLengthL(TInt aLength);
00540 
00546     IMPORT_C void SetModelL(const TEikScrollBarModel* aModel);
00547 
00553     IMPORT_C void SetModel(const TEikScrollBarModel* aModel);
00554 
00561     IMPORT_C void SetLengthAndModelL(TInt aLength,
00562                                      const TEikScrollBarModel* aModel);
00563 
00569     IMPORT_C void SetModelThumbPosition(TInt aThumbPos);
00570 
00576     IMPORT_C void SetFocusPosToThumbPos(TInt aFocusPosition);
00577 
00583     IMPORT_C static TInt DefaultScrollBarBreadth();
00584 
00592     void SetScrollBarObserver(MEikScrollBarObserver* aScrollBarObserver);
00593 
00597     inline const TEikScrollBarModel* Model() const;
00598 
00606     IMPORT_C TInt ThumbPosition() const;
00607 
00614     IMPORT_C TInt ScrollBarBreadth() const;
00615 
00623     IMPORT_C static TInt MinVisibleLength(const TInt aScrollBarFlags);
00624 
00630     IMPORT_C void SetDecreaseButtonsDimmed(TBool aDimmed);
00631 
00637     IMPORT_C void SetIncreaseButtonsDimmed(TBool aDimmed);
00638 
00644     IMPORT_C void SetAllButtonsDimmed(TBool aDimmed);
00645 
00654     inline CAknScrollButton* IncreaseNudgeButton() const;
00655         
00664     inline CAknScrollButton* DecreaseNudgeButton() const;
00665 
00666     // This function should only be used by CEikCba
00675     IMPORT_C void SetContainingCba(CEikCba* aCba);
00676 
00689     IMPORT_C void MakeVisible(TBool aVisible);
00690 
00691     // 
00699     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00700 
00701 protected:      
00702 
00715     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00716 
00724     IMPORT_C TInt CountComponentControls() const;
00725 
00726 private: // from MCoeControlObserver
00727     IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, 
00728                                               TCoeEvent aEventType);
00729 private: // virtual - reserved from CCoeControl
00730     IMPORT_C virtual void Reserved_2();
00731 private:
00735     IMPORT_C void* ExtensionInterface( TUid aInterface );
00736 
00737 protected:
00738 
00750     friend class CEikScrollBarFrame;
00751 
00752     // enums
00757     enum TPrivateScrollBarFlags
00758         {
00759 
00761         ENoComponentsToDisplay          =0x10000,
00762 
00764         EIncreaseButtonsDimmed          =0x20000,
00765 
00767         EDecreaseButtonsDimmed          =0x40000
00768         };
00769 
00771     enum TPointerDownOn
00772         {
00774         ENone,
00775 
00777         EHomeButton,
00778 
00780         EDecreasePageButton,
00781 
00783         EDecreaseNudgeButton,
00784 
00786         EDecreaseShaft,
00787 
00789         EThumb,
00790 
00792         EIncreaseShaft,
00793 
00795         EIncreaseNudgeButton,
00796 
00798         EIncreasePageButton,
00799 
00801         EEndButton
00802         };
00803 
00805     enum TShaftRedrawRequired
00806         {
00808         ENoRedrawRequired,
00809 
00811         ERedrawShaft
00812         };
00813 
00815     enum TWhichButtons
00816         {
00818         EIncreaseOnly,
00819 
00821         EDecreaseOnly,
00822 
00824         EAll
00825         };
00826 
00832     struct SEikScrollBarButtons
00833         {
00835         CAknScrollButton* iDecreaseNudge;
00836 
00838         CAknScrollButton* iIncreaseNudge;
00839         };
00840 
00841 
00842 private:
00843     // construction/destruction
00844     IMPORT_C virtual void CreateButtonL(CAknScrollButton*& aButton,
00845                                         CAknScrollButton::TType aType);
00846 
00847     void SizeChanged();
00848 
00849     // set state functions
00850     void DoSetModel(const TEikScrollBarModel* aModel);
00851 
00852     CEikCba* Cba() const;
00853 
00854     // These functions are for use only be CEikScrollBarFrame (a friend class)
00855     void AddExternalFrameL(CEikScrollBarFrame* aFrame);
00856     void RemoveExternalFrame(CEikScrollBarFrame* aFrame);
00857 
00858     void DisconnectExternalFrames();
00859 
00860 protected:
00861 
00865     void CreateRequiredComponentsL();
00866 
00872     void DestroyButton(CAknScrollButton*& aButton);
00873 
00879     IMPORT_C virtual void SetButtonPositionL(CAknScrollButton* aButton);
00880 
00881 public:
00882 
00888     TScrollBarType ScrollBarType();
00889 
00890 public:
00891 
00893     TDblQueLink iSBLink;
00894 
00895 protected:
00896 
00898     SEikScrollBarButtons iButtons;
00899 
00901     TOrientation iOrientation;
00902 
00903 private:
00904     TEikScrollBarModel iModel;
00905 
00906 protected:    
00907 
00909     CEikScrollBarExtensionImpl* iExtension;
00910   };
00911 
00912 
00923 class CEikArrowHeadScrollBar : public CEikScrollBar
00924         {
00925 public:
00926         IMPORT_C CEikArrowHeadScrollBar(CCoeControl* aParentWindow);
00927         IMPORT_C ~CEikArrowHeadScrollBar();
00928 public: // from CEikScrollBar
00929         IMPORT_C void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
00930                                 TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
00931 public: // From CCoeControl
00932     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);      
00933 private: // from CEikScrollBar
00934         void CreateButtonL(CAknScrollButton*& aButton,CAknScrollButton::TType aType);
00935         void SetButtonPositionL(CAknScrollButton* aButton);
00936 private:
00937 private:
00941     IMPORT_C void* ExtensionInterface( TUid aInterface );
00942 private:
00943         CCoeControl* iParentControl;
00944     TInt iSpare;
00945         };
00946 
00947 
00962 class CAknDoubleSpanScrollBar : public CEikScrollBar
00963         {
00964 public:
00965         IMPORT_C CAknDoubleSpanScrollBar(CCoeControl* aParentWindow);
00966         IMPORT_C ~CAknDoubleSpanScrollBar();
00967 
00976     IMPORT_C void SetFixedLayoutRect(TRect aScrollBarRect);
00977 
00990     IMPORT_C void ConstructL(TBool aWindowOwning, MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
00991                                 TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
00992 
01002     IMPORT_C void SetScrollPopupInfoTextL( const TDesC& aText );
01003 
01010     TRect FixedLayoutRect();
01011 
01012 public: // from CEikScrollBar
01013         IMPORT_C void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
01014                                 TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
01015     IMPORT_C void MakeVisible(TBool aVisible);
01016 
01017 public: // from CCoeControl
01018     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
01019 
01020 protected: // from CCoeControl
01021         IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
01022     IMPORT_C TInt CountComponentControls() const;
01023 
01024 private:  // from CCoeControl
01025     IMPORT_C void SizeChanged();
01026     
01027 public:
01028         
01029         TBool DrawBackgroundState();
01030         
01031         void DrawBackground(TBool aDrawHorizontal);
01032         
01033 private:
01037     IMPORT_C void* ExtensionInterface( TUid aInterface );
01038 private: // from CEikScrollBar
01039         void CreateButtonL(CAknScrollButton*& aButton,CAknScrollButton::TType aType);
01040         void SetButtonPositionL(CAknScrollButton* aButton);
01041 
01049     void SetTransparentBackground(TBool aTransparentBackground);
01050 
01051 
01052 private:
01053         CCoeControl* iParentControl;
01054     TInt iSpare;
01055         };
01056 
01057 
01058 //
01059 // Inlines
01060 //
01061 
01062 
01063 inline const TEikScrollBarModel* CEikScrollBar::Model() const
01064         { return &iModel; }
01065 
01066 inline CAknScrollButton* CEikScrollBar::IncreaseNudgeButton() const
01067         { return iButtons.iIncreaseNudge; }
01068 
01069 inline CAknScrollButton* CEikScrollBar::DecreaseNudgeButton() const
01070         { return iButtons.iDecreaseNudge; }
01071 
01072 
01073 #endif

Copyright © Nokia Corporation 2001-2008
Back to top