|
1 /* |
|
2 * Copyright (c) 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 of the CVtUiMutedControl control class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CVtUiMutedControl.h" |
|
22 #include "VtUiLayout.h" |
|
23 #include <eiklabel.h> |
|
24 #include <aknsutils.h> |
|
25 #include <aknsdrawutils.h> |
|
26 #include <stringloader.h> |
|
27 #include <videotelui.rsg> |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CVtUiMutedControl::CVtUiMutedControl |
|
33 // C++ constructor can NOT contain any code, that |
|
34 // might leave. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CVtUiMutedControl::CVtUiMutedControl() |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CVtUiMutedControl::ConstructL |
|
43 // Symbian 2nd phase constructor. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CVtUiMutedControl::ConstructL() |
|
47 { |
|
48 HBufC* mutedText = |
|
49 StringLoader::LoadLC( R_VIDEOTELUI_QTN_INCAL_MUTED_PANE ); |
|
50 |
|
51 iMutedLabel = new ( ELeave ) CEikLabel; |
|
52 iMutedLabel->SetContainerWindowL( *this ); |
|
53 iMutedLabel->SetTextL( *mutedText ); |
|
54 |
|
55 CleanupStack::PopAndDestroy( mutedText ); |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CVtUiMutedControl::~CVtUiMutedControl |
|
60 // Destructor. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CVtUiMutedControl::~CVtUiMutedControl() |
|
64 { |
|
65 AknsUtils::DeregisterControlPosition( this ); |
|
66 |
|
67 delete iMutedLabel; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CVtUiMutedControl::HandleResourceChange |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 void CVtUiMutedControl::HandleResourceChange( |
|
75 TInt aType ) |
|
76 { |
|
77 CCoeControl::HandleResourceChange( aType ); |
|
78 |
|
79 if ( aType == KAknsMessageSkinChange ) |
|
80 { |
|
81 SizeChanged(); |
|
82 } |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CVtUiMutedControl::Draw |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CVtUiMutedControl::Draw( const TRect& /*aRect*/ ) const |
|
90 { |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CVtUiMutedControl::SizeChanged |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CVtUiMutedControl::SizeChanged() |
|
98 { |
|
99 AknsUtils::RegisterControlPosition( this ); |
|
100 |
|
101 TRect naviPane( Rect() ); |
|
102 if ( naviPane.IsEmpty() ) |
|
103 { |
|
104 return; |
|
105 } |
|
106 |
|
107 TAknTextLineLayout label; |
|
108 VtUiLayout::GetMutedTextLayout( label ); |
|
109 |
|
110 AknLayoutUtils::LayoutLabel( iMutedLabel, naviPane, label ); |
|
111 |
|
112 // Update label color |
|
113 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
114 TRgb skinColor; |
|
115 |
|
116 TInt error = |
|
117 AknsUtils::GetCachedColor( |
|
118 skin, |
|
119 skinColor, |
|
120 KAknsIIDQsnTextColors, |
|
121 EAknsCIQsnTextColorsCG2 ); |
|
122 |
|
123 if ( ( error == KErrNone ) && iMutedLabel ) |
|
124 { |
|
125 // Ignore error |
|
126 TRAP_IGNORE( |
|
127 iMutedLabel->OverrideColorL( EColorLabelText, skinColor ) ); |
|
128 } |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CVtUiMutedControl::PositionChanged |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 void CVtUiMutedControl::PositionChanged() |
|
136 { |
|
137 AknsUtils::RegisterControlPosition( this ); |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CVtUiMutedControl::CountComponentControls |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 TInt CVtUiMutedControl::CountComponentControls() const |
|
145 { |
|
146 return 1; // one label |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CVtUiMutedControl::ComponentControl |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 CCoeControl* CVtUiMutedControl::ComponentControl( |
|
154 TInt /*aIndex*/ ) const |
|
155 { |
|
156 return iMutedLabel; |
|
157 } |
|
158 |
|
159 // End of File |