1 /* |
|
2 * Copyright (c) 2007 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: Control for displaying remaining images/videos in Navi Pane |
|
15 * |
|
16 * Copyright © 2007 Nokia. All rights reserved. |
|
17 * This material, including documentation and any related computer |
|
18 * programs, is protected by copyright controlled by Nokia. All |
|
19 * rights are reserved. Copying, including reproducing, storing, |
|
20 * adapting or translating, any or all of this material requires the |
|
21 * prior written consent of Nokia. This material also contains |
|
22 * confidential information which may not be disclosed to others |
|
23 * without the prior written consent of Nokia. |
|
24 |
|
25 * |
|
26 * |
|
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 |
|