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 00097 #start_since SINCE_3_1_SDK 00098 00116 IMPORT_C void Draw(const TRect& aRect) const; 00117 #end_since SINCE_3_1_SDK 00118 00119 public: 00123 enum TTextEmphasis 00124 { 00126 ENoEmphasis =0x00, 00127 00129 EPartialEmphasis =0x10, 00130 00132 EFullEmphasis =0x20 00133 }; 00134 public: // new functions 00135 00142 IMPORT_C void SetTextL(const TDesC& aText); 00143 00149 inline const TDesC* Text() const; 00150 00155 IMPORT_C void CropText(); 00156 00162 IMPORT_C void SetBufferReserveLengthL(TInt aLength); 00163 00169 IMPORT_C void SetFont(const CFont* aFont); 00170 00176 inline const CFont* Font() const; 00177 00183 IMPORT_C void SetEmphasis(TTextEmphasis aEmphasis); 00184 00191 IMPORT_C void SetPixelGapBetweenLines(TInt aGap); 00192 00198 IMPORT_C TInt PixelGapBetweenLines() const; 00199 00206 inline TBool IsUnderlined() const; 00207 00214 IMPORT_C void SetUnderlining(TBool aUnderLining); 00215 00223 inline TBool IsStrikethrough() const; 00224 00232 IMPORT_C void SetStrikethrough(TBool aStrikethrough); 00233 00240 IMPORT_C TSize CalcMinimumSize(TPtrC& aText) const; 00241 00247 inline TUint8 NumberOfLines(); 00248 00254 IMPORT_C TInt BufferReserveLength() const; 00255 00267 IMPORT_C void UseLogicalToVisualConversion( TBool aUseConversion ); 00268 00276 IMPORT_C TBool LogicalToVisualConversionUsed() const; 00277 00286 IMPORT_C void EnablePictographsL( CAknPictographInterface& aInterface ); 00287 00295 IMPORT_C void DisablePictographs(); 00296 public: // From CCoeControl 00297 00315 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00316 protected: // from CCoeControl 00317 00327 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; 00328 private: 00329 IMPORT_C void Reserved_2(); 00330 private: 00334 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00335 private: // new functions 00336 TInt HeightInPixels() const; 00337 TInt WidthInPixels(TPtrC& aText) const; 00338 void SetupGcForEmphasis(CGraphicsContext& aGc) const; 00339 TBool CheckAndCreateExtension(); 00340 00341 protected: 00342 00346 enum TLabelFlags 00347 { 00349 EUnderlining = 0x02, 00350 00352 EStrikethrough = 0x04, 00353 00363 EUseLogicalToVisualConversion = 0x08 00364 // flags 0x10, 0x20, 0x40 are already used for text emphasis! 00365 }; 00366 00368 HBufC* iText; 00369 00371 const CFont* iFont; 00372 00374 TUint8 iNumberOfLines; 00375 00380 TUint8 iLabFlags; 00381 00383 TInt iGapBetweenLines; 00384 00385 private: 00386 TInt iReserveLength; 00387 CEikLabelExtension* iExtension; 00388 TInt iSpare[2]; 00389 }; 00390 00391 00392 inline const TDesC* CEikLabel::Text() const 00393 { return(iText); } 00394 inline const CFont* CEikLabel::Font() const 00395 { return(iFont); } 00396 inline TBool CEikLabel::IsUnderlined() const 00397 {return iLabFlags&EUnderlining;} 00398 inline TBool CEikLabel::IsStrikethrough() const 00399 {return iLabFlags&EStrikethrough;} 00400 inline TUint8 CEikLabel::NumberOfLines() 00401 {return iNumberOfLines;} 00402 00403 // __EIKLABEL_H__ 00404 #endif