widgetmodel/alfwidgetmodel/inc/alfwidgetimpl.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:  The private implementation of CAlfWidget.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFWIDGETIMPL_H
       
    20 #define ALFWIDGETIMPL_H
       
    21 
       
    22 #include <osn/ustring.h>
       
    23 #include <osn/alfptrvector.h>
       
    24 using osncore::UString;
       
    25 using osncore::AlfPtrVector;
       
    26 
       
    27 namespace Alf
       
    28     {
       
    29 
       
    30 class CAlfWidgetControl;
       
    31 class IAlfModel;
       
    32 class AlfWidget;
       
    33 class AlfAttribute;
       
    34 class AlfAttributeValueType;
       
    35 class AlfWidgetAttributeOwnerImpl;
       
    36 
       
    37 /**
       
    38  *  The private implementation of AlfWidget.
       
    39  *  The methods are documented in the class AlfWidget.
       
    40  *
       
    41  *  @lib alfwidgetmodel.lib
       
    42  *  @since S60 ?S60_version
       
    43  */
       
    44 class AlfWidgetImpl
       
    45     {
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Constructor.
       
    50      *
       
    51      * @since S60 ?S60_version
       
    52      */
       
    53     AlfWidgetImpl();
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      *
       
    58      * @since S60 ?S60_version
       
    59      */
       
    60     ~AlfWidgetImpl();
       
    61     /**
       
    62      * control.
       
    63      *
       
    64      * @since S60 ?S60_version
       
    65      */
       
    66     CAlfWidgetControl* control();
       
    67     /**
       
    68      * setControl.
       
    69      *
       
    70      * @since S60 ?S60_version
       
    71      */
       
    72     void setControl( CAlfWidgetControl* aControl,bool aDeletePreviousControl);
       
    73     /**
       
    74      * model.
       
    75      *
       
    76      * @since S60 ?S60_version
       
    77      */
       
    78     IAlfModel* model();
       
    79     /**
       
    80      * setModel.
       
    81      *
       
    82      * @since S60 ?S60_version
       
    83      */
       
    84     void setModel( IAlfModel* aModel ,bool aTakeOwnership);
       
    85 
       
    86     /**
       
    87      * Set the id of the widget.
       
    88      *
       
    89      * @since S60 ?S60_version
       
    90      * @param aWidgetName The name of the widget instance.
       
    91      */
       
    92     void setWidgetName( const UString& aWidgetName );
       
    93     /**
       
    94      * widgetName.
       
    95      *
       
    96      * @since S60 ?S60_version
       
    97      */
       
    98     const UString& widgetName() const;
       
    99     
       
   100     /**
       
   101      * Add a widget to the widgets array.
       
   102      *
       
   103      * @param aWidget The widget to be appended to the array of widgets.
       
   104      */
       
   105     void addWidget(AlfWidget *aWidget);
       
   106     
       
   107     /**
       
   108      * Return total number of widgets in the list.
       
   109      */
       
   110     int  widgetCount();
       
   111     
       
   112     /**
       
   113      * Return widget at the index
       
   114      */
       
   115     AlfWidget* getWidget(int aIndex);
       
   116     
       
   117     /**
       
   118      * Returns the index of the widget in this array.
       
   119      * If the given widget is not found from the array -1
       
   120      * is returned.
       
   121      *
       
   122      * @param aWidget Widget to be searched from the array.
       
   123      * @return Index of the widget in the internal array or -1 if the widget
       
   124      * is not found.
       
   125      */
       
   126     int findWidget(AlfWidget* aWidget);
       
   127         
       
   128     /*
       
   129      *Removes a widget at given index
       
   130      */
       
   131     void removeWidget(int aIndex); 
       
   132     
       
   133     /*
       
   134      * Returns attribute owner interface.Ownership is not transferred.
       
   135      *
       
   136      * @return attribute owner interface.
       
   137      */
       
   138     AlfWidgetAttributeOwnerImpl* getAttributeOwner();
       
   139 
       
   140 private: // data
       
   141 
       
   142     /**
       
   143      * The control. Not own.
       
   144      */
       
   145     CAlfWidgetControl* mControl;
       
   146 
       
   147     /**
       
   148      * The model. Own.
       
   149      */
       
   150     IAlfModel* mModel;
       
   151 
       
   152     /**
       
   153      * The widget id. Own.
       
   154      */
       
   155     UString mWidgetName;
       
   156 
       
   157     AlfPtrVector<AlfAttribute> mAttributeList;
       
   158 
       
   159     AlfPtrVector<AlfWidget> mWidgets;
       
   160     bool mTakesModelOwnership;
       
   161     
       
   162     /*
       
   163      * IAlfAttributeOwner implementation. Own.
       
   164      */
       
   165     auto_ptr<AlfWidgetAttributeOwnerImpl> mAttributeOwnerImpl;
       
   166 
       
   167 private:
       
   168 
       
   169     friend class AlfWidget;
       
   170     };
       
   171 
       
   172     } // namespace Alf
       
   173 
       
   174 #endif // C_ALFWIDGETIMPL_H