|
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: Implementation for wrapper for a menu |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <coecntrl.h> |
|
21 #include <barsread.h> |
|
22 |
|
23 #include "xnmenu.h" |
|
24 #include "xnmenuadapter.h" |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CXnMenu::NewL |
|
30 // Symbian static 1st phase constructor |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CXnMenu* CXnMenu::NewL() |
|
34 { |
|
35 CXnMenu* self = new( ELeave ) CXnMenu; |
|
36 |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop( self ); |
|
40 |
|
41 return self; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CXnMenu::ConstructL |
|
46 // Symbian 2nd phase constructor can leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 void CXnMenu::ConstructL() |
|
50 { |
|
51 CXnComponent::ConstructL(); |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CXnMenu::ConstructL |
|
56 // C++ default constructor |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CXnMenu::CXnMenu() |
|
60 { |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CXnMenu::ConstructL |
|
65 // C++ destructor |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CXnMenu::~CXnMenu() |
|
69 { |
|
70 } |
|
71 |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CXnMenu::SetSoftKeyImageL |
|
75 // |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CXnMenu::SetSoftKeyImageL( CFbsBitmap* aBitmap, CFbsBitmap* aMask, |
|
79 TSoftKeyPosition aPos, TBool aPreserveAspectRatio, TBool aInvertMask, |
|
80 TBool aTransferOwnership ) |
|
81 { |
|
82 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
83 adapter->SetSoftKeyImageL( aBitmap, aMask, aPos, NULL, aPreserveAspectRatio, aInvertMask, aTransferOwnership ); |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CXnMenu::SetSoftKeyImageL |
|
88 // |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CXnMenu::SetSoftKeyImageL( CFbsBitmap* aBitmap, CFbsBitmap* aMask, |
|
92 TSoftKeyPosition aPos, CXnNodeAppIf* aNode, TBool aPreserveAspectRatio, TBool aInvertMask, |
|
93 TBool aTransferOwnership ) |
|
94 { |
|
95 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
96 adapter->SetSoftKeyImageL( aBitmap, aMask, aPos, aNode, aPreserveAspectRatio, aInvertMask, aTransferOwnership ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CXnMenu::SetSoftKeyImageL |
|
101 // |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CXnMenu::SetSoftKeyImageL( const TAknsItemID& aId, |
|
105 const TDesC& aBmpFile, |
|
106 const TInt32 aBmp, const TInt32 aBmpM, |
|
107 XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos, |
|
108 TBool aEnable ) |
|
109 { |
|
110 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
111 adapter->SetSoftKeyImageL( aId, aBmpFile, aBmp, aBmpM, aPos, aEnable ); |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CXnMenu::SetSoftKeyTextL |
|
116 // |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CXnMenu::SetSoftKeyTextL( const TDesC& aText, TSoftKeyPosition aPos ) |
|
120 { |
|
121 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
122 adapter->SetSoftKeyTextL( aText, aPos ); |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CXnMenu::SetSoftKeyL |
|
127 // |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void CXnMenu::SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode, TSoftKeyPosition aPos ) |
|
131 { |
|
132 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
133 adapter->SetSoftKeyL( aSoftkeyNode, aPos ); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CXnMenu::SoftKeyL |
|
138 // |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 CXnNodePluginIf* CXnMenu::SoftKeyL( TSoftKeyPosition aPos ) |
|
142 { |
|
143 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
144 return adapter->SoftKeyL( aPos ); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CXnMenu::KeyEventNode |
|
149 // |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 CXnNodePluginIf* CXnMenu::KeyEventNode() |
|
153 { |
|
154 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
155 return adapter->KeyEventNode(); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CXnMenu::SetObserver |
|
160 // |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void CXnMenu::SetObserver( XnMenuInterface::MXnMenuObserver& aObserver ) |
|
164 { |
|
165 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
166 adapter->SetObserver( aObserver ); |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CXnMenu::RemoveObserver |
|
171 // |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CXnMenu::RemoveObserver() |
|
175 { |
|
176 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
177 adapter->RemoveObserver(); |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CXnMenu::TryDisplayingMenuBarL |
|
182 // |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void CXnMenu::TryDisplayingMenuBarL( const TDesC& aMenuNodeId, |
|
186 TBool aContextMenu ) |
|
187 { |
|
188 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
189 |
|
190 adapter->TryDisplayingMenuL( aMenuNodeId, aContextMenu ); |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CXnMenu::MakeInterfaceL |
|
195 // |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 XnComponentInterface::MXnComponentInterface* CXnMenu::MakeInterfaceL( |
|
199 const TDesC8& aType) |
|
200 { |
|
201 if( aType != XnMenuInterface::KType ) |
|
202 { |
|
203 return NULL; |
|
204 } |
|
205 |
|
206 return static_cast<XnMenuInterface::MXnMenuInterface*>( this ); |
|
207 } |