src/screensaverindicator.cpp
changeset 14 8a173132b0aa
parent 2 058b1fc1663a
equal deleted inserted replaced
2:058b1fc1663a 14:8a173132b0aa
     1 /*
       
     2 * Copyright (c) 2003 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:   Implementation screensaver indicator array.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <AknUtils.h>
       
    21 #include <barsread.h>
       
    22 #include <biditext.h>
       
    23 #include <AknsConstants.h>
       
    24 #include <AknsUtils.h>
       
    25 #include <aknlayout.cdl.h>
       
    26 #include <AknLayoutFont.h>
       
    27 #include <screensaver.rsg>
       
    28 
       
    29 #include "screensaverplugin.h"
       
    30 #include "screensaverindicator.h"
       
    31 #include "ScreensaverUtils.h"
       
    32 
       
    33 
       
    34 
       
    35 //
       
    36 // CSCreensaverIndicator
       
    37 //
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CScreensaverIndicator::~CScreensaverIndicator
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CScreensaverIndicator::~CScreensaverIndicator()
       
    44     {    
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CScreensaverIndicator::ConstructL
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CScreensaverIndicator::ConstructL(TResourceReader &aReader,
       
    52         TUint32 aBgColor, TUint aTextColor)
       
    53     {
       
    54     iId = (TScreensaverIndicatorId)aReader.ReadInt16();
       
    55     iDrawType = (TScreensaverDrawType)aReader.ReadInt16();
       
    56     iAlignment = (TScreensaverAlignment)aReader.ReadInt16();
       
    57 
       
    58     // Switch left & right alignment of indicators, if layout mirrored
       
    59     if (AknLayoutUtils::LayoutMirrored())
       
    60         {
       
    61         if (iAlignment == ESsAlignLeft)
       
    62             {
       
    63             iAlignment = ESsAlignRight;
       
    64             }
       
    65         else
       
    66             {
       
    67             iAlignment = ESsAlignLeft;
       
    68             }
       
    69         }
       
    70     iBgColor = TRgb(aBgColor);
       
    71     iTextColor = TRgb(aTextColor);
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CScreensaverIndicator::SetId
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CScreensaverIndicator::SetId(TScreensaverIndicatorId aId)
       
    79     {
       
    80     iId = aId;
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CScreensaverIndicator::Visible
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 TBool CScreensaverIndicator::Visible() const
       
    88     {
       
    89     return iVisible;
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CScreensaverIndicator::SetVisibility
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CScreensaverIndicator::SetVisibility(TBool aValue)
       
    97     {
       
    98     iVisible = aValue;
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CScreensaverIndicator::Width()
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TInt CScreensaverIndicator::Width() const
       
   106     {
       
   107     return iRect.Width();
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CScreensaverIndicator::Id
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 TScreensaverIndicatorId CScreensaverIndicator::Id() const
       
   115     {
       
   116     return iId;
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CScreensaverIndicator::Alignment
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 TScreensaverAlignment CScreensaverIndicator::Alignment() const
       
   124     {
       
   125     return iAlignment;
       
   126     }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // CScreensaverIndicator::DrawType
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 TScreensaverDrawType CScreensaverIndicator::DrawType() const
       
   133     {
       
   134     return iDrawType;
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CScreensaverIndicator::MakeSkinItemId
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 TAknsItemID CScreensaverIndicator::MakeSkinItemId(TInt aSkinBmpId)
       
   142     {
       
   143     TAknsItemID id;
       
   144     // All are AVKON generic ids
       
   145     id.Set(EAknsMajorGeneric, aSkinBmpId);
       
   146     return id;
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CScreensaverIndicator::SetType
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 void CScreensaverIndicator::SetType(TScreensaverIndicatorType aType)
       
   154     {
       
   155     iType = aType;
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CScreensaverIndicator::Type
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 TScreensaverIndicatorType CScreensaverIndicator::Type()
       
   163     {
       
   164     return iType;
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CScreensaverIndicator::SetIconLayout
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 void CScreensaverIndicator::SetIconLayout(TAknLayoutRect&, TInt) 
       
   172     {
       
   173     iVisible = ETrue;
       
   174     }
       
   175 
       
   176 // -----------------------------------------------------------------------------
       
   177 // CScreensaverIndicator::SetTextLayout
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void CScreensaverIndicator::SetTextLayout(TAknLayoutText&, TInt) 
       
   181     {
       
   182     iVisible = ETrue;
       
   183     }
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // CScreensaverIndicator::PreferredWidth
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 TInt CScreensaverIndicator::PreferredWidth() 
       
   190     { 
       
   191     return -1; 
       
   192     }
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // CScreensaverIndicator::MinimumWidth
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 TInt CScreensaverIndicator::MinimumWidth() 
       
   199     { 
       
   200     return 0; 
       
   201     }
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // CScreensaverIndicator::SetWidth
       
   205 // -----------------------------------------------------------------------------
       
   206 //
       
   207 void CScreensaverIndicator::SetWidth(TInt) 
       
   208     {
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CScreensaverIndicator::SetXPos
       
   213 // -----------------------------------------------------------------------------
       
   214 //
       
   215 void CScreensaverIndicator::SetXPos(TInt) 
       
   216     {
       
   217     }
       
   218 
       
   219 
       
   220 // End of file.