|
1 /* |
|
2 * Copyright (c) 2006 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: This is the implementation of setting container class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <AknUtils.h> // for font |
|
21 #include <AknsDrawUtils.h>// skin |
|
22 #include <AknsBasicBackgroundControlContext.h> //skin |
|
23 #include <BthidResource.rsg> |
|
24 #include "bthidsettingcontainer.h" |
|
25 #ifdef __SERIES60_HELP |
|
26 #include <hlplch.h> |
|
27 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching |
|
28 #endif |
|
29 #include "btui.h" |
|
30 #include "debug.h" |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 |
|
34 // --------------------------------------------------------- |
|
35 // CBTHidSettingContainer::ConstructL(const TRect& aRect) |
|
36 // EPOC two phased constructor |
|
37 // --------------------------------------------------------- |
|
38 // |
|
39 void CBTHidSettingContainer::ConstructL(const TRect& aRect) |
|
40 { |
|
41 CreateWindowL(); //makes the control a window-owning control |
|
42 BaseConstructL( aRect ); |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------- |
|
46 // CBTHidBaseContainer::BaseConstructL() |
|
47 // --------------------------------------------------------- |
|
48 // |
|
49 void CBTHidSettingContainer::BaseConstructL( const TRect& aRect ) |
|
50 { |
|
51 SetRect(aRect); |
|
52 iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
53 ActivateL(); |
|
54 } |
|
55 |
|
56 |
|
57 // Destructor |
|
58 CBTHidSettingContainer::~CBTHidSettingContainer() |
|
59 { |
|
60 delete iBackGround; |
|
61 } |
|
62 |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CBTHidSettingContainer::SizeChanged |
|
66 // called by framwork when the view size is changed |
|
67 // |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 void CBTHidSettingContainer::SizeChanged() |
|
71 { |
|
72 TRACE_INFO( (_L("[BTHID]\t CBTHidBaseContainer::SizeChanged(); Width %d Height %d "),Rect().Height(), Rect().Width())); |
|
73 |
|
74 //Handle SizeChanged for Skin |
|
75 TRect parentRect(Rect()); |
|
76 if (iBackGround) |
|
77 iBackGround->SetRect(parentRect); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CBTHidSettingContainer::CountComponentControls |
|
82 // |
|
83 // |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 TInt CBTHidSettingContainer::CountComponentControls() const |
|
87 { |
|
88 return 0; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CBTHidSettingContainer::ComponentControl |
|
93 // |
|
94 // |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 CCoeControl* CBTHidSettingContainer::ComponentControl(TInt /*aIndex*/) const |
|
98 { |
|
99 return NULL; |
|
100 } |
|
101 |
|
102 void CBTHidSettingContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) |
|
103 { |
|
104 // TODO: Add your control event handler code here |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // CBTHidBaseContainer::HandleResourceChange |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 |
|
112 void CBTHidSettingContainer::HandleResourceChange( TInt aType ) |
|
113 { |
|
114 |
|
115 //Handle change in layout orientation |
|
116 if (aType == KEikDynamicLayoutVariantSwitch) |
|
117 { |
|
118 |
|
119 //TRect rect = iAvkonAppUi->ClientRect(); |
|
120 // The line above provides to big rectangle in the bottom causing cba's overdrawn by by blank area. |
|
121 // Correct way to do this is below. |
|
122 TRect mainPaneRect; |
|
123 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
124 SetRect(mainPaneRect); |
|
125 DrawNow(); |
|
126 } |
|
127 |
|
128 else |
|
129 { |
|
130 CCoeControl::HandleResourceChange(aType); |
|
131 } |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------- |
|
135 // CBTHidBaseContainer::Draw(const TRect& aRect) const |
|
136 // --------------------------------------------------------- |
|
137 // |
|
138 void CBTHidSettingContainer::Draw(const TRect& aRect) const |
|
139 { |
|
140 TRACE_FUNC(_L("[BTHID]\t CBTHidSettingContainer::Draw()")); |
|
141 TRgb color; |
|
142 |
|
143 CWindowGc& gc = SystemGc(); |
|
144 |
|
145 // draw background |
|
146 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
147 |
|
148 // get skin text color |
|
149 AknsUtils::GetCachedColor( skin, color , KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); |
|
150 gc.SetPenColor( color ); |
|
151 |
|
152 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
153 AknsDrawUtils::Background( skin, cc, this, gc, aRect ); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------- |
|
157 // CBTHidBaseContainer::MopSupplyObject() |
|
158 // Pass skin information if needed. |
|
159 // --------------------------------------------------------- |
|
160 // |
|
161 TTypeUid::Ptr CBTHidSettingContainer::MopSupplyObject(TTypeUid aId) |
|
162 { |
|
163 if(aId.iUid == MAknsControlContext::ETypeId && iBackGround) |
|
164 { |
|
165 return MAknsControlContext::SupplyMopObject( aId, iBackGround); |
|
166 } |
|
167 |
|
168 return CCoeControl::MopSupplyObject( aId ); |
|
169 } |
|
170 |
|
171 #ifdef __SERIES60_HELP |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // From CCoeControl |
|
175 // CBTHidSettingContainer::GetHelpContext |
|
176 // --------------------------------------------------------- |
|
177 // |
|
178 void CBTHidSettingContainer::GetHelpContext(TCoeHelpContext& aContext) const |
|
179 { |
|
180 TRACE_FUNC_ENTRY |
|
181 |
|
182 aContext.iMajor = KBtuiUid3; |
|
183 aContext.iContext = KBTKEYBOARD_HLP_SETTINGS; |
|
184 } |
|
185 |
|
186 #else |
|
187 |
|
188 // --------------------------------------------------------- |
|
189 // From CCoeControl |
|
190 // CBTHidSettingContainer::GetHelpContext |
|
191 // --------------------------------------------------------- |
|
192 // |
|
193 void CBTHidSettingContainer::GetHelpContext(TCoeHelpContext& /*aContext*/) const |
|
194 { |
|
195 TRACE_FUNC_ENTRY |
|
196 } |
|
197 |
|
198 #endif |
|
199 // End of File |