EIKLABEL.H

Go to the documentation of this file.
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(const TDesC& aText) const;
00336     void SetupGcForEmphasis(CGraphicsContext& aGc) const;
00337     TBool CheckAndCreateExtension();
00338     void ConvertColorsForOutlineEffect(TRgb& aFillColor, TRgb& aOutlineColor) const;
00339 
00340 public:
00344     void DrawToContext( CBitmapContext& aContext, 
00345         const TRgb* aOverrideColor ) const;
00346 
00347 protected:
00348     
00352     enum TLabelFlags
00353         {
00355         EUnderlining                  = 0x02,
00356         
00358         EStrikethrough                = 0x04,
00359 
00369         EUseLogicalToVisualConversion = 0x08
00370         // flags 0x10, 0x20, 0x40 are already used for text emphasis!
00371         };
00372     
00374     HBufC* iText;
00375     
00377     const CFont* iFont;
00378     
00380     TUint8 iNumberOfLines;
00381     
00386     TUint8 iLabFlags;
00387 
00389     TInt iGapBetweenLines;
00390 
00391 private:
00392     TInt iReserveLength;
00393     CEikLabelExtension* iExtension;
00394     TInt iSpare[2];
00395     };
00396 
00397 
00398 inline const TDesC* CEikLabel::Text() const
00399         { return(iText); }
00400 inline const CFont* CEikLabel::Font() const
00401         { return(iFont); }
00402 inline TBool CEikLabel::IsUnderlined() const
00403     {return iLabFlags&EUnderlining;}
00404 inline TBool CEikLabel::IsStrikethrough() const
00405     {return iLabFlags&EStrikethrough;}
00406 inline TUint8 CEikLabel::NumberOfLines()
00407         {return iNumberOfLines;}        
00408 
00409 #endif // __EIKLABEL_H__

Copyright © Nokia Corporation 2001-2007
Back to top