00001 // EIKCLBD.H 00002 // 00003 // Copyright (c) 1997-1999 Symbian Ltd. All rights reserved. 00004 // 00005 #if !defined(__EIKCLBD_H__) 00006 #define __EIKCLBD_H__ 00007 00008 #include <e32base.h> 00009 #include <gdi.h> 00010 00011 #include <eiklbd.h> 00012 #include <avkon.hrh> 00013 #include <babitflags.h> // for TBitFlags32 00014 00015 class CWindowGc; 00016 class CGulIcon; 00017 class CColumnListBoxDataExtension; 00018 class MAknsControlContext; 00019 class CCoeControl; 00020 class TAknsItemID; 00021 class CAknsEffectAnim; 00022 class CAknsListBoxBackgroundControlContext; 00023 class CAknLayoutData; 00024 #start_since SINCE_3_1_SDK 00025 class TAknWindowLineLayout; 00026 class TAknTextLineLayout; 00027 class TAknWindowComponentLayout; 00028 class TAknTextComponentLayout; 00029 class MAknsSkinInstance; 00030 #end_since SINCE_3_1_SDK 00031 00040 class MColumnListBoxAnimBackgroundDrawer 00041 { 00042 public: 00043 00052 virtual TBool DrawHighlightAnimBackground( CFbsBitGc& aGc ) const = 0; 00053 }; 00054 00069 class CColumnListBoxData : public CListBoxData 00070 { 00071 friend class CColumnListBoxDataExtension; 00072 public: 00073 00080 class TColors 00081 { 00082 public: 00083 00087 IMPORT_C TColors(); 00088 public: 00089 00093 TRgb iText; 00094 00098 TRgb iBack; 00099 00103 TRgb iHighlightedText; 00104 00108 TRgb iHighlightedBack; 00109 }; 00110 00111 public: 00112 00122 IMPORT_C static CColumnListBoxData* NewL(); 00123 00127 IMPORT_C ~CColumnListBoxData(); 00128 00129 public: 00130 00137 IMPORT_C TInt LastColumn() const; 00138 00146 IMPORT_C TInt ColumnWidthPixel(TInt aColumn) const; 00147 00157 IMPORT_C void SetColumnWidthPixelL(TInt aColumn,TInt aWidth); 00158 00162 IMPORT_C TInt ColumnHorizontalGap(TInt aColumn) const; 00163 00167 IMPORT_C void SetColumnHorizontalGapL(TInt aColumn,TInt aGap); 00168 00175 IMPORT_C TInt ColumnBaselinePos(TInt aColumn) const; 00176 00183 IMPORT_C void SetColumnBaselinePosL(TInt aColumn,TInt aPos); 00184 00191 IMPORT_C TMargins ColumnMargins(TInt aColumn) const; 00192 00199 IMPORT_C void SetColumnMarginsL(TInt aColumn,TMargins aMargins); 00200 00207 IMPORT_C const CFont* ColumnFont(TInt aColumn) const; 00208 00215 IMPORT_C void SetColumnFontL(TInt aColumn,const CFont* aFont); 00216 00225 IMPORT_C CGraphicsContext::TTextAlign ColumnAlignment(TInt aColumn) const; 00226 00236 IMPORT_C void SetColumnAlignmentL(TInt aColumn, 00237 CGraphicsContext::TTextAlign aAlign); 00238 00242 IMPORT_C CGraphicsContext::TPenStyle ColumnSeparatorStyle( 00243 TInt aColumn) const; 00247 IMPORT_C void SetColumnSeparatorStyleL(TInt aColumn, 00248 CGraphicsContext::TPenStyle aStyle); 00249 00256 IMPORT_C TBool ColumnIsOptional(TInt aColumn) const; 00257 00264 IMPORT_C void SetOptionalColumnL(TInt aColumn,TBool aIsOptional); 00265 00272 IMPORT_C TBool ColumnIsGraphics(TInt aColumn) const; 00273 00280 IMPORT_C void SetGraphicsColumnL(TInt aColumn,TBool aIsGraphics); 00281 00288 IMPORT_C TBool ColumnIsNumber(TInt aColumn) const; 00289 00296 IMPORT_C void SetNumberColumnL(TInt aColumn,TBool aIsNumber); 00297 00305 IMPORT_C CArrayPtr<CGulIcon>* IconArray() const; 00306 00312 IMPORT_C void SetIconArray(CArrayPtr<CGulIcon>* aArray); 00313 00321 IMPORT_C TInt ColumnTextClipGap(TInt aSubCellIndex) const; 00322 00329 IMPORT_C void SetColumnTextClipGapL(TInt aSubCellIndex, TInt aSize); 00330 00340 IMPORT_C CFont* Font(const TListItemProperties& aItemProperties, 00341 TInt aColumn) const; 00342 00352 IMPORT_C TBool MakeColumnRect( TInt aColumn, TRect& aRect ); 00353 00371 IMPORT_C virtual void Draw(const TListItemProperties& aItemProperties, 00372 CWindowGc& aGc, 00373 const TDesC* aText, 00374 const TRect& aRect, 00375 TBool aHighlight, 00376 const TColors& aColors) const; 00377 00378 #start_since SINCE_3_1_SDK 00379 00383 void DrawSimple(const TListItemProperties& aItemProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight,const TColors& aColors) const; 00384 #end_since SINCE_3_1_SDK 00385 00390 IMPORT_C void SetSeparatorLinePosition( 00391 TAknSeparatorLinePosition aPosition); 00392 00398 IMPORT_C TAknSeparatorLinePosition SeparatorLinePosition() const; 00399 00408 IMPORT_C CAknLayoutData *LayoutData() const; 00409 00418 IMPORT_C TBool LayoutInit() const; 00419 00428 IMPORT_C void SetLayoutInit(TBool aValue) const; 00429 00440 IMPORT_C void SetColumnUnderlined( TBitFlags32 aUnderlinedColumns ); 00441 00442 private: 00443 struct SColumn 00444 { 00445 TInt iColumn; // Must be first entry 00446 TInt iWidth; 00447 TMargins iMargins; 00448 TInt iVerticalCap; 00449 const CFont* iBaseFont; 00450 TInt iActualFontIndex; 00451 TBool iGraphics; 00452 TBool iOptional; 00453 TInt iBaseline; 00454 CGraphicsContext::TTextAlign iAlign; 00455 CGraphicsContext::TPenStyle iSeparator; 00456 TInt iTextClipGap; 00457 TBool iNumberColumn; 00458 // the next are for storing x-coordinates of a column for the drawing algorithm. 00459 __MUTABLE TInt iX; 00460 __MUTABLE TInt iEndX; 00461 }; 00462 protected: 00463 00467 IMPORT_C CColumnListBoxData(); 00468 00475 IMPORT_C void ConstructLD(); 00476 00485 IMPORT_C void ConstructLD( const TAknsItemID& aAnimationIID ); 00486 00487 private: 00488 00489 IMPORT_C TInt ColumnX(TInt aColumn) const; 00490 IMPORT_C void SetColumnXL(TInt aColumn,TInt aX) const; // note, const! (do not affect external state) 00491 // 00492 IMPORT_C TInt ColumnEndX(TInt aColumn) const; 00493 IMPORT_C void SetColumnEndXL(TInt aColumn,TInt aEndX) const; // note, Const! 00494 00495 void AddColumnL(TInt aColumn); 00496 SColumn& At(TInt aArrayIndex); 00497 const SColumn& At(TInt aArrayIndex) const; 00498 TBool FindColumnIndex(TInt& aArrayIndex,TInt aColumn) const; 00499 void FindColumnIndexOrAddL(TInt& aArrayIndex,TInt aColumn); 00500 TInt AddActualFontL(const CFont* aBaseFont); 00501 void SetUnderlineStyle( TListItemProperties aProperties, CWindowGc& aGc, TInt aColumn ) const; 00502 void DoConstructL( const TAknsItemID& aAnimationIID ); 00503 public: 00504 00510 IMPORT_C CCoeControl *Control() const; 00511 00518 IMPORT_C void SetControl(CCoeControl *aControl); 00519 00525 IMPORT_C MAknsControlContext* SkinBackgroundContext() const; 00526 00532 void SetSkinBackgroundContext( 00533 CAknsListBoxBackgroundControlContext *aContext); 00534 // takes ownership 00535 00542 IMPORT_C void SetSkinStyle(const TAknsItemID *aId, 00543 const TRect &aTileRect); 00544 00551 IMPORT_C void SetListEndSkinStyle(const TAknsItemID *aId, 00552 const TRect &aRect); 00553 00560 IMPORT_C void SetSkinHighlightFrame(const TAknsItemID *aFrameId, 00561 const TAknsItemID *aFrameCenterId); 00562 00569 IMPORT_C void SetSkinEnabledL(TBool aEnabled); 00570 00574 void CreatePictographInterfaceL(); 00575 00579 void CreateMarqueeControlL(); 00580 00584 void ResetMarquee(); 00585 00591 TInt CurrentMarqueeItemIndex(); 00592 00598 void SetCurrentMarqueeItemIndex(TInt aIndex); 00599 00605 IMPORT_C void EnableMarqueeL(TBool aEnable); 00606 00614 IMPORT_C void SetColumnFontForRowL(TInt aRow, 00615 TInt aColumn, 00616 const CFont* aFont); 00617 00625 IMPORT_C const CFont* RowAndColumnFont(TInt aRow,TInt aColumn) const; 00626 00636 void SetCurrentItemIndex(TInt aIndex); 00637 00645 IMPORT_C void SetSubCellIconSize(TInt aIndex, TSize aSize); 00646 00653 TSize GetSubCellIconSize(TInt aIndex); 00654 00664 IMPORT_C const CAknsEffectAnim* HighlightAnim() const; 00665 00673 IMPORT_C void AboutToDrawHighlightAnim() const; 00674 00683 IMPORT_C void SetHighlightAnimBackgroundDrawer( 00684 MColumnListBoxAnimBackgroundDrawer* aDrawer ); 00685 00694 IMPORT_C void SetItemCellSize( const TSize& aSizeInPixels ); 00695 00696 #start_since SINCE_3_1_SDK 00697 00703 IMPORT_C TBool HasHighlightAnim() const; 00704 #end_since SINCE_3_1_SDK 00705 00706 #start_since SINCE_3_1_SDK 00707 00732 IMPORT_C TBool DrawHighlightAnim( CBitmapContext& aGc, const TRect& aRect ) const; 00733 #end_since SINCE_3_1_SDK 00734 00735 void FocusGained(); 00736 00741 void FocusLost(); 00742 00748 void HandleResourceChange( TInt aType ); 00749 00754 void SetupSkinContextL(); 00755 00761 void SetESSTextColor(TRgb aTextColor); 00762 00768 void SetESSHighlightedTextColor(TRgb aHighlightedTextColor); 00769 00770 #start_since SINCE_3_1_SDK 00771 00774 IMPORT_C void SetGraphicSubCellL(TInt aSubCell,const TAknWindowLineLayout &aGraphicLayout); 00778 IMPORT_C void SetTextSubCellL(TInt aSubCell,const TAknTextLineLayout &aTextLayout); 00782 IMPORT_C void SetConditionalSubCellL(TInt aSubCell, const TAknTextLineLayout &aTextLayout,TInt aAffectedSubCell); 00786 IMPORT_C void SubCellsMightIntersect( const TBool aMightIntersect ); 00787 00791 IMPORT_C void SetStretchableGraphicSubCellL(TInt aSubCell, 00792 const TAknWindowComponentLayout& aNormalLayout, 00793 const TAknWindowComponentLayout& aStretchedLayout); 00797 IMPORT_C void SetStretchableTextSubCellL(TInt aSubCell, 00798 const TAknTextComponentLayout& aNormalLayout, 00799 const TAknTextComponentLayout& aStretchedLayout); 00803 IMPORT_C void SetStretchableConditionalSubCellL(TInt aSubCell, 00804 const TAknTextComponentLayout& aNormalLayout, 00805 const TAknTextComponentLayout& aStretchedLayout, 00806 TInt aNormalSubCell, 00807 TInt aStretchedSubCell ); 00811 IMPORT_C void ResetSLSubCellArray(); 00815 TBool UsesScalableLayoutData() const; 00819 void EnableStretching(const TBool aEnabled); 00823 IMPORT_C TBool StretchingEnabled() const; 00824 #end_since SINCE_3_1_SDK 00825 protected: 00826 00845 IMPORT_C void DrawText(CWindowGc& aGc, 00846 const TRect& aTextRect, 00847 const TDesC& aText, 00848 const TDesC& aClippedText, 00849 const TInt aBaselineOffset, 00850 const CGraphicsContext::TTextAlign aAlign, 00851 const CFont& aFont, 00852 const TBool aHighlight, 00853 const TBool aIsTextClipped) const; 00854 00855 public: 00868 IMPORT_C void SetMarqueeParams(const TInt aLoops, 00869 const TInt aScrollAmount, 00870 const TInt aScrollDelay); 00871 00881 IMPORT_C void SetMarqueeParams(const TInt aLoops, 00882 const TInt aScrollAmount, 00883 const TInt aScrollDelay, 00884 const TInt aInterval); 00885 00886 private: 00887 void DrawHighLight( CWindowGc& aGc, const TRect& aRect, 00888 TBool aHighlight, 00889 MAknsSkinInstance* aSkin ) const; 00890 00891 void CheckIfSubCellsIntersect( TAknTextLineLayout* aLayouts, 00892 TBool* aResults, const TDesC& aText, 00893 const TRect& aItemRect ) const; 00897 void BitBltColored( CWindowGc& aGc, 00898 TBool aHighlight, 00899 const CGulIcon* aIcon, 00900 TInt aSubcell, 00901 TBool aColorIcon, 00902 const TRect& aGraphicRect ) const; 00903 00904 00905 00906 private: 00907 CArrayFix<SColumn>* iColumnArray; 00908 CColumnListBoxDataExtension *iExtension; 00909 }; 00910 00911 // __EIKCLBD_H__ 00912 #endif 00913 00914 // End of File