williamr@2: /* williamr@2: * Copyright (c) 2002-2006 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: The CAknIpFieldEditor class implements an editor for an williamr@2: * IP address. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #if !defined(__AKNIPFED_H_) williamr@2: #define __AKNIPFED_H_ williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: williamr@2: // FORWARD DECLERATIONS williamr@2: class TInetAddr; williamr@2: williamr@2: //CLASS DECLERATION williamr@2: /** williamr@2: * The @c CAknIpFieldEditor class implements an editor for an IP address. williamr@2: * Based on Crystal @c CCknIpFieldEditor. williamr@2: * williamr@2: * @since Series 60 0.9 williamr@2: */ williamr@2: class CAknIpFieldEditor : public CEikMfne williamr@2: { williamr@2: public: // public constructors williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: IMPORT_C CAknIpFieldEditor(); williamr@2: williamr@2: /** williamr@2: * Two phased constructor. williamr@2: * @param aMinimumAddress Reference to a @c TInetAddr struct. Defines lower williamr@2: * limits for IP editor fields. williamr@2: * @param aMaximumAddress Reference to a @c TInetAddr struct. Defines upper williamr@2: * limits for IP editor fields. williamr@2: * @param aInitialAddress Reference to a @c TInetAddr struct. Defines the williamr@2: * initial address of the IP editor. williamr@2: * @param aFlags The number field's flags. Default is 0. williamr@2: * @return Pointer to the fully constructed @c CAknIpFieldEditor object. williamr@2: */ williamr@2: void ConstructL(TInetAddr& aMinimumAddress, williamr@2: TInetAddr& aMaximumAddress, williamr@2: TInetAddr& aInitialAddress, williamr@2: const TInt aFlags=0); williamr@2: williamr@2: /** williamr@2: * Two phased constructor. williamr@2: * Constructs a CAknIpFieldEditor object using given parameters. williamr@2: * @param aMinimumAddress Reference to a @c TInetAddr struct. Defines lower williamr@2: * limits for IP editor fields. williamr@2: * @param aMaximumAddress Reference to a @c TInetAddr struct. Defines upper williamr@2: * limits for IP editor fields. williamr@2: * @param aInitialAddress Reference to a @c TInetAddr struct. Defines the williamr@2: * initial address of the IP editor. williamr@2: * @return Pointer to the fully constructed @c CAknIpFieldEditor object. williamr@2: */ williamr@2: IMPORT_C static CAknIpFieldEditor* NewL(TInetAddr& aMinimumAddress, williamr@2: TInetAddr& aMaximumAddress, williamr@2: TInetAddr& aInitialAddress); williamr@2: williamr@2: /** williamr@2: * Two phased constructor. williamr@2: * Requires a call for @c ConstructFromResourcesL() method to finish williamr@2: * construction. williamr@2: * @return Pointer to the constructed @c CAknIpFieldEditor object. williamr@2: */ williamr@2: IMPORT_C static CAknIpFieldEditor* NewL(); williamr@2: williamr@2: public: // Methods for getting and setting values williamr@2: williamr@2: williamr@2: /** williamr@2: * Sets the editor's value dynamically. williamr@2: * @param aAddress Reference to a @c TInetAddr struct including the new williamr@2: * address. williamr@2: */ williamr@2: IMPORT_C void SetAddress(const TInetAddr& aAddress); williamr@2: williamr@2: /** williamr@2: * Gets the editor's value. williamr@2: * @return TInetAddr struct including the address. williamr@2: */ williamr@2: IMPORT_C TInetAddr Address() const; williamr@2: williamr@2: /** williamr@2: * Sets the minimum and maximum editor values. williamr@2: * @param aMinimumAddress Reference to a @c TInetAddr struct defining the williamr@2: * lower limits of the editor fields. williamr@2: * @param aMaximumAddress Reference to a @c TInetAddr struct defining the williamr@2: * upper limits of the editor fields. williamr@2: */ williamr@2: IMPORT_C virtual void SetMinimumAndMaximum( williamr@2: const TInetAddr& aMinimumAddress, williamr@2: const TInetAddr& aMaximumAddress); // only values inside the initial minimum and maximum are permitted williamr@2: williamr@2: /** williamr@2: * Gets the minimum and maximum editor values. williamr@2: * @param aMinimumAddress Reference to a @c TInetAddr struct in which the williamr@2: * lower limits are wanted to be returned. williamr@2: * @param aMaximumAddress Reference to a @c TInetAddr struct in which the williamr@2: * upper limits are wanted to be returned. williamr@2: */ williamr@2: IMPORT_C virtual void GetMinimumAndMaximum( williamr@2: TInetAddr& aMinimumAddress, williamr@2: TInetAddr& aMaximumAddress) const; williamr@2: williamr@2: /** williamr@2: * Gets an IP address from resources. williamr@2: * @param aResourceReader Reference to a resource reader associated to the williamr@2: * @c IP_FIELD resource. williamr@2: * @return TInetAddr struct including the address. williamr@2: */ williamr@2: IMPORT_C TInetAddr ReadIPAddress(TResourceReader& aResourceReader); williamr@2: williamr@2: public: // from CCoeControl williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. Constructs controls from a resource file. williamr@2: * Essential for Dialog/Form construction. williamr@2: * @param aResourceReader The resource reader with which to access williamr@2: * @c IP_FIELD_EDITOR williamr@2: * resource. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aResourceReader); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. Handles key events. williamr@2: * Called by framework when a key event occurs. williamr@2: * @param aKeyEvent The key event that occured. williamr@2: * @param aType The type of key event that occured. williamr@2: * @return @c EKeyWasConsumed if the event was processed, williamr@2: * @c EKeyWasNotConsumed if the event was not processed williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, williamr@2: TEventCode aType); williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: private: williamr@2: void SplitAddressIntoFields( williamr@2: const TInetAddr& aAddress, williamr@2: TUint8 &aFieldA, williamr@2: TUint8 &aFieldB, williamr@2: TUint8 &aFieldC, williamr@2: TUint8 &aFieldD) const; williamr@2: IMPORT_C virtual void CEikMfne_Reserved(); williamr@2: williamr@2: private: williamr@2: TInt iSpare; williamr@2: TInt iSpare2; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif