uiaccelerator_plat/alf_visual_api/inc/alf/alfviewportlayout.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:   Viewport layout definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFVIEWPORTLAYOUT_H
       
    21 #define C_ALFVIEWPORTLAYOUT_H
       
    22 
       
    23 #include <alf/alflayout.h>
       
    24 
       
    25 /**
       
    26  *  Viewport layout
       
    27  *  Usage:
       
    28  *  @code
       
    29  *  // Aim is to zoom into one of the grids of icons using a viewport layout.
       
    30  *
       
    31  *  // Create a anchor layout and grid layout into the parent anchor layout and 
       
    32  *  // populate it with application icons.
       
    33  * 
       
    34  *  // The viewport layout sits in the middle of the screen.
       
    35  *   parent->SetRelativeAnchorRect(1, EAlfAnchorOriginHCenter, EAlfAnchorOriginVCenter, TAlfRealPoint(-0.2, -0.2),
       
    36  *                                    EAlfAnchorOriginHCenter, EAlfAnchorOriginVCenter, TAlfRealPoint(0.2, 0.2));
       
    37  *   
       
    38  *   // Create the viewport.
       
    39  *   CAlfViewportLayout* viewport = CAlfViewportLayout::AddNewL(*this, parent);
       
    40  * 
       
    41  *  // Set our virtual coordinate system to be based on the number of items in the grid (KNumGridItems).
       
    42  *   viewport->SetVirtualSize(TAlfRealSize(KNumGridItems, 1.0), 0);
       
    43  *   
       
    44  *   // Set the size and position of the viewport to look at the middle icon in the list.
       
    45  *   viewport->SetViewportSize(TAlfRealSize(2, 1.0/6.0), 0);
       
    46  *   viewport->SetViewportPos(TAlfRealPoint(TReal32(KNumGridItems/2)-1.0f, 5.0/12.0), 0);
       
    47  *   
       
    48  *   // This anchor layout will contain a strip of large icons clipped by the viewport window.
       
    49  *   CAlfAnchorLayout* zoomedParent = CAlfAnchorLayout::AddNewL(*this, viewport);     
       
    50  *   
       
    51  *  @endcode
       
    52  * 
       
    53  *  @lib alfclient.lib
       
    54  *  @since S60 v3.2
       
    55  */
       
    56 class CAlfViewportLayout : public CAlfLayout
       
    57     {
       
    58 
       
    59 public:
       
    60 
       
    61     /**
       
    62      * Two-phased constructor, which attach new object into the control.
       
    63      * @param aOwnerControl Control that owns this new obejct.
       
    64      * @param aParentLayout If given, the new object is set as child.
       
    65      */
       
    66     IMPORT_C static CAlfViewportLayout* AddNewL(CAlfControl& aOwnerControl,
       
    67                                             CAlfLayout* aParentLayout = 0);
       
    68 
       
    69     /**
       
    70      * Constructor.
       
    71      */
       
    72     IMPORT_C CAlfViewportLayout();
       
    73 
       
    74     /**
       
    75      * Second-phase constructor.
       
    76      */
       
    77     IMPORT_C void ConstructL(CAlfControl& aOwner);
       
    78 
       
    79     /**
       
    80      * Virtual destructor.
       
    81      */
       
    82     IMPORT_C ~CAlfViewportLayout();
       
    83 
       
    84     /** @beginAPI */
       
    85 
       
    86 	/**
       
    87 	 * Set virtual size of the viewable area.
       
    88 	 *
       
    89 	 * This is different from the physical size of the viewport -
       
    90 	 * it defines the coordinate space that is used for scrolling.
       
    91 	 * To use a normalised (u, v) coordinate mapping system, set aSize to (,1.0, 1.0).
       
    92 	 *
       
    93 	 * @param aSize The bottom-right corner of the child visual, in the units you wish to use for positioning the viewport.
       
    94 	 * @param aTransitionTime The time it will take to complete the resizing of the virtual size.
       
    95 	 */
       
    96     IMPORT_C void SetVirtualSize(const TAlfRealSize& aSize, TInt aTransitionTime);
       
    97 
       
    98 	/**
       
    99 	 * Set size of the viewport area.
       
   100 	 *
       
   101 	 * This is the size of the "window" we are using to look at the visual.
       
   102 	 *
       
   103 	 * @param aSize The size of the viewport in the units defined by SetVirtualSize().
       
   104 	 * @param aTransitionTime The time it will take to complete the resizing of the viewport area.
       
   105 	 * @see SetVirtualSize, SetViewportPos
       
   106 	 */
       
   107     IMPORT_C void SetViewportSize(const TAlfRealSize& aSize, TInt aTransitionTime);
       
   108 
       
   109 	/**
       
   110 	 * Set position of the viewport area.
       
   111 	 *
       
   112 	 * This is the offset of the "window" we are using to look at the visual.
       
   113 	 *
       
   114 	 * @param aSize The size of the viewport in the units defined by SetVirtualSize().
       
   115 	 * @param aTransitionTime The time it will take to complete moving the viewport area.
       
   116 	 * @see SetVirtualSize, SetViewportSize
       
   117 	 */
       
   118     IMPORT_C void SetViewportPos(const TAlfRealPoint& aPos, TInt aTransitionTime);
       
   119 
       
   120     /** @endAPI */
       
   121 
       
   122     /**
       
   123      * From CAlfVisual
       
   124      * @see CAlfVisual
       
   125      */
       
   126     IMPORT_C void RemoveAndDestroyAllD();
       
   127     IMPORT_C void UpdateChildrenLayout(TInt aTransitionTime = 0);
       
   128     IMPORT_C CAlfVisual* FindTag(const TDesC8& aTag);
       
   129     
       
   130     /** 
       
   131      * From CAlfLayout
       
   132      * @see CAlfLayout
       
   133      */
       
   134     IMPORT_C TAlfXYMetric BaseUnit() const; 
       
   135 
       
   136 
       
   137 protected:
       
   138     /**
       
   139      * From CAlfVisual
       
   140      * @see CAlfVisual
       
   141      */
       
   142     IMPORT_C void DoRemoveAndDestroyAllD();
       
   143     IMPORT_C void PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
       
   144 
       
   145 
       
   146 private:
       
   147 
       
   148     // Private data structure. Owned.
       
   149     struct TViewportLayoutPrivateData;
       
   150     TViewportLayoutPrivateData* iViewportLayoutData;
       
   151 
       
   152     };
       
   153 
       
   154 
       
   155 
       
   156 #endif // C_ALFVIEWPORTLAYOUT_H