|
1 /* |
|
2 * Copyright (c) 2009 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: AppView implementation, only displays two labels changed |
|
15 * from CHtiAdminAppUi class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <coemain.h> |
|
21 #include <AknUtils.h> |
|
22 #include <HtiAdmin.rsg> |
|
23 |
|
24 #include "HtiAdminAppView.h" |
|
25 #include "HtiAdminApplication.h" //logging |
|
26 |
|
27 // Standard construction sequence |
|
28 CHtiAdminAppView* CHtiAdminAppView::NewL(const TRect& aRect) |
|
29 { |
|
30 CHtiAdminAppView* self = CHtiAdminAppView::NewLC(aRect); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 CHtiAdminAppView* CHtiAdminAppView::NewLC(const TRect& aRect) |
|
36 { |
|
37 CHtiAdminAppView* self = new (ELeave) CHtiAdminAppView; |
|
38 CleanupStack::PushL(self); |
|
39 self->ConstructL(aRect); |
|
40 return self; |
|
41 } |
|
42 |
|
43 CHtiAdminAppView::CHtiAdminAppView() |
|
44 { |
|
45 // no implementation required |
|
46 } |
|
47 |
|
48 CHtiAdminAppView::~CHtiAdminAppView() |
|
49 { |
|
50 delete iHtiCaption; |
|
51 delete iHtiStatus; |
|
52 delete iHtiVersionCaption; |
|
53 delete iHtiVersion; |
|
54 delete iHtiAutoStartCaption; |
|
55 delete iHtiAutoStartStatus; |
|
56 delete iHtiSelectedCommCaption; |
|
57 delete iHtiSelectedComm; |
|
58 delete iHtiCommDetails; |
|
59 } |
|
60 |
|
61 void CHtiAdminAppView::ConstructL(const TRect& aRect) |
|
62 { |
|
63 //HTI_LOG_TEXT("CHtiAdminAppView::ConstructL"); |
|
64 |
|
65 iHtiCaption = HBufC::NewL( KMaxDisplayText ); |
|
66 iHtiStatus = HBufC::NewL( KMaxDisplayText ); |
|
67 iHtiVersionCaption = HBufC::NewL( KMaxDisplayText ); |
|
68 iHtiVersion = HBufC::NewL( KMaxDisplayText ); |
|
69 iHtiAutoStartCaption = HBufC::NewL( KMaxDisplayText ); |
|
70 iHtiAutoStartStatus = HBufC::NewL( KMaxDisplayText ); |
|
71 iHtiSelectedCommCaption = HBufC::NewL( KMaxDisplayText ); |
|
72 iHtiSelectedComm = HBufC::NewL( KMaxDisplayText ); |
|
73 iHtiCommDetails = HBufC::NewL( KMaxDisplayText ); |
|
74 |
|
75 // Create a window for this application view |
|
76 CreateWindowL(); |
|
77 |
|
78 // Set the windows size |
|
79 SetRect(aRect); |
|
80 |
|
81 // Activate the window, which makes it ready to be drawn |
|
82 ActivateL(); |
|
83 } |
|
84 |
|
85 // Draw this application's view to the screen |
|
86 void CHtiAdminAppView::Draw(const TRect& /*aRect*/) const |
|
87 { |
|
88 // Get the standard graphics context |
|
89 CWindowGc& gc = SystemGc(); |
|
90 |
|
91 // Gets the control's extent |
|
92 TRect rect = Rect(); |
|
93 |
|
94 // Clears the screen |
|
95 gc.Clear(rect); |
|
96 |
|
97 //draw text |
|
98 const CFont* f = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
99 gc.UseFont( f ); |
|
100 |
|
101 TInt leftMargin = f->MaxNormalCharWidthInPixels() / 4; |
|
102 |
|
103 TPoint dP( leftMargin, f->FontLineGap() ); |
|
104 gc.DrawText( *iHtiCaption, dP ); |
|
105 dP.iX += f->TextWidthInPixels( *iHtiCaption ); |
|
106 gc.DrawText( *iHtiStatus, dP ); |
|
107 |
|
108 dP.iX = leftMargin; |
|
109 dP.iY += f->FontLineGap() * 1.5; |
|
110 gc.DrawText( *iHtiVersionCaption, dP ); |
|
111 dP.iX += f->TextWidthInPixels( *iHtiVersionCaption ); |
|
112 gc.DrawText( *iHtiVersion, dP ); |
|
113 |
|
114 dP.iX = leftMargin; |
|
115 dP.iY += f->FontLineGap() * 1.5; |
|
116 gc.DrawText( *iHtiAutoStartCaption, dP ); |
|
117 dP.iX += f->TextWidthInPixels( *iHtiAutoStartCaption ); |
|
118 gc.DrawText( *iHtiAutoStartStatus, dP ); |
|
119 |
|
120 dP.iX = leftMargin; |
|
121 dP.iY += f->FontLineGap() * 1.5; |
|
122 gc.DrawText( *iHtiSelectedCommCaption, dP ); |
|
123 dP.iX += f->TextWidthInPixels( *iHtiSelectedCommCaption ); |
|
124 gc.DrawText( *iHtiSelectedComm, dP ); |
|
125 dP.iX = leftMargin; |
|
126 dP.iY += f->FontLineGap(); |
|
127 gc.DrawText( *iHtiCommDetails, dP ); |
|
128 } |
|
129 |
|
130 void CHtiAdminAppView::SetCaption( const TDesC& aText ) |
|
131 { |
|
132 iHtiCaption->Des().Copy( aText ); |
|
133 DrawDeferred(); |
|
134 } |
|
135 |
|
136 void CHtiAdminAppView::SetStatus( const TDesC& aText ) |
|
137 { |
|
138 iHtiStatus->Des().Copy( aText ); |
|
139 DrawDeferred(); |
|
140 } |
|
141 |
|
142 void CHtiAdminAppView::SetVersionCaption( const TDesC& aText ) |
|
143 { |
|
144 iHtiVersionCaption->Des().Copy( aText ); |
|
145 DrawDeferred(); |
|
146 } |
|
147 |
|
148 void CHtiAdminAppView::SetVersion( const TDesC& aText ) |
|
149 { |
|
150 iHtiVersion->Des().Copy( aText ); |
|
151 DrawDeferred(); |
|
152 } |
|
153 |
|
154 void CHtiAdminAppView::SetAutoStartCaption( const TDesC& aText ) |
|
155 { |
|
156 iHtiAutoStartCaption->Des().Copy( aText ); |
|
157 DrawDeferred(); |
|
158 } |
|
159 |
|
160 void CHtiAdminAppView::SetAutoStartStatus( const TDesC& aText ) |
|
161 { |
|
162 iHtiAutoStartStatus->Des().Copy( aText ); |
|
163 DrawDeferred(); |
|
164 } |
|
165 |
|
166 void CHtiAdminAppView::SetSelectedCommCaption( const TDesC& aText ) |
|
167 { |
|
168 iHtiSelectedCommCaption->Des().Copy( aText ); |
|
169 DrawDeferred(); |
|
170 } |
|
171 |
|
172 void CHtiAdminAppView::SetSelectedComm( const TDesC& aText ) |
|
173 { |
|
174 iHtiSelectedComm->Des().Copy( aText ); |
|
175 DrawDeferred(); |
|
176 } |
|
177 |
|
178 void CHtiAdminAppView::SetCommDetails( const TDesC& aText ) |
|
179 { |
|
180 iHtiCommDetails->Des().Copy( aText ); |
|
181 DrawDeferred(); |
|
182 } |
|
183 |
|
184 // End of file |