⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aknexslidercontainer.h

📁 symbian 中 滚动条的使用 可以用在亮度
💻 H
字号:
/*  Copyright (c) 2004, Nokia. All rights reserved */

#ifndef __AKNEXSLIDERCONTAINER_H__
#define __AKNEXSLIDERCONTAINER_H__

// INCLUDES
#include <coecntrl.h>

// CONSTANTS
const TInt KAknExSliderInitialValue = 0;
const TInt KAknExSliderMessageBufLength = 256;

const TInt KSliderInformationOffset = 5;
const TInt KSliderClearValue = 0;
const TInt KSliderInitValue = 40;
const TInt KSliderBaseMinValue = 0;
const TInt KSliderBaseMaxValue = 100;
const TInt KSliderBaseStepSize = 2;
const TInt KSliderCountComponentControls = 1;
// for Range screen
const TInt KSliderMaxChangeRange = 40;
const TInt KSliderChangeRangeValue = 10;
const TInt KSliderTextHeightDivide = 2;
// for Step size screen
const TInt KSliderStepChangeCount = 3;
const TInt KSliderStepChangeSize[KSliderStepChangeCount] = { 2, 5, 10 };
const TInt KSliderInitialStepIndex = 0;
// for Current value screen
const TInt KSliderNormalRemainder = 0;
// for Value type screen
const TInt KSliderInitialValueOfValueTypeScreen = 100;
// for Text appearance screen
const TInt KSliderInitialValueOfTextScreen = 1;
const TInt KSliderMaxValueOfTextScreen = 5;
// for change state of slider
#define AKNEXSLIDER_HEADER_CHANGE_KEY   EKeyEnter
#define AKNEXSLIDER_HEADER_CHANGE_KEY2  EKeyOK
#define AKNEXSLIDER_MINIMUM_CHANGE_KEY  EKeyEnter
#define AKNEXSLIDER_MINIMUM_CHANGE_KEY2 EKeyOK
#define AKNEXSLIDER_MAXIMUM_CHANGE_KEY  EKeyEnter
#define AKNEXSLIDER_MAXIMUM_CHANGE_KEY2 EKeyOK
#define AKNEXSLIDER_RANGE_CHANGE_KEY    EKeyEnter
#define AKNEXSLIDER_RANGE_CHANGE_KEY2   EKeyOK
#define AKNEXSLIDER_VALUE_CHANGE_KEY    EKeyEnter
#define AKNEXSLIDER_VALUE_CHANGE_KEY2   EKeyOK
#define AKNEXSLIDER_STEP_CHANGE_KEY     EKeyEnter
#define AKNEXSLIDER_STEP_CHANGE_KEY2    EKeyOK

#define AKNEXSLIDER_WHITE TRgb( 0xFF,0xFF,0xFF )

// FORWARD DECLARATIONS
class CAknExSliderView;
class CAknSlider;
class CEikLabel;

// CLASS DECLARATION

/**
* CAknExSliderContainer container control class.
*
*/
class CAknExSliderContainer : public CCoeControl, public MCoeControlObserver
    {
    private: // Enumerations

        /**
        * TAknExSliderLabelState
        */
        enum TAknExSliderLabelState
            {
            EAknExSliderLabelTitle,
            EAknExSliderLabelInformation
            };

        /**
        * TAknExSliderComponentControls
        */
        enum TAknExSliderComponentControls
            {
            EAknExSliderComponentLabel,
            EAknExSliderComponentSlider
            };

        /**
        * TAknExSliderChangeLabels
        */
        enum TAknExSliderChangeLabels
            {
            EAknExSliderChangeLabel1 = 1,
            EAknExSliderChangeLabel2,
            EAknExSliderChangeLabel3,
            EAknExSliderChangeLabel4
            };

        /**
        * TAknExSliderChangeLabels
        */
        enum TAknExSliderChangeOfTextAppearanceScreen
            {
            EAknExSliderChangeText1 = 1,
            EAknExSliderChangeText2,
            EAknExSliderChangeText3,
            EAknExSliderChangeText4,
            EAknExSliderChangeText5
            };

    public: // Constructors and destructor

        /**
        * CAknExSliderContainer
        * Default constructor.
        * @param aView 
        */
        CAknExSliderContainer( CAknExSliderView* aView );

        /**
        * ConstructL
        * Constructor.
        * @param aRect Frame rectangle for container.
        */
        void ConstructL( const TRect& aRect );

        /**
        * ~CAknExSliderContainer
        * Destructor.
        */
        virtual ~CAknExSliderContainer();

    public: // New functions

        /**
        * HandleCommandL
        * Handles the commands.
        * @param aCommand command to be handled
        */
        void HandleCommandL( TInt aCommand );

        /**
        * DisplayNextFeature
        * Sets ID of feature to displayed next.
        */
        void DisplayNextFeature();

    public: // From CCoeControl

        /**
        * From CoeControl,OfferKeyEventL.
        * Handles the key-events.
        * @return if key-event is consumed, EKeyWasConsumed. Else EKeyWasNotConsumed.
        * @param aKeyEvent Key event
        * @param aType Type of key event( EEventKey, EEventKeyUp or EEventKeyDown )
        */
        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
            TEventCode aType );

    private: // New functions

        /**
        * StopDisplaySlider
        * If slider control displays slider object is deleted.
        */
        void StopDisplaySlider();

        /**
        * SetLabelState
        * Sets font and alignment of label.
        * @param aLabel
        */
        void SetLabelState( TAknExSliderLabelState aLabel );

        /**
        * DisplayFeatureL
        * Displays the slider and label.
        */
        void DisplayFeatureL();

        /**
        * DisplaySliderL
        * Creates slider object.
        * @param aResourceId The ID of resource ( Slider structure )
        * @param aValue Inital current value of slider control
        */
        void DisplaySliderL( TInt aResourceId,
                             TInt aValue = KAknExSliderInitialValue );

        /**
        * DisplayFormL
        * Creates and displays form object.
        * @param aResourceId The id of resource ( Form struct )
        */
        void DisplayFormL( TInt aResourceId );

        /**
        * DisplayInformationL
        * Displays the information.
        * @param aResourceId The id of resource ( Text )
        */
        void DisplayInformationL( TInt aResourceId );
 
        /**
        * SetLabelL
        * Sets string in the label.
        * @param aInformation Text which is displayed
        */
        void SetLabelL( TDesC& aInformation );

        /**
        * SetValueTextL
        * Makes the string which is displayed.
        * @param aTextBuf Reference to TDes class object.
        * @return Text which is displayed
        */
        TDesC* SetValueTextL( TDes& aTextBuf ) const;

        /**
        ChangeLabelL
        * Changes the display of the label.
        */
        void ChangeLabelL();

        /**
        * ChangeScreenOfTextAppearance
        * Changes the display of the value text in slider of each value type.
        */
        void ChangeScreenOfTextAppearance();

    private: // From CCoeControl

        /**
        * From CoeControl, CountComponentControls.
        * Returns number of components.
        * @return Number of controls
        */
        TInt CountComponentControls() const;

        /**
        * From CCoeControl, ComponentControl.
        * Returns pointer to particular component.
        * @return Pointer to Control's component control, identified by index
        * @param aIndex Index of the control
        */
        CCoeControl* ComponentControl( TInt aIndex ) const;

        /**
        * From CCoeControl, Draw.
        * Clears the window's rectangle.
        * @param aRect Region of the control to be ( re )drawn
        */
        void Draw( const TRect& aRect ) const;

    private: // From MCoeControlObserver
        /**
        * From MCoeControlObserver, HandleControlEventL.
        * Handles the event when state change.
        * @param aControl Pointer to control object
        * @param aEventType Event type
        */
        void HandleControlEventL( 
            CCoeControl* aControl,
            TCoeEvent aEventType );

    private: //data

        /**
        * iSlider
        * Owned by CAknExSliderContainer object.
        */
        CAknSlider* iSlider;

        /**
        * iLabel
        * Owned by CAknExSliderContainer object.
        */
        CEikLabel* iLabel;

        /**
        * iLabelFormat
        */
        TBuf<KAknExSliderMessageBufLength> iLabelFormat;

        /**
        * iCurrentFeature
        */
        TInt iCurrentFeature;

        /**
        * iCurrentLabel
        */
        TInt iCurrentLabel;

        /**
        * iCurrentStep
        */
        TInt iCurrentStep;

        /**
        * iScreenStep
        */
        TInt iScreenStep;

        /**
        * iView
        * Does not own
        */
        CAknExSliderView* iView;

    };

#endif // __AKNEXSLIDERCONTAINER_H__

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -