|
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 #if 0 // MSK icon |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CXnMenu::SetSoftKeyImageL |
|
102 // |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CXnMenu::SetSoftKeyImageL( const TAknsItemID& aId, |
|
106 const TDesC& aBmpFile, |
|
107 const TInt32 aBmp, const TInt32 aBmpM, |
|
108 XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos, |
|
109 TBool aEnable ) |
|
110 { |
|
111 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
112 adapter->SetSoftKeyImageL( aId, aBmpFile, aBmp, aBmpM, aPos, aEnable ); |
|
113 } |
|
114 #endif // MSK icon |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CXnMenu::SetSoftKeyTextL |
|
118 // |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CXnMenu::SetSoftKeyTextL( const TDesC& aText, TSoftKeyPosition aPos ) |
|
122 { |
|
123 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
124 adapter->SetSoftKeyTextL( aText, aPos ); |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CXnMenu::SetSoftKeyL |
|
129 // |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 void CXnMenu::SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode, TSoftKeyPosition aPos ) |
|
133 { |
|
134 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
135 adapter->SetSoftKeyL( aSoftkeyNode, aPos ); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CXnMenu::SoftKeyL |
|
140 // |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 CXnNodePluginIf* CXnMenu::SoftKeyL( TSoftKeyPosition aPos ) |
|
144 { |
|
145 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
146 return adapter->SoftKeyL( aPos ); |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CXnMenu::SetObserver |
|
151 // |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CXnMenu::SetObserver( XnMenuInterface::MXnMenuObserver& aObserver ) |
|
155 { |
|
156 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
157 adapter->SetObserver( aObserver ); |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CXnMenu::RemoveObserver |
|
162 // |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CXnMenu::RemoveObserver() |
|
166 { |
|
167 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
168 adapter->RemoveObserver(); |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CXnMenu::TryDisplayingMenuBarL |
|
173 // |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CXnMenu::TryDisplayingMenuBarL( const TDesC& aMenuNodeId ) |
|
177 { |
|
178 CXnMenuAdapter* adapter = static_cast< CXnMenuAdapter* >( ControlAdapter() ); |
|
179 |
|
180 adapter->TryDisplayingMenuL( aMenuNodeId ); |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CXnMenu::MakeInterfaceL |
|
185 // |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 XnComponentInterface::MXnComponentInterface* CXnMenu::MakeInterfaceL( |
|
189 const TDesC8& aType) |
|
190 { |
|
191 if( aType != XnMenuInterface::KType ) |
|
192 { |
|
193 return NULL; |
|
194 } |
|
195 |
|
196 return static_cast<XnMenuInterface::MXnMenuInterface*>( this ); |
|
197 } |