author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:58:58 +0300 | |
branch | RCL_3 |
changeset 35 | 3321d3e205b6 |
parent 34 | 5456b4e8b3a8 |
permissions | -rw-r--r-- |
34 | 1 |
/* |
2 |
* Copyright (c) 2006-2008 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: Clock control |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef _XNCLOCKCONTROL_H |
|
20 |
#define _XNCLOCKCONTROL_H |
|
21 |
||
22 |
// System includes |
|
23 |
#include <e32base.h> |
|
24 |
||
25 |
// User includes |
|
26 |
||
27 |
// Forward declarations |
|
28 |
class CWindowGc; |
|
29 |
class CXnClockAdapter; |
|
30 |
class CXnClockFace; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
31 |
class CXnNodePluginIf; |
34 | 32 |
|
33 |
// Class declaration |
|
34 |
/** |
|
35 |
* @ingroup group_xnclockfactory |
|
36 |
* @lib xnclockfactory.lib |
|
37 |
* @since S60 5.0 |
|
38 |
*/ |
|
39 |
NONSHARABLE_CLASS( CXnClockControl ) : public CBase |
|
40 |
{ |
|
41 |
public: // Constructors and destructor |
|
42 |
||
43 |
/** |
|
44 |
* Two-phased constructor. |
|
45 |
* |
|
46 |
* @since S60 5.1 |
|
47 |
* |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
48 |
* @param aAdapter Reference to clockadapter. |
34 | 49 |
* @param aFormatFromLocale Boolean flag to indicate whether the clock |
50 |
* format should be updated from the locale. |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
51 |
* @param aFormat Boolean flag that indicates whether the |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
52 |
* clock is digital or analog. |
34 | 53 |
* |
54 |
* @return Newly constructed object. |
|
55 |
*/ |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
56 |
static CXnClockControl* NewL( CXnClockAdapter& aAdapter, |
34 | 57 |
const TBool aFormatFromLocale, |
58 |
const TClockFormat aFormat ); |
|
59 |
||
60 |
||
61 |
/** |
|
62 |
* Destructor. |
|
63 |
*/ |
|
64 |
virtual ~CXnClockControl(); |
|
65 |
||
66 |
public: // New functions |
|
67 |
||
68 |
/** |
|
69 |
* Updates the double buffer and redraws the clock. |
|
70 |
*/ |
|
71 |
void UpdateDisplay(); |
|
72 |
||
73 |
/** |
|
74 |
* Sets the format of the clock. |
|
75 |
* |
|
76 |
* @param aFormatFromLocale Wheter clock is getting format from locale |
|
77 |
* @param aFormat New clock format. |
|
78 |
*/ |
|
79 |
void SetFormatL( const TBool aFormatFromLocale, |
|
80 |
const TClockFormat aFormat ); |
|
81 |
||
82 |
/** |
|
83 |
* Gets the clock format |
|
84 |
* |
|
85 |
* @return Clock format. |
|
86 |
*/ |
|
87 |
TClockFormat Format() const; |
|
88 |
||
89 |
/** |
|
90 |
* Draws the clock |
|
91 |
* |
|
92 |
* @param aGc Context where to draw |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
93 |
* @param aNode Node to draw |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
94 |
* @param aAmpm Possible am/pm text to draw |
34 | 95 |
*/ |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
96 |
void Draw( CWindowGc& aGc, CXnNodePluginIf* aNode, CXnNodePluginIf* aAmpm ); |
34 | 97 |
|
98 |
/** |
|
99 |
* Starts the clock timer. |
|
100 |
* Used when the clock gains visibility. |
|
101 |
*/ |
|
102 |
void StartTimer(); |
|
103 |
||
104 |
/** |
|
105 |
* Stops the clock timer. |
|
106 |
* Used when the clock loses visibility. |
|
107 |
*/ |
|
108 |
void StopTimer(); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
109 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
110 |
/** |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
111 |
* Checks if clock format has changed |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
112 |
*/ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
113 |
void CheckClockFormatL(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
114 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
115 |
/** |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
116 |
* Reset font and color |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
117 |
*/ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
118 |
void ResetFont(); |
34 | 119 |
|
120 |
private: // New functions |
|
121 |
||
122 |
/** |
|
123 |
* Timer callback for clock updates |
|
124 |
* |
|
125 |
* @param aThis Pointer to the skinnable clock instance. |
|
126 |
* |
|
127 |
* @return Always returns @c KErrNone. |
|
128 |
*/ |
|
129 |
static TInt TimerCallback( TAny* aThis ); |
|
130 |
||
131 |
private: |
|
132 |
||
133 |
/** |
|
134 |
* C++ default constructor. |
|
135 |
*/ |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
136 |
CXnClockControl( CXnClockAdapter& aAdapter, |
34 | 137 |
const TBool aFormatFromLocale, |
138 |
const TClockFormat aFormat ); |
|
139 |
||
140 |
/** |
|
141 |
* By default Symbian 2nd phase constructor is private. |
|
142 |
*/ |
|
143 |
void ConstructL(); |
|
144 |
||
145 |
private: // data |
|
146 |
||
147 |
// Timer, owned |
|
148 |
CPeriodic* iTimer; |
|
149 |
// Clock face, owned |
|
150 |
CXnClockFace* iFace; |
|
151 |
// Clock adapter, not owned |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
152 |
CXnClockAdapter& iAdapter; |
34 | 153 |
// Clock format |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
154 |
TClockFormat iClockFormat; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
155 |
// Time format |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
156 |
TTimeFormat iTimeFormat; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
157 |
// Flag indicating whether format clock from locale |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
158 |
TBool iFormatFromLocale; |
34 | 159 |
}; |
160 |
||
161 |
#endif // _XNCLOCKCONTROL_H |
|
162 |
||
163 |
// End of File |