taskswitcher/contextengine/tsfswserver/client/inc/tsfswclient.h
changeset 4 4d54b72983ae
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Client API
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TSFSWCLIENT_H
       
    20 #define TSFSWCLIENT_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include "tsfswentry.h"
       
    24 
       
    25 class MTsFswObserver;
       
    26 class CTsFswClientImpl;
       
    27 
       
    28 /**
       
    29  * Client API for the Huriganes Fast Swap Server.
       
    30  */    
       
    31 NONSHARABLE_CLASS( CTsFswClient ) : public CBase
       
    32     {
       
    33 public:
       
    34     /**
       
    35      * Possible values for aType argument of ForegroundAppUid().
       
    36      */
       
    37     enum TTsFswFgAppType
       
    38         {
       
    39         /**
       
    40          * Means that even when the foreground app has another app embedded
       
    41          * into it the uid of the container application will be returned.
       
    42          */
       
    43         EUseStandaloneUid,
       
    44         /**
       
    45          * Means that if the foreground app has another app embedded
       
    46          * into it then the returned uid will be the uid of the embedded
       
    47          * app.
       
    48          */
       
    49         EUseEmbeddedUid
       
    50         };
       
    51 
       
    52     /**
       
    53      * Creates a new instance.
       
    54      * @capability LocalServices
       
    55      */
       
    56     IMPORT_C static CTsFswClient* NewL();
       
    57     
       
    58     /**
       
    59      * Creates a new instance.
       
    60      * @capability LocalServices
       
    61      */
       
    62     IMPORT_C static CTsFswClient* NewLC();
       
    63     
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     ~CTsFswClient();
       
    68     
       
    69     /**
       
    70      * Queries the fast swap content from the server and
       
    71      * copies it into the given array.
       
    72      * Previous content of the array is removed (by using ResetAndDestroy).
       
    73      * @param   aDst    array to which data is stored
       
    74      * @capability LocalServices
       
    75      */
       
    76     IMPORT_C void GetContentL( RTsFswArray& aDst );
       
    77     
       
    78     /**
       
    79      * Subscribes for continuous notifications about changes in the
       
    80      * fast swap content.
       
    81      * The notifications are generated until CancelSubscribe is called
       
    82      * or the instance is destroyed.
       
    83      * @capability LocalServices
       
    84      */
       
    85     IMPORT_C void Subscribe( MTsFswObserver& aObserver );
       
    86     
       
    87     /**
       
    88      * Cancels the subscription for change notifications.
       
    89      * @capability LocalServices
       
    90      */
       
    91     IMPORT_C void CancelSubscribe();
       
    92     
       
    93     /**
       
    94      * Tries to close the application with the given id.
       
    95      * @capability LocalServices
       
    96      */
       
    97     IMPORT_C void CloseApp( TInt aWgId );
       
    98     
       
    99     /**
       
   100      * Brings the application with the given id into foreground.
       
   101      * @capability LocalServices
       
   102      */
       
   103     IMPORT_C void SwitchToApp( TInt aWgId );
       
   104 
       
   105     /**
       
   106      * Returns the uid of the foreground app or KNullUid if something goes wrong.
       
   107      *
       
   108      * Will never return hidden apps, only those which can also be seen in the
       
   109      * array returned by GetContentL.
       
   110      *
       
   111      * However the handling of embedded applications might be different:
       
   112      * (as opposed to GetContentL)
       
   113      * If aType == EUseEmbeddedUid:
       
   114      *   This function will always return the embedded application's uid, unlike
       
   115      *   GetContentL which will always refer to the container app (except for the
       
   116      *   screenshot of course). This means that the returned uid is simply the
       
   117      *   uid belonging to the first (non-hidden, etc.) window group from the window group list.
       
   118      * If aType == EUseStandaloneUid:
       
   119      *   Embedded applications are ignored and the returned uid is the app uid belonging
       
   120      *   to the first parentless window group.
       
   121      */
       
   122     IMPORT_C TUid ForegroundAppUid( TTsFswFgAppType aType );
       
   123 
       
   124 private:
       
   125     CTsFswClient();
       
   126     void ConstructL();
       
   127 
       
   128     CTsFswClientImpl* iImpl;
       
   129     };
       
   130 
       
   131 #endif