00001 /* 00002 * ============================================================================ 00003 * Name : Eikfrlbd.h 00004 * Part of : Avkon 00005 * Description : 00006 * Version : 00007 * 00008 * Copyright © 2002-2006 Nokia. All rights reserved. 00009 * This material, including documentation and any related computer 00010 * programs, is protected by copyright controlled by Nokia. All 00011 * rights are reserved. Copying, including reproducing, storing, 00012 * adapting or translating, any or all of this material requires the 00013 * prior written consent of Nokia. This material also contains 00014 * confidential information which may not be disclosed to others 00015 * without the prior written consent of Nokia. 00016 * ============================================================================ 00017 */ 00018 00019 // 00020 // EIKFRLBD.H 00021 // 00022 // Copyright (c) 2001 Symbian Ltd. All rights reserved. 00023 // 00024 #if !defined(__EIKFRLBD_H__) 00025 #define __EIKFRLBD_H__ 00026 00027 #include <e32base.h> 00028 #include <gdi.h> 00029 00030 #include <eiklbd.h> 00031 #include <eikfrlb.h> 00032 #include <avkon.hrh> 00033 #include <aknsdrawutils.h> // for TAknsQsnTextColorsIndex 00034 #include <babitflags.h> // for TBitFlags32 00035 00036 class CWindowGc; 00037 class CGulIcon; 00038 class CFormattedCellListBoxDataExtension; 00039 class MAknsControlContext; 00040 class TAknsItemID; 00041 class CAknLayoutData; 00042 class CAknsEffectAnim; 00043 class TAknTextLineLayout; 00044 class TAknWindowLineLayout; 00045 #start_since SINCE_3_1_SDK 00046 class TAknTextComponentLayout; 00047 class TAknWindowComponentLayout; 00048 #end_since SINCE_3_1_SDK 00049 00058 class MListBoxAnimBackgroundDrawer 00059 { 00060 public: 00065 virtual TBool DrawHighlightAnimBackground( CFbsBitGc& aGc ) const = 0; 00066 }; 00067 00092 class CFormattedCellListBoxData : public CListBoxData 00093 { 00094 friend class CFormattedCellListBoxDataExtension; 00095 00096 public: 00097 00098 //INNER CLASS DECLARATION 00099 /* 00100 * A container class for storage of colour values. 00101 * Used by @c CFormattedCellListBoxData. 00102 */ 00103 class TColors 00104 { 00105 00106 public: 00107 00111 IMPORT_C TColors(); 00112 00113 public: 00114 00118 TRgb iText; 00119 00123 TRgb iBack; 00124 00128 TRgb iHighlightedText; 00129 00133 TRgb iHighlightedBack; 00134 00141 TRgb iRightSeparatorColor; 00142 }; 00143 00144 public: 00145 00151 IMPORT_C static CFormattedCellListBoxData* NewL(); 00152 00156 IMPORT_C ~CFormattedCellListBoxData(); 00157 00158 public: 00159 00166 IMPORT_C const TColors& SubCellColors(TInt aSubCellIndex) const; 00167 00174 IMPORT_C void SetSubCellColorsL(TInt aSubCellIndex, const TColors &aColors); 00175 00182 IMPORT_C TInt SubCellBaselinePos(TInt aSubCellIndex) const; 00183 00184 #start_since SINCE_3_1_SDK 00185 00192 IMPORT_C void SetSubCellBaselinePosL(TInt aSubCellIndex, TInt aPos); 00193 #end_since SINCE_3_1_SDK 00194 00201 IMPORT_C TSize SubCellSize(TInt aSubCellIndex) const; 00202 00209 IMPORT_C void SetSubCellSizeL(TInt aSubCellIndex, TSize aSize); 00210 00217 IMPORT_C TPoint SubCellPosition(TInt aSubCellIndex) const; 00218 00225 IMPORT_C void SetSubCellPositionL(TInt aSubCellIndex, TPoint aPosition); 00226 00234 IMPORT_C TBool SubCellIsTransparent(TInt aSubCellIndex) const; 00235 00242 IMPORT_C void SetTransparentSubCellL(TInt aSubCellIndex, 00243 TBool aIsTransparent); 00244 00253 IMPORT_C TBool SubCellIsNotAlwaysDrawn(TInt aSubCellIndex) const; 00254 00261 IMPORT_C void SetNotAlwaysDrawnSubCellL(TInt aSubCellIndex, 00262 TBool aIsNotAlwaysDrawn); 00263 00270 IMPORT_C TMargins SubCellMargins(TInt aSubCellIndex) const; 00271 00278 IMPORT_C void SetSubCellMarginsL(TInt aSubCellIndex, TMargins aMargins); 00279 00286 IMPORT_C const CFont* SubCellFont(TInt aSubCellIndex) const; 00287 00294 IMPORT_C void SetSubCellFontL(TInt aSubCellIndex, const CFont* aFont); 00295 00302 IMPORT_C CGraphicsContext::TTextAlign SubCellAlignment(TInt aSubCellIndex) 00303 const; 00304 00311 IMPORT_C void SetSubCellAlignmentL(TInt aSubCellIndex, 00312 CGraphicsContext::TTextAlign aAlign); 00313 00322 IMPORT_C TBool SubCellIsGraphics(TInt aSubCellIndex) const; 00323 00332 IMPORT_C void SetGraphicsSubCellL(TInt aSubCellIndex, TBool aIsGraphics); 00333 00340 IMPORT_C CGraphicsContext::TPenStyle 00341 SubCellRightSeparatorStyle(TInt aColumn) const; 00342 00350 IMPORT_C void SetSubCellRightSeparatorStyleL(TInt aSubCell, 00351 CGraphicsContext::TPenStyle aStyle); 00352 00364 IMPORT_C TInt SubCellTextClipGap(TInt aSubCellIndex) const; 00365 00366 #start_since SINCE_3_1_SDK 00367 00375 IMPORT_C void SetSubCellTextClipGapL(TInt aSubCellIndex, TInt aGap); 00376 #end_since SINCE_3_1_SDK 00377 00378 00385 IMPORT_C TBool SkinEnabled() const; 00386 00395 IMPORT_C void SetSkinEnabledL(TBool aEnabled); 00396 00404 IMPORT_C TBool SubCellIsNumberCell(TInt aSubCellIndex) const; 00405 00413 IMPORT_C void SetNumberCellL(TInt aSubCellIndex, TBool aIsNumberCell); 00414 00418 IMPORT_C CArrayPtr<CGulIcon>* IconArray() const; 00419 00432 IMPORT_C void SetIconArrayL(CArrayPtr<CGulIcon>* aArray); 00433 00446 IMPORT_C void SetIconArray(CArrayPtr<CGulIcon>* aArray); 00447 00455 IMPORT_C CFont* Font(const TListItemProperties& aItemProperties, 00456 TInt aSubCellIndex) const; 00457 00473 IMPORT_C virtual void Draw(TListItemProperties aProperties, 00474 CWindowGc& aGc, 00475 const TDesC* aText, 00476 const TRect& aRect, 00477 TBool aHighlight, 00478 const TColors& aColors) const; 00479 00487 IMPORT_C TBool UseSubCellColors(TInt aSubCell) const; 00488 00496 IMPORT_C CCoeControl* Control() const; 00497 00506 IMPORT_C void SetControl(CCoeControl* aControlOrNull); 00507 00514 IMPORT_C MAknsControlContext* SkinBackgroundContext() const; 00522 IMPORT_C void SetBackgroundSkinStyle(const TAknsItemID *aId, 00523 const TRect &aRect); 00524 00532 IMPORT_C void SetSkinStyle(const TAknsItemID* aId, const TRect& aTileRect); 00533 00540 IMPORT_C void SetSkinParentPos(const TPoint& aPos); 00541 00549 IMPORT_C void SetListEndSkinStyle(const TAknsItemID *listEndId, 00550 const TRect &aRect); 00551 00558 IMPORT_C TBool RespectFocus() const; 00559 00566 IMPORT_C void SetRespectFocus(TBool aBool); 00567 00575 IMPORT_C void SetSkinHighlightFrame(const TAknsItemID* aFrameId, 00576 const TAknsItemID* aFrameCenterId); 00584 IMPORT_C void SetSkinPopupFrame(const TAknsItemID* aFrameId, 00585 const TAknsItemID* aFrameCenterId); 00586 00594 IMPORT_C void SetSkinPopupFramePosition(const TRect& aOuterRect, 00595 const TRect& aInnerRect); 00596 00611 IMPORT_C void UseLogicalToVisualConversion( TBool aUseConversion ); 00612 00618 IMPORT_C void EnableMarqueeL(TBool aEnable); 00619 00625 #ifdef __WINS__ 00626 IMPORT_C const TBool IsMarqueeOn(); 00627 #else 00628 IMPORT_C TBool IsMarqueeOn(); 00629 // __WINS__ 00630 #endif 00631 00636 void FocusGained(); 00637 00643 void FocusLost(); 00644 00650 void HandleResourceChange( TInt aType ); 00651 00660 IMPORT_C const CAknsEffectAnim* HighlightAnim() const; 00661 00667 IMPORT_C void AboutToDrawHighlightAnim() const; 00668 00676 IMPORT_C void SetHighlightAnimBackgroundDrawer( 00677 MListBoxAnimBackgroundDrawer* aDrawer ); 00678 00686 IMPORT_C void SetItemCellSize( const TSize& aSize ); 00687 00688 #start_since SINCE_3_1_SDK 00689 00695 IMPORT_C TBool HasHighlightAnim() const; 00696 #end_since SINCE_3_1_SDK 00697 00698 #start_since SINCE_3_1_SDK 00699 00724 IMPORT_C TBool DrawHighlightAnim( CBitmapContext& aGc, const TRect& aRect ) const; 00725 #end_since SINCE_3_1_SDK 00726 00731 void CreatePictographInterfaceL(); 00732 00737 void CreateMarqueeControlL(); 00738 00742 void ResetMarquee(); 00743 00749 TInt CurrentMarqueeItemIndex(); 00750 00756 void SetCurrentMarqueeItemIndex(TInt aIndex); 00757 00766 void SetCurrentItemIndex(TInt aIndex); 00767 00768 #start_since SINCE_3_1_SDK 00769 00774 void SetCurrentlyDrawnItemIndex( TInt aIndex ); 00775 #end_since SINCE_3_1_SDK 00776 00784 IMPORT_C void SetSubCellFontForRowL(TInt aRowIndex, 00785 TInt aSubCellIndex, 00786 const CFont* aFont); 00787 00795 IMPORT_C const CFont* RowAndSubCellFont(TInt aRow, 00796 TInt aSubCellIndex) const; 00797 00804 IMPORT_C void SetDrawBackground(const TBool aDrawBackground); 00805 00812 TBool IsBackgroundDrawingEnabled() const; 00813 00820 void SetDrawScrollbarBackground(const TBool aDrawBackground); 00821 00828 TBool IsScrollbarBackgroundDrawingEnabled() const; 00829 00835 IMPORT_C void SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition); 00836 00842 IMPORT_C TAknSeparatorLinePosition SeparatorLinePosition() const; 00843 00852 IMPORT_C CAknLayoutData* LayoutData() const; 00853 00863 IMPORT_C TBool LayoutInit() const; 00864 00874 IMPORT_C void SetLayoutInit(TBool aValue); 00875 00885 IMPORT_C void SetSubcellUnderlined( TBitFlags32 aUnderlinedCells ); 00886 00887 #Start_since SINCE_3_1_SDK 00888 00898 void UseHighlightIconSwapping( TBool aUse ); 00899 TBool UseHighlightIconSwapping() const; 00900 #end_since SINCE_3_1_SDK 00901 00902 #Start_since SINCE_3_1_SDK 00903 00908 TSize SubCellRealSize(TInt aSubCellIndex) const; 00914 void SetSubCellRealSize(TInt aSubCellIndex, TSize aRealSize) const; 00920 TSize SubCellRealTextSize(TInt aSubCellIndex) const; 00926 void SetSubCellRealTextSize(TInt aSubCellIndex, TSize aRealSize) const; 00927 00928 00934 struct SSubCell 00935 { 00936 SSubCell() { } 00937 TInt iSubCell; // Must be first entry 00938 00939 TInt iWidth; 00940 TMargins iMargin; 00941 const CFont* iBaseFont; 00942 TInt iActualFontIndex; 00943 TBool iGraphics; 00944 TBool iTransparent; 00945 TBool iNotAlwaysDrawn; 00946 CGraphicsContext::TTextAlign iAlign; 00947 CGraphicsContext::TPenStyle iRightSeparatorStyle; 00948 00949 TPoint iPosition; 00950 TInt iBaseline; 00951 TSize iSize; 00952 00953 TBool iUseSubCellColors; // this is set if someone calls SetSubCellColorsL() 00954 TColors iColors; 00955 TInt iTextClipGap; 00956 00957 TBool iNumberCell; 00958 // the next ones change during drawing algorithm 00959 __MUTABLE TSize iRealSize; 00960 __MUTABLE TSize iRealTextSize; 00961 }; 00962 #end_since SINCE_3_1_SDK 00963 00964 protected: 00965 00969 IMPORT_C CFormattedCellListBoxData(); 00970 00975 IMPORT_C void ConstructLD(); 00976 00984 IMPORT_C void ConstructLD(const TAknsItemID& aAnimationIID); 00985 01001 IMPORT_C void DrawFormatted(TListItemProperties aProperties, 01002 CWindowGc& aGc, 01003 const TDesC* aText, 01004 const TRect& aRect, 01005 TBool aHighlight, 01006 const TColors& aColors) const; 01007 01019 void DrawFormattedSimple( TListItemProperties& aProperties, 01020 CWindowGc& aGc, 01021 const TDesC* aText, 01022 const TRect& aRect, 01023 TBool aHighlight, 01024 const TColors& aColors ) const; 01025 private: 01029 void DrawFormattedOld( TListItemProperties& aProperties, 01030 CWindowGc& aGc, 01031 const TDesC* aText, 01032 const TRect& aItemRect, 01033 TBool aHighlight, 01034 const TColors& aColors ) const; 01035 01039 void BitBltColored( CWindowGc& aGc, 01040 TBool aHighlight, 01041 const CGulIcon* aIcon, 01042 TInt aSubcell, 01043 TBool aColorIcon, 01044 const TRect& aGraphicRect ) const; 01045 01046 01047 public: 01059 IMPORT_C void SetMarqueeParams(const TInt aLoops, 01060 const TInt aScrollAmount, 01061 const TInt aScrollDelay, 01062 const TInt aInterval); 01063 01064 01065 protected: // non-exported! 01066 01073 CFormattedCellListBoxDataExtension* Extension(); 01074 01081 CFormattedCellListBoxDataExtension* Extension() const; 01082 01083 public: 01092 void DrawDefaultHighlight(CWindowGc &aGc, 01093 const TRect &aItemRect, 01094 TBool aHighlight) const; 01095 01104 void DrawSettingHighlight(CWindowGc &aGc, 01105 const TRect &aItemRect, 01106 TBool aHighlight) const; 01107 01116 void DrawPopupHighlight(CWindowGc &aGc, 01117 const TRect &aItemRect, 01118 TBool aHighlight) const; 01119 01125 void DrawPopupFrame(CWindowGc &aGc) const; 01126 01133 void SetWordWrappedSubcellIndices( TInt aFirstIndex, TInt aSecondIndex ); 01134 01142 IMPORT_C void SetSubCellIconSize(TInt aIndex, TSize aSize); 01143 01151 TSize GetSubCellIconSize(TInt aIndex); 01152 01159 void SetupSkinContextL(); 01160 01168 void SetESSTextColor( TAknsQsnTextColorsIndex aIndex ); 01169 01177 void SetESSHighlightedTextColor( TAknsQsnTextColorsIndex aIndex ); 01178 01186 void SetGraphicSubCellL(TInt aSubCell, const TAknWindowLineLayout& aGraphicLayout); 01187 01197 void SetTextSubCellL(TInt aSubCell,const TAknTextLineLayout& aTextLayout); 01198 01199 01211 void SetConditionalSubCellL(TInt aSubCell, 01212 const TAknTextLineLayout& aTextLayout, 01213 TInt aAffectedSubCell); 01214 01220 TBool UsesScalableLayoutData() const; 01221 01222 #start_since SINCE_3_1_SDK 01223 01227 void SetStretchableGraphicSubCellL(TInt aSubCell, 01228 const TAknWindowComponentLayout& aNormalLayout, 01229 const TAknWindowComponentLayout& aStretchedLayout); 01230 #end_since SINCE_3_1_SDK 01231 #start_since SINCE_3_1_SDK 01232 01236 void SetStretchableTextSubCellL(TInt aSubCell, 01237 const TAknTextComponentLayout& aNormalLayout, 01238 const TAknTextComponentLayout& aStretchedLayout); 01239 #end_since SINCE_3_1_SDK 01240 #start_since SINCE_3_1_SDK 01241 01245 void SetStretchableConditionalSubCellL(TInt aSubCell, 01246 const TAknTextComponentLayout& aNormalLayout, 01247 const TAknTextComponentLayout& aStretchedLayout, 01248 TInt aNormalSubCell, 01249 TInt aStretchedSubCell ); 01250 #end_since SINCE_3_1_SDK 01251 #start_since SINCE_3_1_SDK 01252 01256 void ResetSLSubCellArray(); 01257 #end_since SINCE_3_1_SDK 01258 01259 #start_since SINCE_3_1_SDK 01260 01264 void EnableStretching(const TBool aEnabled); 01265 #end_since SINCE_3_1_SDK 01266 #start_since SINCE_3_1_SDK 01267 01271 TBool StretchingEnabled() const; 01272 #end_since SINCE_3_1_SDK 01273 #start_since SINCE_3_1_SDK 01274 01278 void HideSecondRow(const TBool aHide); 01279 #end_since SINCE_3_1_SDK 01280 #start_since SINCE_3_1_SDK 01281 01285 #end_since SINCE_3_1_SDK 01286 #start_since SINCE_3_1_SDK 01287 TBool SecondRowHidden() const; 01292 void SubCellsMightIntersect( const TBool aMightIntersect ); 01293 #end_since SINCE_3_1_SDK 01294 #start_since SINCE_3_1_SDK 01295 01303 void ToggleDropShadows( const TBool aEnable ); 01304 #end_since SINCE_3_1_SDK 01305 01306 private: 01307 void DoConstructL( const TAknsItemID& aAnimationIID ); 01308 01309 const TColors &Colors(TInt aItemIndex, TInt aSubCell) const; 01310 TInt LastSubCell() const; 01311 void AddSubCellL(TInt aSubCell); 01312 SSubCell& At(TInt aArrayIndex); 01313 const SSubCell& At(TInt aArrayIndex) const; 01314 TInt FindSubCellIndex(TInt& aArrayIndex,TInt aSubCell) const; 01315 void FindSubCellIndexOrAddL(TInt& aArrayIndex,TInt aSubCell); 01316 TInt AddActualFontL(const CFont* aBaseFont); 01317 void SetUnderlineStyle( TListItemProperties aProperties, CWindowGc& aGc, TInt aSubCell ) const; 01318 void CheckIfSubCellsIntersect( TAknTextLineLayout* aLayouts, TBool* aResults, const TDesC& aText, const TRect& aItemRect ) const; 01319 01320 private: 01321 CArrayFix<SSubCell>* iSubCellArray; 01322 CArrayPtr<CGulIcon>* iIconArray; 01323 friend class CFormattedCellListBoxItemDrawer; // this is for "lastsubcell" -access. 01324 TColors defaultcolors; 01325 CFormattedCellListBoxDataExtension *iExtension; 01326 }; 01327 01328 // CLASS DECLARATION 01336 class CSettingItemEditingListBoxData : public CFormattedCellListBoxData 01337 { 01338 public: 01339 IMPORT_C static CSettingItemEditingListBoxData* NewL(); 01340 IMPORT_C virtual void Draw(TListItemProperties aProperties, 01341 CWindowGc& aGc, 01342 const TDesC* aText, 01343 const TRect& aRect, 01344 TBool aHighlight, 01345 const TColors& aColors) const; 01346 }; 01347 01348 // CLASS DECLARATION 01356 class CFormGraphicListBoxData : public CFormattedCellListBoxData 01357 { 01358 public: 01359 IMPORT_C static CFormGraphicListBoxData* NewL(); 01360 IMPORT_C virtual void Draw(TListItemProperties aProperties, 01361 CWindowGc& aGc, 01362 const TDesC* aText, 01363 const TRect& aRect, 01364 TBool aHighlight, 01365 const TColors& aColors) const; 01366 }; 01367 01368 01369 // CLASS DECLARATION 01377 class CPopupFormattedListBoxData : public CFormattedCellListBoxData 01378 { 01379 public: 01380 IMPORT_C static CPopupFormattedListBoxData* NewL(); 01381 IMPORT_C virtual void Draw(TListItemProperties aProperties, 01382 CWindowGc& aGc, 01383 const TDesC* aText, 01384 const TRect& aRect, 01385 TBool aHighlight, 01386 const TColors& aColors) const; 01387 }; 01388 01395 class CFormattedCellGridData : public CFormattedCellListBoxData 01396 { 01397 01398 public: 01399 01403 IMPORT_C static CFormattedCellGridData* NewL(); 01404 01418 IMPORT_C virtual void Draw(TListItemProperties aProperties, 01419 CWindowGc& aGc, 01420 const TDesC* aText, 01421 const TRect& aRect, 01422 TBool aHighlight, 01423 const TColors& aColors) const; 01424 }; 01425 01426 // __EIKFRLBD_H__ 01427 #endif 01428