taskswitcher/utils/inc/tswindowgroupsobserver.h
changeset 124 e36b2f4799c0
parent 121 0b3699f6c654
child 125 26079c1bb561
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    17 #ifndef TSWINDOWGROUPSOBSERVER_H
    17 #ifndef TSWINDOWGROUPSOBSERVER_H
    18 #define TSWINDOWGROUPSOBSERVER_H
    18 #define TSWINDOWGROUPSOBSERVER_H
    19 
    19 
    20 #include "tsresourcemanager.h"
    20 #include "tsresourcemanager.h"
    21 
    21 
       
    22 class MTsRunningApplication
       
    23     {
       
    24 public:
       
    25     virtual TUid UidL()const =0;
       
    26     virtual const TDesC& CaptionL() const =0;
       
    27     virtual TBool IsHiddenL() const =0;
       
    28     virtual TBool IsSystemL() const =0;
       
    29     virtual TInt WindowGroupId() const =0;
       
    30     virtual TInt ParentWindowGroupId() const =0;
       
    31     virtual TBool IsEmbeded() const =0;
       
    32     
       
    33 
       
    34     };
       
    35 
       
    36 class MTsRunningApplicationStorage
       
    37     {
       
    38 public:
       
    39     virtual const MTsRunningApplication& operator[] (TInt aOffset) const=0;
       
    40     virtual TInt Count() const =0;
       
    41     virtual TInt ParentIndex( const MTsRunningApplication& aRaunningApp ) const =0;
       
    42     virtual TArray<TInt> BlockedWindowGroups() const =0;
       
    43 
       
    44     };
       
    45 
    22 /**
    46 /**
    23  * Interface declare mathods to notify about window server events
    47  * Interface declare mathods to notify about window server events
    24  */
    48  */
    25 class MTsWindowGroupsObserver
    49 class MTsWindowGroupsObserver
    26 {
    50 {
    27 public:
    51 public:
    28     /**
    52     /**
    29      * Method notidy about window group changes.
    53      * Method notify about window group changes.
    30      * @param rsc - resource manager
    54      * @param aResources - resource manager
    31      * @param wgs - list of window groups associated with running applications
    55      * @param aStorage - list of running applications
    32      */
    56      */
    33     virtual void HandleWindowGroupChanged(MTsResourceManager &rsc, 
    57     virtual void HandleWindowGroupChanged(MTsResourceManager &aResources, 
    34                                           const TArray<RWsSession::TWindowGroupChainInfo> & wgs) =0;
    58                                           const MTsRunningApplicationStorage& aStorage) =0;
    35 };
    59 };
    36 
    60 
    37 /**
    61 /**
    38  * Interface declare methods to subscribe windo server events
    62  * Interface declare methods to subscribe windo server events
    39  */
    63  */
    82 
   106 
    83 private:
   107 private:
    84     MTsWindowGroupsMonitor & mMonitor;
   108     MTsWindowGroupsMonitor & mMonitor;
    85 };
   109 };
    86 
   110 
    87 /**
       
    88  * Window server monitor implementation.
       
    89  */
       
    90 class CTsWindowGroupsMonitor: public CActive, 
       
    91                               public MTsWindowGroupsMonitor
       
    92                               
       
    93 {
       
    94 public:
       
    95     /**
       
    96      * Two phase constructor
       
    97      */
       
    98     static CTsWindowGroupsMonitor* NewL(MTsResourceManager &);
       
    99     
       
   100     /**
       
   101      * Destructor
       
   102      */
       
   103     ~CTsWindowGroupsMonitor();
       
   104     
       
   105     /**
       
   106      * @see MTsWindowGroupsMonitor::SubscribeL
       
   107      */
       
   108     void SubscribeL(MTsWindowGroupsObserver &);
       
   109     
       
   110     /**
       
   111      * @see MTsWindowGroupsMonitor::Cancel
       
   112      */
       
   113     void Cancel(MTsWindowGroupsObserver &);
       
   114 
       
   115 protected:
       
   116     /**
       
   117      * @see CActive::RunL
       
   118      */
       
   119     void RunL();
       
   120     
       
   121     /**
       
   122      * @see CActive::DoCancel
       
   123      */
       
   124     void DoCancel();
       
   125     
       
   126     /**
       
   127      * @see CActive::RunError
       
   128      */
       
   129     TInt RunError(TInt error);
       
   130 
       
   131 private:
       
   132     /**
       
   133      * First phase constructor
       
   134      */
       
   135     CTsWindowGroupsMonitor(MTsResourceManager &);
       
   136     
       
   137     /**
       
   138      * Second phase constructor
       
   139      */
       
   140     void ConstructL();
       
   141     
       
   142     /**
       
   143      * Function subscribe for event to window server and activate object
       
   144      */
       
   145     void Subscribe();
       
   146     
       
   147     /**
       
   148      * Function provide window server event to observers
       
   149      */
       
   150     void ProvideEventL();
       
   151     
       
   152     /**
       
   153      * Function provide window server event to observer
       
   154      */
       
   155     void ProvideEventL(TWsEvent, MTsWindowGroupsObserver &);
       
   156 
       
   157 private:
       
   158     /**
       
   159      * Registry of subscribed observers
       
   160      */
       
   161     RPointerArray<MTsWindowGroupsObserver> mObservers;
       
   162     
       
   163     /**
       
   164      * Resources manager
       
   165      */
       
   166     MTsResourceManager &mResources;
       
   167     
       
   168     /**
       
   169      * Monitor window group
       
   170      */
       
   171     RWindowGroup mWg;
       
   172 };
       
   173 #endif //TSWINDOWGROUPSOBSERVER_H
   111 #endif //TSWINDOWGROUPSOBSERVER_H