calendarui/commonutils/src/calentitlepane.cpp
branchRCL_3
changeset 66 bd7edf625bdd
parent 0 f979ecb2b13e
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
       
     1 /*
       
     2 * Copyright (c) 2002 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:  An underline is drawn for DayView to TitlePane.
       
    15  *
       
    16 */
       
    17 
       
    18 //debug
       
    19 #include "calendarui_debug.h"
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "calentitlepane.h"
       
    23 
       
    24 #include <eikspane.h>
       
    25 #include <eiklabel.h>
       
    26 #include <avkon.hrh>
       
    27 
       
    28 //  LOCAL CONSTANTS AND MACROS
       
    29 
       
    30 // ================= MEMBER FUNCTIONS =======================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // ?classname::?member_function
       
    34 // ?implementation_description
       
    35 // (other items were commented in a header).
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CCalenTitlePane& CCalenTitlePane::StaticL()
       
    39     {
       
    40     TRACE_ENTRY_POINT;
       
    41     
       
    42     CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
    43     CCalenTitlePane* tp = static_cast<CCalenTitlePane*>(sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
       
    44     
       
    45     TRACE_EXIT_POINT;
       
    46     return *tp;
       
    47     }
       
    48 
       
    49 // Two-phased constructor.;
       
    50 // Creates CCalenTitlePane, and swaps previous CAknTitlePane
       
    51 EXPORT_C CCalenTitlePane* CCalenTitlePane::NewAndSwapL(CEikStatusPane* aPane) 
       
    52     {
       
    53     TRACE_ENTRY_POINT;
       
    54     
       
    55     CCalenTitlePane* self = new(ELeave)CCalenTitlePane;
       
    56     CleanupStack::PushL(self);
       
    57     CCoeControl* previous = aPane->SwapControlL(
       
    58         TUid::Uid(EEikStatusPaneUidTitle), self);
       
    59 
       
    60     TRect previousRect(0, 0, 0, 0);
       
    61     if (previous)
       
    62         {
       
    63         previousRect = previous->Rect();
       
    64         delete previous;
       
    65         previous = NULL;
       
    66         }
       
    67 
       
    68     CCoeControl* ctrl = aPane->ContainerControlL(
       
    69         TUid::Uid(EEikStatusPaneUidTitle));
       
    70     self->SetContainerWindowL(*ctrl);
       
    71     self->ConstructL();
       
    72     self->SetRect(previousRect);
       
    73     self->ActivateL();
       
    74     CleanupStack::Pop(self);
       
    75     
       
    76     TRACE_EXIT_POINT;
       
    77     return self;
       
    78     }
       
    79 
       
    80 
       
    81 // Destructor
       
    82 EXPORT_C CCalenTitlePane::~CCalenTitlePane()
       
    83     {
       
    84     TRACE_ENTRY_POINT;
       
    85     TRACE_EXIT_POINT;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // CCalenTitlePane::SetUnderLine
       
    90 // Set underline flag to CEikLabel
       
    91 // (other items were commented in a header).
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 void CCalenTitlePane::SetUnderLine(TBool aUnderline)
       
    95     {
       
    96     TRACE_ENTRY_POINT;
       
    97     
       
    98     CEikLabel* label = static_cast<CEikLabel*>( ComponentControl(0) );
       
    99 
       
   100     if (iOrgContext)
       
   101         {
       
   102         iOrgContext = ControlContext();
       
   103         }
       
   104     SetControlContext(this);
       
   105 
       
   106     label->SetUnderlining(aUnderline);
       
   107     
       
   108     TRACE_EXIT_POINT;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------
       
   112 // CCalenTitlePane::UnderLine
       
   113 // Returns underline flag
       
   114 // (other items were commented in a header).
       
   115 // ---------------------------------------------------------
       
   116 //
       
   117 TBool CCalenTitlePane::UnderLine()
       
   118     {
       
   119     TRACE_ENTRY_POINT;
       
   120     
       
   121     CEikLabel* label = static_cast<CEikLabel*>( ComponentControl(0) );
       
   122     
       
   123     TRACE_EXIT_POINT;
       
   124     return label->IsUnderlined();
       
   125     }
       
   126 
       
   127 // C++ default constructor can NOT contain any code, that
       
   128 // might leave.
       
   129 //
       
   130 // -----------------------------------------------------------------------------
       
   131 // ?classname::?member_function
       
   132 // ?implementation_description
       
   133 // (other items were commented in a header).
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 CCalenTitlePane::CCalenTitlePane()
       
   137     {
       
   138     TRACE_ENTRY_POINT;
       
   139     TRACE_EXIT_POINT;
       
   140     }
       
   141 
       
   142 
       
   143 // ---------------------------------------------------------
       
   144 // CCalenTitlePane::PrepareContext
       
   145 // Relpaces from a nallow font to a bold font
       
   146 // (other items were commented in a header).
       
   147 // ---------------------------------------------------------
       
   148 //
       
   149 void CCalenTitlePane::PrepareContext(CWindowGc& aGc) const
       
   150     {
       
   151     TRACE_ENTRY_POINT;
       
   152 
       
   153     if (iOrgContext)
       
   154         {
       
   155         iOrgContext->PrepareContext(aGc);
       
   156         }
       
   157 
       
   158     TRACE_EXIT_POINT;
       
   159     }
       
   160 
       
   161 // End of File