author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:09:54 +0300 | |
branch | RCL_3 |
changeset 67 | 756ad29ed18e |
parent 57 | 2c87b2808fd7 |
permissions | -rw-r--r-- |
54 | 1 |
/* |
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
54 | 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: Control for displaying remaining images/videos in Navi Pane |
|
15 |
* |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
16 |
* Copyright © 2007 Nokia. All rights reserved. |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
17 |
* This material, including documentation and any related computer |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
18 |
* programs, is protected by copyright controlled by Nokia. All |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
19 |
* rights are reserved. Copying, including reproducing, storing, |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
20 |
* adapting or translating, any or all of this material requires the |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
21 |
* prior written consent of Nokia. This material also contains |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
22 |
* confidential information which may not be disclosed to others |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
23 |
* without the prior written consent of Nokia. |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
24 |
|
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
25 |
* |
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
26 |
* |
54 | 27 |
*/ |
28 |
||
29 |
||
30 |
// INCLUDE FILES |
|
31 |
#include <AknsUtils.h> |
|
32 |
#include <e32base.h> |
|
33 |
#include "CamNaviProgressBarControl.h" |
|
34 |
#include "CamNaviProgressBarModel.h" |
|
35 |
#include "CamAppUi.h" |
|
36 |
#include "CamUtility.h" |
|
37 |
||
38 |
// CONSTANTS |
|
39 |
||
40 |
// ========================= MEMBER FUNCTIONS ================================ |
|
41 |
||
42 |
// --------------------------------------------------------- |
|
43 |
// CCamNaviProgressBarControl::NewL |
|
44 |
// Factory construction function |
|
45 |
// --------------------------------------------------------- |
|
46 |
// |
|
47 |
CCamNaviProgressBarControl* CCamNaviProgressBarControl::NewL( CCamNaviProgressBarModel& aModel ) |
|
48 |
{ |
|
49 |
CCamNaviProgressBarControl* self = new( ELeave ) CCamNaviProgressBarControl( aModel ); |
|
50 |
CleanupStack::PushL( self ); |
|
51 |
self->ConstructL(); |
|
52 |
CleanupStack::Pop( self ); |
|
53 |
return self; |
|
54 |
} |
|
55 |
||
56 |
// Destructor |
|
57 |
CCamNaviProgressBarControl::~CCamNaviProgressBarControl() |
|
58 |
{ |
|
59 |
iModel.DeregisterObserver( this ); |
|
60 |
} |
|
61 |
||
62 |
// --------------------------------------------------------- |
|
63 |
// CCamNaviProgressBarControl::CCamNaviProgressBarControl |
|
64 |
// C++ constructor |
|
65 |
// --------------------------------------------------------- |
|
66 |
// |
|
67 |
CCamNaviProgressBarControl::CCamNaviProgressBarControl(CCamNaviProgressBarModel& aModel ) |
|
68 |
: iModel ( aModel ), |
|
69 |
iActive ( EFalse ) |
|
70 |
{ |
|
71 |
} |
|
72 |
||
73 |
// --------------------------------------------------------- |
|
74 |
// CCamNaviProgressBarControl::ConstructL |
|
75 |
// Symbian OS 2nd phase constructor |
|
76 |
// --------------------------------------------------------- |
|
77 |
// |
|
78 |
void CCamNaviProgressBarControl::ConstructL() |
|
79 |
{ |
|
80 |
iModel.RegisterObserverL( this ); |
|
81 |
} |
|
82 |
||
83 |
// --------------------------------------------------------- |
|
84 |
// CCamNaviProgressBarControl::SizeChanged |
|
85 |
// Called by framework when the view size is changed |
|
86 |
// --------------------------------------------------------- |
|
87 |
// |
|
88 |
void CCamNaviProgressBarControl::SizeChanged() |
|
89 |
{ |
|
90 |
// if the rectangle has width or height |
|
91 |
if ( Rect().Size() != TSize( 0, 0 ) && iActive ) |
|
92 |
{ |
|
93 |
TRAP_IGNORE(iModel.SetExtentL( Rect() )); |
|
94 |
TRAP_IGNORE(iModel.ReloadResourceDataL()); |
|
95 |
} |
|
96 |
||
97 |
// AknsUtils::RegisterControlPosition( this ); |
|
98 |
} |
|
99 |
||
100 |
// --------------------------------------------------------- |
|
101 |
// CCamNaviProgressBarControl::DrawNaviCtr |
|
102 |
// Draw the control |
|
103 |
// --------------------------------------------------------- |
|
104 |
// |
|
105 |
void |
|
106 |
CCamNaviProgressBarControl::DrawProgressBar( CBitmapContext& aGc ) const |
|
107 |
{ |
|
108 |
if ( iActive ) |
|
109 |
{ |
|
110 |
iModel.DrawProgressBar( aGc, this ); |
|
111 |
} |
|
112 |
} |
|
113 |
||
114 |
// --------------------------------------------------------- |
|
115 |
// CCamNaviProgressBarControl::Draw |
|
116 |
// Draw the control |
|
117 |
// --------------------------------------------------------- |
|
118 |
// |
|
119 |
void CCamNaviProgressBarControl::Draw( const TRect& /* aRect */ ) const |
|
120 |
{ |
|
121 |
PRINT( _L("Camera => CCamNaviProgressBarControl::Draw" )) |
|
122 |
CWindowGc& gc=SystemGc(); |
|
123 |
||
124 |
DrawProgressBar( gc ); |
|
125 |
} |
|
126 |
||
127 |
// --------------------------------------------------------- |
|
128 |
// CCamNaviProgressBarControl::SetActive |
|
129 |
// Set's whether this control is currently active or not |
|
130 |
// --------------------------------------------------------- |
|
131 |
// |
|
132 |
void CCamNaviProgressBarControl::SetActiveL( TBool aActive ) |
|
133 |
{ |
|
134 |
iActive = aActive; |
|
135 |
if ( iActive ) |
|
136 |
{ |
|
137 |
iModel.SetExtentL( Rect() ); |
|
138 |
} |
|
139 |
} |
|
140 |
||
141 |
// --------------------------------------------------------- |
|
142 |
// CCamNaviProgressBarControl::HandleObservedEvent |
|
143 |
// Gets events from observed model |
|
144 |
// --------------------------------------------------------- |
|
145 |
// |
|
146 |
void CCamNaviProgressBarControl::HandleObservedEvent(TCamObserverEvent aEvent) |
|
147 |
{ |
|
148 |
if ( ECamObserverEventNaviModelUpdated == aEvent ) |
|
149 |
{ |
|
150 |
if ( iActive ) |
|
151 |
{ |
|
152 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
153 |
||
154 |
if ( appUi && appUi->IsDirectViewfinderActive() ) |
|
155 |
{ |
|
156 |
TRAP_IGNORE(appUi->HandleCommandL( ECamCmdRedrawVideoTime )); |
|
157 |
} |
|
158 |
else |
|
159 |
{ |
|
160 |
DrawDeferred(); |
|
161 |
} |
|
162 |
} |
|
163 |
} |
|
164 |
} |
|
165 |
||
166 |
// End of File |
|
167 |
||
168 |