uifw/AknGlobalUI/AknCapServer/src/eiksrvsp.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Server side status pane implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "eiksrvsp.h"
       
    20 #include <AknDef.h>
       
    21 #include <AknUtils.h>
       
    22 #include <AknStatuspaneUtils.h>
       
    23 #include "aknstatuspanedatapublisher.h"
       
    24 
       
    25 // ===========================================================================
       
    26 // class CEikServStatusPane
       
    27 // Server side status pane implementation.
       
    28 // ===========================================================================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CEikServStatusPane::NewL
       
    32 // Factory method for the server side status pane.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CEikServStatusPane* CEikServStatusPane::NewL( CEikonEnv& aEikEnv,
       
    36                                               RWindowGroup* aParent, 
       
    37                                               TInt aCoreResId )
       
    38     {
       
    39     CEikServStatusPane* self =
       
    40         new (ELeave) CEikServStatusPane( aEikEnv, aParent );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aCoreResId );
       
    43     CleanupStack::Pop( self );
       
    44     return self;
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CEikServStatusPane::~CEikServStatusPane
       
    50 // Destructor.
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CEikServStatusPane::~CEikServStatusPane()
       
    54     {
       
    55     CAknSgcClient::SetStatusPaneRedrawCoordinator(NULL);
       
    56     delete iDataPublisher;
       
    57     }
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CEikServStatusPane::SetBlankWinObserver
       
    62 // Sets the status pane observer for the screen blanker.
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 void CEikServStatusPane::SetBlankWinObserver(
       
    66     MEikStatusPaneObserver* aBlankWinObserver )
       
    67     {
       
    68     iBlankWinObserver = aBlankWinObserver;
       
    69     
       
    70     // If we have blankwin, then disable statuspanes own blanker.
       
    71     if ( iBlankWinObserver )
       
    72         {
       
    73         DisableClearer( ETrue );
       
    74         }
       
    75     else
       
    76         {
       
    77         DisableClearer( EFalse );
       
    78         }
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CEikServStatusPane::CEikServStatusPane
       
    84 // C++ constructor.
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 CEikServStatusPane::CEikServStatusPane( CEikonEnv& aEikEnv,
       
    88                                         RWindowGroup* aParent )
       
    89     : CEikStatusPaneBase( aEikEnv, aParent )
       
    90     {
       
    91     CAknSgcClient::SetStatusPaneRedrawCoordinator( this );
       
    92     }
       
    93 
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CEikServStatusPane::ConstructL
       
    97 // Second-phase constructor.
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CEikServStatusPane::ConstructL( TInt aCoreResId )
       
   101     {
       
   102     BaseConstructL( aCoreResId );
       
   103     iDataPublisher = CAknStatusPaneDataPublisher::NewL();
       
   104     }
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CEikServStatusPane::CreateModelL
       
   109 // Creates the server side status pane model.
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 CEikStatusPaneModelBase* CEikServStatusPane::CreateModelL(
       
   113     TInt aCoreResId ) const
       
   114     {
       
   115     return CEikServStatusPaneModel::NewL( iEikEnv, aCoreResId, *this );
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CEikServStatusPane::IsApp
       
   121 // Returns EFalse as server side status pane.
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 TBool CEikServStatusPane::IsApp() const
       
   125     {
       
   126     return EFalse;
       
   127     }
       
   128 
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CEikServStatusPane::SetFaded
       
   132 // Does nothing, as fading is now handled by the Window Server and the
       
   133 // Application Framework.
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 void CEikServStatusPane::SetFaded( TBool /*aFaded*/ )
       
   137     {
       
   138     }
       
   139 
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // CEikServStatusPane::BlockServerStatusPaneRedrawsL
       
   143 // Status pane redraw blocker is not used anymore.
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 void CEikServStatusPane::BlockServerStatusPaneRedrawsL()
       
   147     {
       
   148     }
       
   149 
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // CEikServStatusPane::RedrawServerStatusPane
       
   153 // Redraws the server side status pane.
       
   154 // ---------------------------------------------------------------------------
       
   155 //
       
   156 void CEikServStatusPane::RedrawServerStatusPane()
       
   157     {
       
   158     // All status pane drawing is done on the application side.
       
   159     }
       
   160 
       
   161 
       
   162 // ---------------------------------------------------------------------------
       
   163 // CEikServStatusPane::HandleShapeChangeL
       
   164 // Handles event caused by status pane shape change.
       
   165 // ---------------------------------------------------------------------------
       
   166 //
       
   167 void CEikServStatusPane::HandleShapeChangeL() const
       
   168     {
       
   169     if ( iBlankWinObserver )
       
   170         {
       
   171         iBlankWinObserver->HandleStatusPaneSizeChange();
       
   172         }
       
   173     }
       
   174 
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // CEikServStatusPane::PrepareForAppExit
       
   178 // Prepares status pane for application exit.
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 void CEikServStatusPane::PrepareForAppExit()
       
   182     {
       
   183     CommonPrepareForAppExit();  
       
   184     }
       
   185 
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // CEikServStatusPane::SetCurrentAppStatuspaneResourceId
       
   189 // Sets the current status pane layout resource ID of the application side.
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 void CEikServStatusPane::SetCurrentAppStatuspaneResourceId( TInt aResourceId )
       
   193     {
       
   194     iCurrentAppStatuspaneResourceId = aResourceId;              
       
   195     DisableClearer( ETrue );  // Makes clearer invisible.
       
   196     DisableClearer( EFalse ); // Enables clearer again for next event.
       
   197     }
       
   198 
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CEikServStatusPane::CurrentAppStatuspaneResourceId
       
   202 // Returns the current status pane layout resource ID in the application side.
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 TInt CEikServStatusPane::CurrentAppStatuspaneResourceId()
       
   206     {
       
   207     return iCurrentAppStatuspaneResourceId;
       
   208     }
       
   209 
       
   210 
       
   211 // ---------------------------------------------------------------------------
       
   212 // CEikServStatusPane::HandleResourceChange
       
   213 // Handles resource change events.
       
   214 // ---------------------------------------------------------------------------
       
   215 //
       
   216 void CEikServStatusPane::HandleResourceChange( TInt aType )
       
   217     {
       
   218     CEikStatusPaneBase::HandleResourceChange( aType );
       
   219 
       
   220     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   221         {
       
   222         iCurrentAppStatuspaneResourceId = CurrentLayoutResId(); 
       
   223         }
       
   224     
       
   225     iDataPublisher->SetIndicatorPopupPosition();
       
   226     }
       
   227 
       
   228 
       
   229 void CEikServStatusPane::SwitchLayoutL( TInt aLayoutResourceId )
       
   230     {
       
   231     AknLayoutUtils::TAknCbaLocation prevCbaLocation = AknLayoutUtils::CbaLocation();
       
   232 
       
   233     if( aLayoutResourceId != CurrentLayoutResId() )
       
   234         {
       
   235         CEikStatusPaneBase::SwitchLayoutL( aLayoutResourceId );
       
   236         iDataPublisher->SetIndicatorPopupPosition();
       
   237         }
       
   238 
       
   239     if ( prevCbaLocation != AknLayoutUtils::CbaLocation() )
       
   240         {
       
   241         CEikAppUi *appUi = dynamic_cast<CEikAppUi *>(CCoeEnv::Static()->AppUi());
       
   242         if ( appUi )
       
   243             {
       
   244             appUi->ReportResourceChangedToAppL( KEikDynamicLayoutVariantSwitch );
       
   245             }
       
   246         }
       
   247     }
       
   248 
       
   249 
       
   250 // ===========================================================================
       
   251 // class CEikServStatusPaneModel
       
   252 // Server side status pane model class implementation.
       
   253 // ===========================================================================
       
   254 
       
   255 
       
   256 // ---------------------------------------------------------------------------
       
   257 // CEikServStatusPaneModel::NewL
       
   258 // Two-phased constructor.
       
   259 // ---------------------------------------------------------------------------
       
   260 //
       
   261 CEikServStatusPaneModel* CEikServStatusPaneModel::NewL(
       
   262     CEikonEnv& aEikEnv,
       
   263     TInt aCoreResId, 
       
   264     const MEikServStatusPaneShapeChangeObserver& aShapeObserver )
       
   265     {
       
   266     CEikServStatusPaneModel* self =
       
   267         new (ELeave) CEikServStatusPaneModel( aEikEnv, aShapeObserver );
       
   268     CleanupStack::PushL( self );
       
   269     self->ConstructL( aCoreResId );
       
   270     CleanupStack::Pop( self );
       
   271     return self;
       
   272     }
       
   273 
       
   274 
       
   275 // ---------------------------------------------------------------------------
       
   276 // CEikServStatusPaneModel::~CEikServStatusPaneModel
       
   277 // Destructor.
       
   278 // ---------------------------------------------------------------------------
       
   279 //
       
   280 CEikServStatusPaneModel::~CEikServStatusPaneModel()
       
   281     {
       
   282     }
       
   283 
       
   284 
       
   285 // ---------------------------------------------------------------------------
       
   286 // CEikServStatusPaneModel::CEikServStatusPaneModel
       
   287 // C++ constructor.
       
   288 // ---------------------------------------------------------------------------
       
   289 //
       
   290 CEikServStatusPaneModel::CEikServStatusPaneModel(
       
   291     CEikonEnv& aEikEnv, 
       
   292     const MEikServStatusPaneShapeChangeObserver& aShapeObserver )
       
   293     : CEikStatusPaneModelBase( aEikEnv ), iShapeObserver( aShapeObserver )
       
   294     {
       
   295     }
       
   296 
       
   297 
       
   298 // ---------------------------------------------------------------------------
       
   299 // CEikServStatusPaneModel::ConstructL
       
   300 // Second-phase constructor.
       
   301 // ---------------------------------------------------------------------------
       
   302 //
       
   303 void CEikServStatusPaneModel::ConstructL( TInt aCoreResId )
       
   304     {
       
   305     BaseConstructL( aCoreResId );
       
   306 
       
   307     CIdSet* ids = LegalIds();
       
   308     TInt count  = ids->Count();
       
   309 
       
   310     iLayouts = new (ELeave) CLayoutIdSet( count );
       
   311     for ( TInt i = 0; i < count; ++i )
       
   312         {
       
   313         LoadLayoutL( ids->At( i ) );
       
   314         }
       
   315 
       
   316     SetLayoutL( iCurrentResId, ETrue );
       
   317     }
       
   318 
       
   319 
       
   320 // ---------------------------------------------------------------------------
       
   321 // CEikServStatusPaneModel::SetLayoutL
       
   322 // Sets the status pane layout.
       
   323 // ---------------------------------------------------------------------------
       
   324 //
       
   325 void CEikServStatusPaneModel::SetLayoutL( TInt aLayoutResId,
       
   326                                           TBool aChangeStatusPaneNow )
       
   327     {
       
   328     CEikStatusPaneModelBase::SetLayoutL( aLayoutResId, aChangeStatusPaneNow );
       
   329     iShapeObserver.HandleShapeChangeL();
       
   330     }
       
   331 
       
   332 // End of file