williamr@2: /* williamr@2: * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: ?Description williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #if !defined(__AKNSCBUT_H__) williamr@2: #define __AKNSCBUT_H__ williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: williamr@2: class CAknScrollIndicator; williamr@2: williamr@2: /** williamr@2: * Implements a scroll buttons of a scroll bar. williamr@2: * williamr@2: * @since Series 60 0.9 williamr@2: */ williamr@2: NONSHARABLE_CLASS(CAknScrollButton) : public CAknControl williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Indicates a Scroll button's type williamr@2: */ williamr@2: enum TType williamr@2: { williamr@2: /** Scroll button to move the display to the left. */ williamr@2: ENudgeLeft, williamr@2: /** Scroll button to move the display up. */ williamr@2: ENudgeUp, williamr@2: /** Scroll button to move the display to the right. */ williamr@2: ENudgeRight, williamr@2: /** Scroll button to move the display down. */ williamr@2: ENudgeDown, williamr@2: /** Scroll button to move the display page to the left. */ williamr@2: EPageLeft, williamr@2: /** Scroll button to move the display page up. */ williamr@2: EPageUp, williamr@2: /** Scroll button to move the display page to the right.*/ williamr@2: EPageRight, williamr@2: /** Scroll button to move the display page down. */ williamr@2: EPageDown, williamr@2: /** Scroll button to move the display to the home position. */ williamr@2: EHome, williamr@2: /** Scroll button to move the display to the top. */ williamr@2: ETop, williamr@2: /** Scroll button to move the display to the end position. */ williamr@2: EEnd, williamr@2: /** Scroll button to move the display to the bottom. */ williamr@2: EBottom williamr@2: }; williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Indicates a scroll bar's type. williamr@2: */ williamr@2: enum TTypeOfScrollBar williamr@2: { williamr@2: /** Normal scroll bar */ williamr@2: ENormal =0x00, williamr@2: /** Arrow headed scroll bar */ williamr@2: EArrowHead =0x01 williamr@2: }; williamr@2: williamr@2: public: // class specific functions williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * @param aType scroll button's type. williamr@2: * @return A fully constructed @c CAknScrollButton object. williamr@2: */ williamr@2: IMPORT_C static CAknScrollButton* NewL(TType aType); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CAknScrollButton(); williamr@2: williamr@2: /** williamr@2: * Gets a scroll button's type. williamr@2: * @return The scroll button's type. williamr@2: */ williamr@2: IMPORT_C TType Type() const; williamr@2: williamr@2: /** williamr@2: * Creates a window only for arrows. williamr@2: * Sets the container window to be this class. williamr@2: * @param aParent The control to be the parent of this control. williamr@2: */ williamr@2: IMPORT_C void CreateWindowOnlyForArrowsL(const CCoeControl* aParent); williamr@2: williamr@2: /** williamr@2: * Determines whether a scroll button is owned by normal scroll bar. williamr@2: * @return @c ETrue if a scroll button is owned by the normal scroll bar, williamr@2: * @c EFalse if not williamr@2: */ williamr@2: IMPORT_C TBool IsNormalScrollBarUsingButton() const; williamr@2: williamr@2: /** williamr@2: * Sets the type of scroll bar which owns the button. williamr@2: * @param aTypeOfScrollBar The type of the scroll bar. williamr@2: */ williamr@2: IMPORT_C void SetTypeOfScrollBarUsingButton(TTypeOfScrollBar aTypeOfScrollBar); williamr@2: williamr@2: /** williamr@2: * Sets the new focus position in the control and the span length. williamr@2: * @param aFocusPosition The new focus position. williamr@2: * @param aScrollSpan The new span length. williamr@2: */ williamr@2: IMPORT_C void SetPosition(const TInt aFocusPosition, const TInt aScrollSpan); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * @param aType scroll button's type. williamr@2: * @param aTypeOfScrollBar scroll bar type, this information is needed at construction williamr@2: * time when creating button for double span scroll bar (ie. the parameter is ENormal) williamr@2: * @return A fully constructed @c CAknScrollButton object. williamr@2: */ williamr@2: IMPORT_C static CAknScrollButton* NewL(TType aType, TTypeOfScrollBar aTypeOfScrollBar); williamr@2: williamr@2: void SetContainerWindowL( const CCoeControl& aControl ); williamr@2: TInt CountComponentControls() const; williamr@2: CCoeControl* ComponentControl( TInt aIndex ) const; williamr@2: williamr@2: private: // class specific functions williamr@2: CAknScrollButton(TType aType); williamr@2: void ConstructL(); williamr@2: void SizeChanged(); williamr@2: void DrawIndicator() const; williamr@2: void ConstructL(TTypeOfScrollBar aTypeOfScrollBar); williamr@2: private: // from CCoeControl williamr@2: virtual void Draw(const TRect& aRect) const; williamr@2: private: williamr@2: friend class CAknScrollBar; williamr@2: TType iType; williamr@2: TInt iFlag; williamr@2: CAknScrollIndicator* iScrollIndicator; williamr@2: TRect iOldRect; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif