uiaccelerator_plat/alf_visual_api/inc/alf/alfcontrolgroup.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Control group
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFCONTROLGROUP_H
       
    21 #define C_ALFCONTROLGROUP_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 class CAlfEnv;
       
    26 class CAlfControl;
       
    27 class CAlfTransformation;
       
    28 class CAlfDisplay;
       
    29 
       
    30 /**
       
    31  *  A control group class is used to group controls that belong together.
       
    32  *
       
    33  *  Control group contains CAlfControl - derived classes. Control group can be
       
    34  *  used to create logical compounds of several controls. For instance all controls
       
    35  *  belonging to the same UI view can be grouped into a single control group.
       
    36  *
       
    37  *  Control groups should be instantiated through CAlfEnv::NewControlGroupL().
       
    38  *  Usage:
       
    39  *  @code
       
    40  * //Create a new control group
       
    41  *  CAlfControlGroup& group = iEnv->NewControlGroupL( KControlGroupIdDefault );
       
    42  * 
       
    43  * //Create control instance and append it to group
       
    44  *  CMyControl* control = CMyControl::ConstructL(&iEnv);
       
    45  *  group.AppendL( control );
       
    46  * 
       
    47  *  //Show control group on display
       
    48  *  iDisplay->Roster().ShowL( group );
       
    49  *  @endcode 
       
    50  *  @lib alfclient.lib
       
    51  *  @since S60 v3.2
       
    52  */
       
    53 NONSHARABLE_CLASS( CAlfControlGroup ): public CBase
       
    54     {
       
    55 public:
       
    56 
       
    57     /**
       
    58      * 1st phase constructor.
       
    59      */
       
    60     CAlfControlGroup();
       
    61     
       
    62     /**
       
    63      * 2nd phase constructor.
       
    64      * @param aResourceId Identifier.
       
    65      * @param aEnv The env.
       
    66      */
       
    67     void ConstructL( TInt aResourceId, CAlfEnv& aEnv );
       
    68 
       
    69     /**
       
    70      * Destructor.
       
    71      */
       
    72     virtual ~CAlfControlGroup();
       
    73 
       
    74     /**
       
    75      * Return the server side handle
       
    76      *
       
    77      * @return Handle to the server side CAlfSrvControlGroupSubSession object. 
       
    78      *         0 if not set.
       
    79      */
       
    80     TInt Identifier() const;
       
    81     
       
    82     /**
       
    83      * Binds a display to a control group. If a display is bound to a control group
       
    84      * it is being shown. Otherwise the control group is hidden. CAlfRoster uses
       
    85      * this method to notify control group about the display on which it is shown.
       
    86      * User should use methods in CAlfRoster to show or hide a control group.
       
    87      *
       
    88      * @see CAlfRoster
       
    89      *
       
    90      * @param aDisplay Pointer to a display on which this control group is shown,
       
    91      *                 or NULL if control group is hidden.
       
    92      */
       
    93     void BindDisplay(CAlfDisplay* aDisplay);
       
    94     
       
    95     /**
       
    96 	 * Determines the identifier of the control group (from a resource file).
       
    97 	 *
       
    98 	 * @return  Resource identifier.
       
    99 	 */
       
   100     IMPORT_C TInt ResourceId() const;
       
   101      
       
   102     /**
       
   103 	 * Adds a new control into the group. The group takes ownership of the
       
   104 	 * control.
       
   105 	 *
       
   106 	 * @param aControl  Control to insert into the group.
       
   107 	 */ 
       
   108     IMPORT_C void AppendL( CAlfControl* aControl );
       
   109     
       
   110     /**
       
   111      * Removes a control from the control group.
       
   112      *
       
   113      * @param aControl  Control to remove from the group. The control's
       
   114      *                  ownership is transferred to the caller. Note that
       
   115      *                  controls should never be used unless they are
       
   116      *                  owned by a control group.
       
   117      *
       
   118      * @return  KErrNone, if successful. KErrNotFound, if the control is not
       
   119      *          in the group.
       
   120      */
       
   121     IMPORT_C TInt Remove(CAlfControl* aControl);
       
   122     
       
   123     /**
       
   124 	 * Determines whether the group accepts input events.
       
   125 	 *
       
   126 	 * @return ETrue is accepts input.
       
   127 	 */
       
   128     IMPORT_C TBool AcceptInput() const;
       
   129     
       
   130     /**
       
   131      * Sets the input event acceptance of the group.
       
   132      *
       
   133      * @param aAcceptInput  Accept input events.
       
   134      */
       
   135     IMPORT_C void SetAcceptInput( TBool aAcceptInput );
       
   136     
       
   137     /**
       
   138      * Finds control
       
   139      * @see CAlfEnv::FindControl()
       
   140      * @return  Pointer to the control, or <code>NULL</code> if the control
       
   141      *          is not in the group.
       
   142      */
       
   143     IMPORT_C CAlfControl* FindControl( TInt aId,  TBool aUserId = ETrue ) const;
       
   144     
       
   145     /**
       
   146      * Returns the number of controls within this group.
       
   147      * 
       
   148      * @return Number of controls.
       
   149      */
       
   150     IMPORT_C TInt Count() const;
       
   151     
       
   152     /**
       
   153      * Access a control within the group, by its index into the
       
   154      * internal list of controls. Will panic if an out-of-bounds
       
   155      * index is passed.
       
   156      * 
       
   157      * @param aIndex  Index of the control to return.
       
   158      * 
       
   159      * @return Reference to the requested control. Always
       
   160      *         returns a valid control.
       
   161      */
       
   162     IMPORT_C CAlfControl& Control( TInt aIndex ) const;
       
   163     
       
   164     /**
       
   165      * Enables or disables transformation of the control group.
       
   166      *
       
   167      * @param aIsTransformed ETrue for enabling.
       
   168      */
       
   169     IMPORT_C void EnableTransformationL( TBool aIsTransformed = ETrue );
       
   170     
       
   171     /**
       
   172      * Determines if the control group has a transformation.
       
   173      *
       
   174      * @return ETrue is transformation is enabled.
       
   175      */
       
   176     IMPORT_C TBool IsTransformed() const;
       
   177     
       
   178     /**
       
   179      * Returns the transformation of the control group.
       
   180      *
       
   181      * @return  Transformation steps.
       
   182      */
       
   183     IMPORT_C CAlfTransformation& Transformation();
       
   184 
       
   185 private:
       
   186     
       
   187     // Private data. Owned.
       
   188     struct TPrivateData;
       
   189     TPrivateData* iData;
       
   190 
       
   191     };
       
   192 
       
   193 
       
   194 #endif // C_ALFCONTROLGROUP_H