epoc32/include/clock.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/clock.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,389 +0,0 @@
     1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 -// All rights reserved.
     1.6 -// This component and the accompanying materials are made available
     1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 -// which accompanies this distribution, and is available
     1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 -//
    1.11 -// Initial Contributors:
    1.12 -// Nokia Corporation - initial contribution.
    1.13 -//
    1.14 -// Contributors:
    1.15 -//
    1.16 -// Description:
    1.17 -//
    1.18 -
    1.19 -#if !defined(__CLOCK_H__)
    1.20 -#define __CLOCK_H__
    1.21 -
    1.22 -#if !defined(__E32STD_H__)
    1.23 -#include <e32std.h>
    1.24 -#endif
    1.25 -
    1.26 -#if !defined(__E32BASE_H__)
    1.27 -#include <e32base.h>
    1.28 -#endif
    1.29 -
    1.30 -#if !defined(__W32STD_H__)
    1.31 -#include <w32std.h>
    1.32 -#endif
    1.33 -
    1.34 -//
    1.35 -// miscellaneous typedefs
    1.36 -//
    1.37 -/** @internalComponent */
    1.38 -typedef TBuf8<1024> TConstructorBuf8; // implementation class
    1.39 -
    1.40 -//
    1.41 -// miscellaneous enums
    1.42 -//
    1.43 -
    1.44 -/** @internalComponent */
    1.45 -enum TDisplayType // implementation class
    1.46 -	{
    1.47 -	EDisplayDigital,
    1.48 -	EDisplayAnalog
    1.49 -	};
    1.50 -
    1.51 -/** @internalComponent */
    1.52 -enum TAnalogDisplayHandFeatureType // implementation class
    1.53 -	{
    1.54 -	EAnalogDisplayHandFeatureLine,
    1.55 -	EAnalogDisplayHandFeaturePolyLine,
    1.56 -	EAnalogDisplayHandFeatureCircle
    1.57 -	};
    1.58 -
    1.59 -/** Horizontal alignment options for text in a digital clock's display.
    1.60 -
    1.61 -@see TDigitalDisplayTextSection 
    1.62 -@publishedAll
    1.63 -@released */
    1.64 -enum TDigitalDisplayHorizontalTextAlignment
    1.65 -	{
    1.66 -	/** Left align text. */
    1.67 -	EDigitalDisplayHorizontalTextAlignmentLeft,
    1.68 -	/** Centre align text. */
    1.69 -	EDigitalDisplayHorizontalTextAlignmentCenter,
    1.70 -	/** Right align text. */
    1.71 -	EDigitalDisplayHorizontalTextAlignmentRight
    1.72 -	};
    1.73 -
    1.74 -/** Vertical alignment options for text in a digital clock's display.
    1.75 -
    1.76 -@see TDigitalDisplayTextSection 
    1.77 -@publishedAll
    1.78 -@released */
    1.79 -enum TDigitalDisplayVerticalTextAlignment
    1.80 -	{
    1.81 -	/** Top align text. */
    1.82 -	EDigitalDisplayVerticalTextAlignmentTop,
    1.83 -	/** Centre align text, including the character descent. */
    1.84 -	EDigitalDisplayVerticalTextAlignmentCenterInclDescent,
    1.85 -	/** Centre align text, excluding the character descent. */
    1.86 -	EDigitalDisplayVerticalTextAlignmentCenterExclDescent,
    1.87 -	/** Bottom align text, including the character descent. */
    1.88 -	EDigitalDisplayVerticalTextAlignmentBottomInclDescent,
    1.89 -	/** Bottom align text, excluding the character descent. */
    1.90 -	EDigitalDisplayVerticalTextAlignmentBottomExclDescent
    1.91 -	};
    1.92 -
    1.93 -/** Special characters that can be used in a digital clock display.
    1.94 -
    1.95 -@see TDigitalDisplayTextSection 
    1.96 -@publishedAll
    1.97 -@released */
    1.98 -enum TDigitalDisplayLayoutChar
    1.99 -	{
   1.100 -	/** A flashing block to delimit different sections of the display.
   1.101 -	 */
   1.102 -	/** A flashing block to delimit different sections of the display. */
   1.103 -	EDigitalDisplayLayoutCharFlashingBlockDelimiter=1
   1.104 -	};
   1.105 -
   1.106 -//
   1.107 -/** Different types of hand for an analogue clock. 
   1.108 -
   1.109 -@publishedAll
   1.110 -@released */
   1.111 -enum TAnalogDisplayHandType
   1.112 -	{
   1.113 -	/** A hand that performs one revolution every 12 hours. */
   1.114 -	EAnalogDisplayHandOneRevPer12Hours,
   1.115 -	/** A hand that performs one revolution every hour. */
   1.116 -	EAnalogDisplayHandOneRevPerHour,
   1.117 -	/** A hand that performs one revolution every minute. */
   1.118 -	EAnalogDisplayHandOneRevPerMinute
   1.119 -	};
   1.120 -
   1.121 -//
   1.122 -// miscellaneous structs
   1.123 -//
   1.124 -
   1.125 -struct STimeDeviceShadow
   1.126 -/** Determines how shadows are added to the clock display. 
   1.127 -
   1.128 -@publishedAll
   1.129 -@released */
   1.130 -	{
   1.131 -	/** True if shadows should be displayed, else false. */
   1.132 -	TBool iIsOn;
   1.133 -	/** Colour of the shadows. */
   1.134 -	TRgb iColor;
   1.135 -	/** Offset of shadows from foreground. */
   1.136 -	TPoint iOffset;
   1.137 -	};
   1.138 -
   1.139 -struct SAnalogDisplayAmPm
   1.140 -/** Defines the display parameters of the AM/PM display for an analogue clock.
   1.141 -
   1.142 -@see RAnalogClock 
   1.143 -@publishedAll
   1.144 -@released */
   1.145 -	{
   1.146 -	/** Position relative to the clock face. */
   1.147 -	TPoint iPositionRelativeToFace;
   1.148 -	/** Size. */
   1.149 -	TSize iSize;
   1.150 -	/** Shadow settings. */
   1.151 -	STimeDeviceShadow iShadow;
   1.152 -	/** Background colour. */
   1.153 -	TRgb iBackgroundColor;
   1.154 -	/** Handle to the font to use. This can be obtained using CFbsFont::Handle().
   1.155 -	
   1.156 -	@see CFbsFont::Handle() */
   1.157 -	TInt iFontHandle;
   1.158 -	/** Colour for text. */
   1.159 -	TRgb iTextColor;
   1.160 -	};
   1.161 -
   1.162 -//
   1.163 -// display-addition classes
   1.164 -//
   1.165 -
   1.166 -
   1.167 -class TDisplayAddition
   1.168 -/** This class is used in the derivation of TAnalogDisplayHand and TDigitalDisplayTextSection. 
   1.169 -
   1.170 -@internalComponent */
   1.171 -	{
   1.172 -public:
   1.173 -	const TDesC8& Buf() const;
   1.174 -protected:
   1.175 -	TConstructorBuf8 iBuf;
   1.176 -	};
   1.177 -
   1.178 -//
   1.179 -
   1.180 -class TDigitalDisplayTextSection : public TDisplayAddition
   1.181 -/** A text section for a digital clock.
   1.182 -
   1.183 -@see RDigitalClock 
   1.184 -@publishedAll 
   1.185 -@released */
   1.186 -	{
   1.187 -public:
   1.188 -	IMPORT_C TDigitalDisplayTextSection(TInt aFontHandle, TRgb aTextColor, TDigitalDisplayHorizontalTextAlignment aHorizontalAlignment,
   1.189 -																TDigitalDisplayVerticalTextAlignment aVerticalAlignment,
   1.190 -																TInt aHorizontalMargin, TInt aVerticalMargin, const TDesC& aFormat);
   1.191 -																// N.B. the font passed in to aFontHandle cannot be destroyed until the
   1.192 -																// RDigitalClock has been completely constructed, including all necessary
   1.193 -																// calls to RDigitalClock::AddTextSectionL()
   1.194 -	};
   1.195 -
   1.196 -//
   1.197 -
   1.198 -class TAnalogDisplayHand : public TDisplayAddition
   1.199 -/** A hand for an analogue clock.
   1.200 -
   1.201 -A hand is a vector drawing made from a number of features (lines, circles, 
   1.202 -polylines). These are specified with the hand assumed to be in the 12 o'clock 
   1.203 -position, with TPoint(0,0) being the center of the clock.
   1.204 -
   1.205 -@see RAnalogClock 
   1.206 -@publishedAll 
   1.207 -@released */
   1.208 -	{
   1.209 -public:
   1.210 -	IMPORT_C TAnalogDisplayHand(TAnalogDisplayHandType aType);
   1.211 -	IMPORT_C void AddLine(CGraphicsContext::TPenStyle aPenStyle, TRgb aPenColor, const TSize& aPenSize,
   1.212 -																const TPoint& aStartPoint, const TPoint& aEndPoint);
   1.213 -	IMPORT_C void AddPolyLine(CGraphicsContext::TPenStyle aPenStyle, TRgb aPenColor, const TSize& aPenSize,
   1.214 -																CGraphicsContext::TBrushStyle aBrushStyle, TRgb aBrushColor,
   1.215 -																TBool aClosed, const CArrayFix<TPoint>* aPointList); // aPointList is not destroyed
   1.216 -	IMPORT_C void AddCircle(CGraphicsContext::TPenStyle aPenStyle, TRgb aPenColor, const TSize& aPenSize,
   1.217 -																CGraphicsContext::TBrushStyle aBrushStyle, TRgb aBrushColor,
   1.218 -																const TPoint& aCircleCenter, TInt aRadius);	
   1.219 -	inline TInt NumFeatures() const 
   1.220 -	/** Gets the number of features added to the hand. */
   1.221 -		{return *iNumFeaturesPtr;}
   1.222 -private:
   1.223 -	void AppendType(TAnalogDisplayHandFeatureType aType);
   1.224 -private:
   1.225 -	TInt* iNumFeaturesPtr;
   1.226 -	};
   1.227 -
   1.228 -//
   1.229 -// utility class
   1.230 -//
   1.231 -
   1.232 -class RAnimWithUtils : public RAnim
   1.233 -/** Utility class to support clock animation. 
   1.234 -
   1.235 -@publishedAll
   1.236 -@released
   1.237 -*/
   1.238 -	{
   1.239 -protected:
   1.240 -	RAnimWithUtils(RAnimDll& aAnimDll, const RWindowBase& aWindow);
   1.241 -	void AppendToConstructorBufL(const TDesC8& aData);
   1.242 -	void SendConstructorBufIfCompleteL(TInt aAnimatedObjectType);
   1.243 -	void SendConstructorBufL(TInt aAnimatedObjectType);
   1.244 -	TBool ConstructorBufExists() const;
   1.245 -	TBool ConstructorBufAlreadySent() const;
   1.246 -	TConstructorBuf8& ConstructorBuf() const;
   1.247 -	void SetNumAdditionsStillExpected(TInt aNumAdditionsStillExpected);
   1.248 -public:
   1.249 -	IMPORT_C virtual void Close();
   1.250 -private:
   1.251 -	TConstructorBuf8* iConstructorBuf; // on the heap as it is only required for construction
   1.252 -	TBool iConstructorBufAlreadySent;
   1.253 -	const RWindowBase& iWindow;
   1.254 -	TInt iNumAdditionsStillExpected;
   1.255 -	};
   1.256 -
   1.257 -//
   1.258 -// time-device abstract classes
   1.259 -//
   1.260 -
   1.261 -
   1.262 -class RTimeDevice : public RAnimWithUtils
   1.263 -/** Sets display parameters for clocks.
   1.264 - 
   1.265 -@publishedAll
   1.266 -@released
   1.267 -*/
   1.268 -	{
   1.269 -protected:
   1.270 -	RTimeDevice(RAnimDll& aAnimDll, const RWindowBase& aWindow);
   1.271 -	void AppendDisplayTypeL(TDisplayType aType);
   1.272 -	void AppendDigitalDisplayConstructorArgsL(const TPoint& aPosition, const TSize& aSize, const TMargins& aMargins, const STimeDeviceShadow& aShadow,
   1.273 -																TRgb aBackgroundColor, TInt aNumTextSections);
   1.274 -	void AppendAnalogDisplayConstructorArgsL(const TPoint& aPosition, const TSize& aSize, const TMargins& aMargins, const STimeDeviceShadow& aShadow,
   1.275 -																TInt aFaceHandle, TInt aFaceMaskHandle, TInt aNumHands, const SAnalogDisplayAmPm* aAmPm);
   1.276 -public:
   1.277 -	IMPORT_C void SetVisible(TBool aVisible); // can only be called after full construction - by default clocks are invisible
   1.278 -	IMPORT_C void SetPositionAndSize(const TPoint& aPosition, const TSize& aSize); // can only be called after full construction
   1.279 -	IMPORT_C void SetPosition(const TPoint& aPosition); // can only be called after full construction
   1.280 -	IMPORT_C void SetSize(const TSize& aSize); // can only be called after full construction
   1.281 -	IMPORT_C void UpdateDisplay(); // can only be called after full construction
   1.282 -	IMPORT_C void Draw(); // can only be called after full construction
   1.283 -	};
   1.284 -
   1.285 -//
   1.286 -
   1.287 -class RClock : public RTimeDevice
   1.288 -/** Sets the time for clocks.
   1.289 -
   1.290 -@publishedAll
   1.291 -@released */
   1.292 -	{
   1.293 -protected:
   1.294 -	RClock(RAnimDll& aAnimDll, const RWindowBase& aWindow);
   1.295 -	void AppendClockConstructorArgsL(TTimeIntervalSeconds aUniversalTimeOffset);
   1.296 -public:
   1.297 -	IMPORT_C void SetUniversalTimeOffset(TTimeIntervalSeconds aUniversalTimeOffset); // can only be called after full construction
   1.298 -	};
   1.299 -
   1.300 -//
   1.301 -// time-device concrete classes
   1.302 -//
   1.303 -
   1.304 -class RDigitalClock : public RClock
   1.305 -/** A digital clock.
   1.306 -
   1.307 -A digital clock is composed of one or more text sections, which define
   1.308 -how the time information is displayed.
   1.309 -
   1.310 -@publishedAll 
   1.311 -@released */
   1.312 -	{
   1.313 -public:
   1.314 -	IMPORT_C RDigitalClock(RAnimDll& aAnimDll, const RWindowBase& aWindow);
   1.315 -	IMPORT_C void ConstructL(TTimeIntervalSeconds aUniversalTimeOffset, const TPoint& aPosition, const TSize& aSize, const TMargins& aMargins,
   1.316 -																const STimeDeviceShadow& aShadow, TRgb aBackgroundColor, TInt aNumTextSections);
   1.317 -	IMPORT_C void AddTextSectionL(const TDigitalDisplayTextSection& aTextSection);
   1.318 -	IMPORT_C void SetBackgroundColor(TRgb aBackgroundColor, TRgb aShadowColor); // can only be called after full construction
   1.319 -	IMPORT_C void SetTextColor(TRgb aTextColor);
   1.320 -
   1.321 -	};
   1.322 -
   1.323 -//
   1.324 -
   1.325 -
   1.326 -class RAnalogClock : public RClock
   1.327 -/** An analogue clock.
   1.328 -
   1.329 -@see CFbsBitmap::Handle() 
   1.330 -@publishedAll 
   1.331 -@released */
   1.332 -
   1.333 -	{
   1.334 -public:
   1.335 -	IMPORT_C RAnalogClock(RAnimDll& aAnimDll, const RWindowBase& aWindow);
   1.336 -	IMPORT_C void ConstructL(TTimeIntervalSeconds aUniversalTimeOffset, const TPoint& aPosition, const TSize& aSize, const TMargins& aMargins,
   1.337 -																const STimeDeviceShadow& aShadow, TInt aFaceHandle, TInt aFaceMaskHandle, TInt aNumHands, const SAnalogDisplayAmPm* aAmPm=NULL);
   1.338 -																// N.B. the bitmap(s) passed in to aFaceHandle and aFaceMaskHandle in these
   1.339 -																// ConstructL functions cannot be destroyed until the RAnalogClock has been
   1.340 -																// completely constructed, including all necessary calls to
   1.341 -																// RAnalogClock::AddHandL() - aFaceMaskHandle may be 0
   1.342 -	IMPORT_C void AddHandL(const TAnalogDisplayHand& aHand);
   1.343 -	IMPORT_C void SetBackgroundColor(TRgb aBackgroundColor, TRgb aShadowColor); // can only be called after full construction
   1.344 -	IMPORT_C void SetTextColor(TRgb aTextColor);
   1.345 -	IMPORT_C void SetPenColor(const TRgb aPenColor);
   1.346 -	IMPORT_C void SetBrushColor(const TRgb aBrushColor);
   1.347 -	};
   1.348 -
   1.349 -//
   1.350 -// message-window class
   1.351 -//
   1.352 -
   1.353 -
   1.354 -class RMessageWindow : public RAnimWithUtils
   1.355 -/** A configurable window that appears for a brief time to display a message to 
   1.356 -the user and then disappears.
   1.357 -
   1.358 -This is the basic class that is used by classes such as CEikonEnv and CEikMsgWin 
   1.359 -to provide information and message windows. Such higher-level classes would 
   1.360 -normally be used by client applications rather than RMessageWindow. This class 
   1.361 -can be used though to implement specialist new classes. 
   1.362 -
   1.363 -Note that this class is in the same library as the Clock API for implementation 
   1.364 -reasons only.
   1.365 -
   1.366 -@see CEikMsgWin
   1.367 -@see CEikonEnv 
   1.368 -@publishedAll 
   1.369 -@released */
   1.370 -	{
   1.371 -public:
   1.372 -	/** Defines the maximum length of text in the message. */
   1.373 -	enum
   1.374 -		{
   1.375 -		/** Maximum length of text in the message. */
   1.376 -		EMaxTextLength=80
   1.377 -		};
   1.378 -public:
   1.379 -	IMPORT_C RMessageWindow(RAnimDll& aAnimDll, const RWindowBase& aWindow);
   1.380 -	IMPORT_C void ConstructL(TInt aBaselineOffset, TInt aFontHandle, TRgb aBackgroundColor, TRgb aTextColor);
   1.381 -	IMPORT_C void ConstructL(TInt aBaselineOffset, TInt aFontHandle, TRgb aBackgroundColor, TRgb aTextColor, TRgb aBorderColor);
   1.382 -	IMPORT_C void StartDisplay(TBool aFlash, TTimeIntervalMicroSeconds32 aInitialDelay, const TDesC& aText);
   1.383 -	IMPORT_C void StartDisplay(TBool aFlash, TTimeIntervalMicroSeconds32 aInitialDelay, TTimeIntervalMicroSeconds32 aDuration, const TDesC& aText);
   1.384 -	IMPORT_C void CancelDisplay();
   1.385 -	IMPORT_C void GetBorders(TMargins& aBorders);
   1.386 -	IMPORT_C void SetBackgroundColor(TRgb aBackgroundColor);
   1.387 -	IMPORT_C void SetTextColor(TRgb aTextColor);
   1.388 -	IMPORT_C void SetBorderColor(TRgb aBorderColor);
   1.389 -	IMPORT_C void SetPlinthColors(TRgb aTl,TRgb aBr);
   1.390 -	};
   1.391 -
   1.392 -#endif