|
1 /* |
|
2 * Copyright (c) 2002 - 2004 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 |
|
21 // INCLUDE FILES |
|
22 #include "CMRMsgBaseControlAdapter.h" |
|
23 #include <MsgBaseControl.h> |
|
24 #include <MsgEditorView.h> // CMsgEditorView |
|
25 #include <MsgEditorCommon.h> |
|
26 #include <CRichBio.h> |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CMRMsgBaseControlAdapter::CMRMsgBaseControlAdapter |
|
32 // C++ constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CMRMsgBaseControlAdapter::CMRMsgBaseControlAdapter( |
|
37 CRichBio& aBaseControl) |
|
38 :iBaseControl(aBaseControl) |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CMRMsgBaseControlAdapter::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CMRMsgBaseControlAdapter::ConstructL() |
|
48 { |
|
49 iControlType = EMsgBodyControl; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CMRMsgBaseControlAdapter::NewL |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CMRMsgBaseControlAdapter* CMRMsgBaseControlAdapter::NewL( |
|
58 CMsgEditorView* aParent, |
|
59 CRichBio& aControl) |
|
60 { |
|
61 CMRMsgBaseControlAdapter* self = new( |
|
62 ELeave ) CMRMsgBaseControlAdapter(aControl); |
|
63 |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 aControl.ConstructL(aParent); |
|
67 aControl.SetContainerWindowL(*aParent); |
|
68 CleanupStack::Pop(); // self |
|
69 return self; |
|
70 } |
|
71 |
|
72 |
|
73 // Destructor |
|
74 CMRMsgBaseControlAdapter::~CMRMsgBaseControlAdapter() |
|
75 { |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CMRMsgBaseControlAdapter::NotifyViewEvent |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CMRMsgBaseControlAdapter::NotifyViewEvent( |
|
83 TMsgViewEvent /*aEvent*/, TInt /*aParam*/ ) |
|
84 { |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CMRMsgBaseControlAdapter::CurrentLineRect |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 TRect CMRMsgBaseControlAdapter::CurrentLineRect() |
|
92 { |
|
93 return iBaseControl.CurrentLineRect(); |
|
94 } |
|
95 |
|
96 void CMRMsgBaseControlAdapter::SetAndGetSizeL(TSize& aSize) |
|
97 { |
|
98 TInt componentAdjustment = MsgEditorCommons::MsgBaseLineOffset(); |
|
99 aSize.iHeight -= componentAdjustment; |
|
100 TPoint pos = Position() - TPoint(0,componentAdjustment); |
|
101 SetExtent(pos, aSize); |
|
102 iBaseControl.SetAndGetSizeL( aSize ); |
|
103 } |
|
104 void CMRMsgBaseControlAdapter::ClipboardL(TMsgClipboardFunc /*aFunc*/) |
|
105 { |
|
106 //empty |
|
107 } |
|
108 void CMRMsgBaseControlAdapter::EditL(TMsgEditFunc /*aFunc*/) |
|
109 { |
|
110 //empty |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CMRMsgBaseControlAdapter::IsFocusChangePossible |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TBool CMRMsgBaseControlAdapter::IsFocusChangePossible( |
|
118 TMsgFocusDirection /*aDirection*/) const |
|
119 { |
|
120 return IsCursorLocation(EMsgTop); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CMRMsgBaseControlAdapter::IsCursorLocation |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 TBool CMRMsgBaseControlAdapter::IsCursorLocation( |
|
128 TMsgCursorLocation aLocation) const |
|
129 { |
|
130 return iBaseControl.IsCursorLocation( aLocation ); |
|
131 } |
|
132 |
|
133 TUint32 CMRMsgBaseControlAdapter::EditPermission() const |
|
134 { |
|
135 return 0; |
|
136 } |
|
137 |
|
138 TInt CMRMsgBaseControlAdapter::CountComponentControls() const |
|
139 { |
|
140 return 1;// iControl |
|
141 } |
|
142 |
|
143 CCoeControl* CMRMsgBaseControlAdapter::ComponentControl(TInt /*aIndex*/) const |
|
144 { |
|
145 return &iBaseControl; |
|
146 } |
|
147 |
|
148 void CMRMsgBaseControlAdapter::SizeChanged() |
|
149 { |
|
150 iBaseControl.SetExtent(Position(), iBaseControl.Size()); |
|
151 } |
|
152 |
|
153 void CMRMsgBaseControlAdapter::FocusChanged(TDrawNow aDrawNow) |
|
154 { |
|
155 iBaseControl.SetFocus(IsFocused(), aDrawNow); |
|
156 } |
|
157 |
|
158 TInt CMRMsgBaseControlAdapter::VirtualHeight() |
|
159 { |
|
160 return iBaseControl.VirtualHeight(); |
|
161 } |
|
162 |
|
163 TInt CMRMsgBaseControlAdapter::VirtualVisibleTop() |
|
164 { |
|
165 return iBaseControl.VirtualVisibleTop(); |
|
166 } |
|
167 |
|
168 void CMRMsgBaseControlAdapter::HandleResourceChange(TInt aType) |
|
169 { |
|
170 iBaseControl.HandleResourceChange( aType ); |
|
171 } |
|
172 |
|
173 TKeyResponse CMRMsgBaseControlAdapter::OfferKeyEventL( |
|
174 const TKeyEvent& aKeyEvent,TEventCode aType) |
|
175 { |
|
176 return iBaseControl.OfferKeyEventL(aKeyEvent, aType); |
|
177 } |
|
178 |
|
179 void CMRMsgBaseControlAdapter::PrepareForReadOnly(TBool /*aReadOnly*/) |
|
180 { |
|
181 } |
|
182 |
|
183 // End of File |