email/mail/ViewerSrc/CMailBaseControlAdapter.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:  BaseControl adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CMailBaseControlAdapter.h"
       
    22 #include    <MsgEditorView.h>  // CMsgEditorView
       
    23 #include 	<MsgEditorCommon.h>
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CMailBaseControlAdapter::CMailBaseControlAdapter
       
    30 // C++ constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CMailBaseControlAdapter::CMailBaseControlAdapter(CCoeControl& aControl)
       
    35     :iControl(aControl)
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CMailBaseControlAdapter::ConstructL
       
    41 // Symbian 2nd phase constructor can leave.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 void CMailBaseControlAdapter::ConstructL()
       
    45     {
       
    46     iControlType = EMsgBodyControl;
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CMailBaseControlAdapter::NewL
       
    51 // Two-phased constructor.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CMailBaseControlAdapter* CMailBaseControlAdapter::NewL(
       
    55     CCoeControl* aParent,
       
    56     CCoeControl& aControl)
       
    57     {
       
    58     CMailBaseControlAdapter* self = new( 
       
    59         ELeave ) CMailBaseControlAdapter(aControl);
       
    60     
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL();
       
    63     aControl.SetContainerWindowL(*aParent);
       
    64     CleanupStack::Pop(); // self
       
    65     return self;
       
    66     }
       
    67 
       
    68     
       
    69 // Destructor
       
    70 CMailBaseControlAdapter::~CMailBaseControlAdapter()
       
    71     {
       
    72     }
       
    73 
       
    74 TRect CMailBaseControlAdapter::CurrentLineRect()
       
    75     {
       
    76     return iControl.Rect();
       
    77     }
       
    78 void CMailBaseControlAdapter::SetAndGetSizeL(TSize& aSize)
       
    79     {
       
    80     SetExtent(Position(), aSize); 
       
    81     }
       
    82 void CMailBaseControlAdapter::ClipboardL(TMsgClipboardFunc /*aFunc*/)
       
    83     {
       
    84     // empty
       
    85     }
       
    86 void CMailBaseControlAdapter::EditL(TMsgEditFunc /*aFunc*/)
       
    87     {
       
    88     // empty
       
    89     }
       
    90 TBool CMailBaseControlAdapter::IsFocusChangePossible(TMsgFocusDirection aDirection) const
       
    91     {
       
    92     return (aDirection == EMsgFocusUp);
       
    93     }
       
    94 TBool CMailBaseControlAdapter::IsCursorLocation(TMsgCursorLocation aLocation) const
       
    95     {
       
    96 	if (aLocation == EMsgTop)
       
    97 		{
       
    98 		return ETrue;
       
    99 		}
       
   100 	else
       
   101 		{
       
   102 		return EFalse;
       
   103 		}   
       
   104     }
       
   105 TUint32 CMailBaseControlAdapter::EditPermission() const
       
   106     {
       
   107     return 0;
       
   108     }
       
   109 
       
   110 TInt CMailBaseControlAdapter::CountComponentControls() const
       
   111     {
       
   112     return 1; // iControl
       
   113     }
       
   114 CCoeControl* CMailBaseControlAdapter::ComponentControl(TInt /*aIndex*/) const
       
   115     {
       
   116     return &iControl; //iControl;
       
   117     }
       
   118 void CMailBaseControlAdapter::SizeChanged()
       
   119     {
       
   120     iControl.SetExtent(Position(), iControl.Size());
       
   121     }
       
   122 void CMailBaseControlAdapter::FocusChanged(TDrawNow aDrawNow)
       
   123     {
       
   124     iControl.SetFocus(IsFocused(), aDrawNow);
       
   125     }
       
   126 TInt CMailBaseControlAdapter::VirtualHeight()
       
   127     {
       
   128     return iControl.Rect().Height();
       
   129     }
       
   130 TInt CMailBaseControlAdapter::VirtualVisibleTop()
       
   131     {
       
   132     return iControl.Rect().iTl.iY; // left corner
       
   133     }
       
   134 
       
   135 /// From CCoeControl
       
   136 void CMailBaseControlAdapter::HandleResourceChange(TInt aType)
       
   137     {
       
   138     iControl.HandleResourceChange( aType );
       
   139     }
       
   140 TKeyResponse CMailBaseControlAdapter::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   141     {
       
   142     return iControl.OfferKeyEventL(aKeyEvent, aType);
       
   143     }
       
   144 
       
   145 void CMailBaseControlAdapter::PrepareForReadOnly(TBool /*aReadOnly*/)
       
   146     {
       
   147     }
       
   148 
       
   149 //  End of File