uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h
changeset 0 15bf7259bb7c
child 3 d8a3531bc6b8
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:  A wrapper for the window group list, adding additional functionality required by OOM Monitor v2
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef GOOMWINDOWGROUPLIST_H_
       
    19 #define GOOMWINDOWGROUPLIST_H_
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32hashtab.h>
       
    23 #include <w32std.h>
       
    24 
       
    25 class CApaWindowGroupName;
       
    26 
       
    27 /**
       
    28  *  This class holds a snapshot of the window group tree. 
       
    29  *  
       
    30  *  The window group tree is collapsed (see CollapseWindowGroupTree) to remove child windows as we are only 
       
    31  *  interested in a single window group Id per application.
       
    32  *
       
    33  *  @lib goommonitor.lib
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 NONSHARABLE_CLASS(CGOomWindowGroupList) : public CBase
       
    37     {
       
    38 public:
       
    39     
       
    40     static CGOomWindowGroupList* NewL(RWsSession& aWs);
       
    41     
       
    42     // Update the list of window groups
       
    43     void RefreshL();
       
    44     
       
    45     // Update the list of window groups, non-leaving version
       
    46     void Refresh();
       
    47     
       
    48     // Return the number of application instances in this list
       
    49     inline TUint Count() const;
       
    50     
       
    51     TUint AppId(TInt aIndex, TBool aResolveFromThread = EFalse) const;
       
    52     TUint AppIdfromWgId(TInt aWgId, TBool aResolveFromThread = EFalse) const;
       
    53         
       
    54     inline const RWsSession::TWindowGroupChainInfo& WgId(TInt aIndex) const;
       
    55     
       
    56     TTimeIntervalSeconds IdleTime(TInt aIndex) const;
       
    57   
       
    58     ~CGOomWindowGroupList();
       
    59     
       
    60     void SetPriorityBusy(TInt aWgId);
       
    61     
       
    62     void SetPriorityNormal(TInt aWgId);
       
    63     
       
    64     void SetPriorityHigh(TInt aWgId);
       
    65     
       
    66     TBool IsBusy(TInt wgIndex);
       
    67     
       
    68     // Returns ETrue if an application has registered itself as high priority at runtime
       
    69     TBool IsDynamicHighPriority(TInt wgIndex);
       
    70     
       
    71     CApaWindowGroupName* WgName() const;
       
    72     
       
    73     // Find the specificed application in the window group list and return the index
       
    74     TInt GetIndexFromAppId(TUint aAppId) const;
       
    75     
       
    76 private:    
       
    77 
       
    78     void CollapseWindowGroupTree();
       
    79     
       
    80     void RemovePropertiesForClosedWindowsL();
       
    81 
       
    82     TInt FindParentIdL(TInt aWgId);
       
    83 
       
    84 private:
       
    85     
       
    86     CGOomWindowGroupList(RWsSession& aWs);
       
    87     
       
    88     void ConstructL();
       
    89     
       
    90     RArray<RWsSession::TWindowGroupChainInfo> iWgIds;
       
    91     RArray<RWsSession::TWindowGroupChainInfo> iUncollapsedWgIds;
       
    92     
       
    93     enum TGOomPriority
       
    94         {
       
    95         EGOomPriorityNormal,
       
    96         EGOomPriorityHigh,
       
    97         EGOomPriorityBusy
       
    98         };
       
    99     
       
   100     class TGOomWindowGroupProperties
       
   101         {
       
   102     public:
       
   103         TGOomWindowGroupProperties();
       
   104         TUint32 iIdleTickTime;
       
   105         TGOomPriority iDynamicPriority;
       
   106         };
       
   107         
       
   108     RHashMap<TInt, TGOomWindowGroupProperties> iWgToPropertiesMapping; // A mapping between window group IDs and the properties such as idle time and the high-priority flag
       
   109     RHashSet<TInt> iExistingWindowIds; // Used locally in RemoveIdleTimesForClosedWindows(), declared globally because we need to reserve space    
       
   110     
       
   111     RWsSession& iWs;    
       
   112         
       
   113     CApaWindowGroupName* iWgName;
       
   114     HBufC* iWgNameBuf;              // owned by iWgName
       
   115     };
       
   116 
       
   117 #include "goomwindowgrouplist.inl"
       
   118 
       
   119 #endif /*GOOMWINDOWGROUPLIST_H_*/