javauis/lcdui_akn/lcdui/inc/CMIDEditingStateIndicator.h
branchRCL_3
changeset 14 04becd199f91
child 18 9ac0a0a7da70
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implements MID edit indicator container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMIDEDITINGSTATEINDICATOR_H
       
    20 #define CMIDEDITINGSTATEINDICATOR_H
       
    21 
       
    22 // EXTERNAL INCLUDES
       
    23 #include <AknIndicatorContainer.h>
       
    24 #include <aknEditStateIndicator.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MMIDCustomComponentContainer;
       
    28 
       
    29 // CLASS DESCRIPTION
       
    30 /**
       
    31  * Implements MID edit indicator container.
       
    32  */
       
    33 NONSHARABLE_CLASS(CMIDEditingStateIndicator) :
       
    34         public CAknIndicatorContainer,
       
    35         public MAknEditingStateIndicator
       
    36 {
       
    37 public: // Type definitions
       
    38 
       
    39     /**
       
    40      * Indicator's state
       
    41      */
       
    42     enum TIndicatorState
       
    43     {
       
    44         // Disabled. Should not be shown
       
    45         EIndicatorStateDisabled = 0,
       
    46         // Relative to a component.
       
    47         EIndicatorStateRelative,
       
    48         // Freely positioned.
       
    49         EIndicatorStateAbsolute
       
    50     };
       
    51 
       
    52 public: // Constructors and destructor
       
    53 
       
    54     /**
       
    55      * Two-phased constructor. Creates an instance from this class
       
    56      * The caller takes the ownership of the returned instance
       
    57      *
       
    58      * @return New instance from this class
       
    59      */
       
    60     static CMIDEditingStateIndicator* NewL();
       
    61 
       
    62     /**
       
    63      * Destructor.
       
    64      */
       
    65     virtual ~CMIDEditingStateIndicator();
       
    66 
       
    67 public: // From CCoeControl
       
    68 
       
    69     /**
       
    70      * Sets the container window for this UI control.
       
    71      *
       
    72      * @param aParent The container window for this control.
       
    73      * @since S60 5.0
       
    74      */
       
    75     void SetContainerWindowL(CCoeControl* aParent);
       
    76 
       
    77     /**
       
    78      * Sets the size of this indicator container.
       
    79      *
       
    80      * Note: Some parameters for the size can be constant.
       
    81      * Note: Calling this function results in a call to SizeChanged().
       
    82      * Note: Calling this function results in a call to PositionChanged().
       
    83      *
       
    84      * @param aWidth The width of the indicator in pixels.
       
    85      * @param aHeight The height of the indicator in pixels.
       
    86      * @since S60 5.0
       
    87      */
       
    88     void SetSize(TInt aWidth, TInt aHeight);
       
    89 
       
    90 public: // From CCoeControl
       
    91 
       
    92     /**
       
    93      * Draws the background for this indicator container.
       
    94      *
       
    95      * @param aRect The rect to which to draw.
       
    96      * @since S60 5.0
       
    97      */
       
    98     void Draw(const TRect& aRect) const;
       
    99 
       
   100 public: // From MAknEditingStateIndicator
       
   101 
       
   102     /**
       
   103      * Sets editing state indicator state.
       
   104      *
       
   105      * @param aState State of the editing indicator.
       
   106      * @since S60 5.0
       
   107      */
       
   108     void SetState(TAknEditingState aState);
       
   109 
       
   110     /**
       
   111      * Gets pointer to indicator container that contains
       
   112      * the editing state indicators.
       
   113      *
       
   114      * @return Indicator container of the editing indicators.
       
   115      * @since S60 5.0
       
   116      */
       
   117     CAknIndicatorContainer* IndicatorContainer();
       
   118 
       
   119 public: // New methods
       
   120 
       
   121     /**
       
   122      * Gets an object whose type is encapsulated by the
       
   123      * specified <code>TTypeUid object</code>.
       
   124      *
       
   125      * @param aId Encapsulates the Uid that identifies the type
       
   126      *        of object required.
       
   127      * @return Encapsulates the pointer to the object provided.
       
   128      *         Note that the encapsulated pointer may be NULL.
       
   129      * @since S60 5.0
       
   130      */
       
   131     TTypeUid::Ptr SupplyIndicatorMopObject(TTypeUid aId);
       
   132 
       
   133     /**
       
   134      * Sets the position of this indicator component.
       
   135      *
       
   136      * Position is relative to the parent object.
       
   137      *
       
   138      * @param aX The x coordinate of the anchor point.
       
   139      * @param aY The y coordinate of the anchor point.
       
   140      * @since S60 5.0
       
   141      */
       
   142     void SetPosition(TInt aX, TInt aY);
       
   143 
       
   144     /**
       
   145      * Sets this indicator component visible if it is hidden.
       
   146      *
       
   147      * Depending on the current status of the indicator, this operation
       
   148      * is no-op if there is nothing to do. (i.e. the indicator is set
       
   149      * hidden when it is already hidden).
       
   150      *
       
   151      * @param aVisible Indicates the visibility status of the indicator.
       
   152      * @since S60 5.0
       
   153      */
       
   154     void SetVisibleL(TBool aVisible);
       
   155 
       
   156     /**
       
   157      * Returns the state of this indicator.
       
   158      *
       
   159      * @return The state of this indicator.
       
   160      * @since S60 5.0
       
   161      */
       
   162     TIndicatorState EnabledState() const;
       
   163 
       
   164     /**
       
   165      * Sets a new state for this indicator.
       
   166      *
       
   167      * @param aState The new state.
       
   168      * @since S60 5.0
       
   169      */
       
   170     void SetEnabledState(TIndicatorState aState);
       
   171 
       
   172 public: // New methods
       
   173 
       
   174     /**
       
   175      * Redraws the indicator's content correctly.
       
   176      *
       
   177      * Note that this method must be used to redraw the indicator correctly
       
   178      * in situations that the background color is transparent.
       
   179      * @since S60 5.0
       
   180      */
       
   181     void Redraw() const;
       
   182 
       
   183     /**
       
   184      * Used to override default colors.
       
   185      *
       
   186      * @see CCoeControl::OverrideColorL()
       
   187      *
       
   188      * @param aLogicalColor The logical colour. Indicates which part of a
       
   189      *        control the physical colour maps to. The set of logical
       
   190      *        colours for a standard application are defined in
       
   191      *        TLogicalColor.
       
   192      *
       
   193      * @param aColor The new physical colour to which the logical colour
       
   194      *        should be mapped.
       
   195      * @since S60 5.0
       
   196      */
       
   197     void OverrideColorL(TInt aLogicalColor, TRgb aColor);
       
   198 
       
   199 private: // From CAknIndicatorContainer
       
   200 
       
   201     /**
       
   202      * Needs to be defined here for linking compatibility.
       
   203      * @since S60 5.0
       
   204      */
       
   205     void Reserved_1();
       
   206 
       
   207 private: // Construtors
       
   208 
       
   209     /**
       
   210      * C++ constructor.
       
   211      */
       
   212     CMIDEditingStateIndicator();
       
   213 
       
   214     /**
       
   215      * Second phase constructor
       
   216      */
       
   217     void ConstructL();
       
   218 
       
   219 private: // New methods
       
   220 
       
   221     /**
       
   222      * Sets new indicator to container
       
   223      *
       
   224      * @param aIndicator Indicator id.
       
   225      * @param aState     State of the indicator.
       
   226      * @param aDrawNow   Should the indicator be drawn now.
       
   227      * @since S60 5.0
       
   228      */
       
   229     void SetIndicator(TInt aIndicator, TInt aState, TBool aDrawNow);
       
   230 
       
   231 private: // Data
       
   232 
       
   233     // State of the indicators.
       
   234     TIndicatorState iState;
       
   235     // Editing state.
       
   236     TAknEditingState iEditingState;
       
   237     // Background color of the indicator.
       
   238     TRgb iBackgroundColor;
       
   239     // Top parent of this control. Not owned.
       
   240     CCoeControl* iParent;
       
   241 };
       
   242 
       
   243 #endif // CMIDEDITINGSTATEINDICATOR_H
       
   244 
       
   245 // End of file