widgetmodel/alfwidgetmodel/inc/ialfhostapi.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     1 /*
       
     2 * Copyright (c) 2007 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:  Interface implements by CAlfWidgetControl to provide containment
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef I_ALFHOSTAPI_H
       
    20 #define I_ALFHOSTAPI_H
       
    21 
       
    22 #include <alf/ialfinterfacebase.h>
       
    23 #include <alf/alflayout.h>
       
    24 #include <alf/ialfwidgetcontrol.h>
       
    25 
       
    26 namespace Alf
       
    27     {
       
    28 
       
    29 class IAlfLayoutManager;
       
    30 class CAlfWidgetControl;
       
    31 
       
    32 enum AlfRole
       
    33     {
       
    34     EChild,
       
    35     EParent
       
    36     };
       
    37 
       
    38 namespace alfhostapi
       
    39     {
       
    40 static const IfId ident =
       
    41     {
       
    42     0, "alfhostapi"
       
    43     };
       
    44     }
       
    45 /**
       
    46  * The interface for host appis used by widget controls.
       
    47  *
       
    48  * @lib alfwidgetmodel.lib
       
    49  * @since S60 ?S60_version
       
    50  * @status Draft
       
    51  */
       
    52 class IAlfHostAPI : public IAlfInterfaceBase
       
    53     {
       
    54 public:
       
    55 
       
    56     static inline const IfId& type()
       
    57         {
       
    58         return alfhostapi::ident;
       
    59         }
       
    60 
       
    61     virtual inline ~IAlfHostAPI() {}
       
    62 
       
    63     /**
       
    64      * Sets a connection from this host to a given control.
       
    65      * 
       
    66      * A control can never have more than one host control. If the connected
       
    67      * control has a host control the connection from old host control
       
    68      * to connected control will be removed.
       
    69      *
       
    70      * @param aControl  Control to be connected.
       
    71      * @param aRole     Relationship with connected control.
       
    72      */
       
    73     virtual void setConnection(CAlfWidgetControl& aControl, AlfRole aRole) = 0;
       
    74 
       
    75     /**
       
    76      * Get the connected control at given index.
       
    77      *
       
    78      * @param  aIndex Index of connected control.
       
    79      * @return Connected control at given index. If index is not found returns null.
       
    80      */
       
    81     virtual CAlfWidgetControl* getConnection(int aIndex) const = 0;
       
    82     
       
    83     /**
       
    84      * gets the number of connections
       
    85      *
       
    86      * @since S60 ?S60_version
       
    87      */
       
    88     virtual int getConnectionCount() const = 0;
       
    89     
       
    90     /**
       
    91      * gets the connection index of aControl
       
    92      *
       
    93      * @since S60 ?S60_version
       
    94      * @param aControl control, which index to return.
       
    95      */
       
    96     virtual int getConnectionIndex(CAlfWidgetControl& aControl) const = 0;
       
    97 
       
    98     /**
       
    99      * Removes connection with the given control.
       
   100      *
       
   101      * If the connected control is in the same control group with host control,
       
   102      * it will be removed from the host control's control group.
       
   103      * 
       
   104      * If the connected control is in a separate control group or if the
       
   105      * host control is not in a control group, the connected control's control
       
   106      * group relation will not be affected.
       
   107      *
       
   108      * @see setConnection()
       
   109      *
       
   110      * @param aControl Control with which connection is to be removed.
       
   111      */
       
   112     virtual void removeConnection(CAlfWidgetControl& aControl) = 0;
       
   113 
       
   114     /**
       
   115      * Sets the base layout of control.
       
   116      *
       
   117      * @param aLayout Base layout.
       
   118      */
       
   119     virtual void setBaseLayout(IAlfLayoutManager& aLayout) = 0;
       
   120 
       
   121     /**
       
   122      * Returns the base layout of control.
       
   123      *
       
   124      * @return Base layout of control.Returns null id there is no base layout.
       
   125      */
       
   126     virtual IAlfLayoutManager* getBaseLayout() const = 0;
       
   127 
       
   128 
       
   129     };
       
   130 
       
   131     } // namespace Alf
       
   132 
       
   133 #endif // I_ALFHOSTAPI_H