00001 // EIKLABEL.H 00002 // 00003 // Copyright (c) 1997-1999 Symbian Ltd. All rights reserved. 00004 // 00005 00006 #if !defined(__EIKLABEL_H__) 00007 #define __EIKLABEL_H__ 00008 00009 00010 #if !defined(__EIKALIGN_H__) 00011 #include <eikalign.h> 00012 #endif 00013 00014 #if !defined(__COECCNTX_H__) 00015 #include <coeccntx.h> 00016 #endif 00017 00018 #include <bidi.h> 00019 00020 class CEikLabelExtension; 00021 class CAknPictographInterface; 00022 00026 class CEikLabel : public CEikAlignedControl, public MCoeControlContext 00027 { 00028 public: // new functions 00032 IMPORT_C ~CEikLabel(); 00036 IMPORT_C CEikLabel(); 00045 IMPORT_C void SetLabelAlignment(TInt aAlignment); 00046 00053 IMPORT_C void SetBrushStyle(CWindowGc::TBrushStyle aBrushStyle); 00054 00059 IMPORT_C void SetBrushStyleFromContext(); 00060 00061 00062 public: // from CCoeControl 00070 IMPORT_C TSize MinimumSize(); 00078 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); 00079 00087 IMPORT_C void GetColorUseListL( 00088 CArrayFix<TCoeColorUse>& aColorUseList) const; 00096 IMPORT_C void HandleResourceChange(TInt aType); // not available before Release 005u 00114 IMPORT_C void Draw(const TRect& aRect) const; 00115 00116 public: 00120 enum TTextEmphasis 00121 { 00123 ENoEmphasis =0x00, 00124 00126 EPartialEmphasis =0x10, 00127 00129 EFullEmphasis =0x20 00130 }; 00131 public: // new functions 00132 00139 IMPORT_C void SetTextL(const TDesC& aText); 00140 00146 inline const TDesC* Text() const; 00147 00152 IMPORT_C void CropText(); 00153 00159 IMPORT_C void SetBufferReserveLengthL(TInt aLength); 00160 00166 IMPORT_C void SetFont(const CFont* aFont); 00167 00173 inline const CFont* Font() const; 00174 00180 IMPORT_C void SetEmphasis(TTextEmphasis aEmphasis); 00181 00188 IMPORT_C void SetPixelGapBetweenLines(TInt aGap); 00189 00195 IMPORT_C TInt PixelGapBetweenLines() const; 00196 00203 inline TBool IsUnderlined() const; 00204 00211 IMPORT_C void SetUnderlining(TBool aUnderLining); 00212 00220 inline TBool IsStrikethrough() const; 00221 00229 IMPORT_C void SetStrikethrough(TBool aStrikethrough); 00230 00237 IMPORT_C TSize CalcMinimumSize(TPtrC& aText) const; 00238 00244 inline TUint8 NumberOfLines(); 00245 00251 IMPORT_C TInt BufferReserveLength() const; 00252 00264 IMPORT_C void UseLogicalToVisualConversion( TBool aUseConversion ); 00265 00273 IMPORT_C TBool LogicalToVisualConversionUsed() const; 00274 00283 IMPORT_C void EnablePictographsL( CAknPictographInterface& aInterface ); 00284 00292 IMPORT_C void DisablePictographs(); 00293 public: // From CCoeControl 00294 00312 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00313 protected: // from CCoeControl 00314 00324 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; 00325 private: 00326 IMPORT_C void Reserved_2(); 00327 private: 00331 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00332 private: // new functions 00333 TInt HeightInPixels() const; 00334 TInt WidthInPixels(TPtrC& aText) const; 00335 TInt HeightInPixels(TPtrC& aText) const; 00336 void SetupGcForEmphasis(CGraphicsContext& aGc) const; 00337 TBool CheckAndCreateExtension(); 00338 00339 protected: 00340 00344 enum TLabelFlags 00345 { 00347 EUnderlining = 0x02, 00348 00350 EStrikethrough = 0x04, 00351 00361 EUseLogicalToVisualConversion = 0x08 00362 // flags 0x10, 0x20, 0x40 are already used for text emphasis! 00363 }; 00364 00366 HBufC* iText; 00367 00369 const CFont* iFont; 00370 00372 TUint8 iNumberOfLines; 00373 00378 TUint8 iLabFlags; 00379 00381 TInt iGapBetweenLines; 00382 00383 private: 00384 TInt iReserveLength; 00385 CEikLabelExtension* iExtension; 00386 TInt iSpare[2]; 00387 }; 00388 00389 00390 inline const TDesC* CEikLabel::Text() const 00391 { return(iText); } 00392 inline const CFont* CEikLabel::Font() const 00393 { return(iFont); } 00394 inline TBool CEikLabel::IsUnderlined() const 00395 {return iLabFlags&EUnderlining;} 00396 inline TBool CEikLabel::IsStrikethrough() const 00397 {return iLabFlags&EStrikethrough;} 00398 inline TUint8 CEikLabel::NumberOfLines() 00399 {return iNumberOfLines;} 00400 00401 // __EIKLABEL_H__ 00402 #endif