EIKLBI.H

Go to the documentation of this file.
00001 // EIKLBI.H
00002 //
00003 // Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
00004 //
00005 
00006 
00007 
00008 #if !defined(__EIKLBI_H__)
00009 #define __EIKLBI_H__  
00010 
00011 #include <e32base.h>
00012 #include <gdi.h>
00013 
00014 
00015 class CWindowGc;
00016 class CListBoxData;
00017 class TListItemProperties;
00018 class TListFontBoundValues;
00019 class MAknsControlContext;
00020 
00021 
00029 class CListItemDrawer : public CBase
00030     {
00031 
00032 public:
00033 
00037     IMPORT_C ~CListItemDrawer();
00038 
00055     IMPORT_C virtual void DrawItem(TInt aItemIndex, 
00056                                    TPoint aItemRectPos, 
00057                                    TBool aItemIsSelected, 
00058                                    TBool aItemIsCurrent, 
00059                                    TBool aViewIsEmphasized, 
00060                                    TBool aViewIsDimmed) const;
00061 
00067     IMPORT_C virtual void ClearRect(const TRect& aRect) const;
00068 
00075     IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
00076 
00083     IMPORT_C virtual TSize MinimumCellSize() const;
00084 
00090     IMPORT_C virtual void SetGc(CWindowGc* aGc);
00091 
00097     IMPORT_C CWindowGc* Gc() const;
00098 
00104     IMPORT_C virtual void SetMarkColumnWidth(TInt aWidthInPixels);
00105 
00112     IMPORT_C virtual void SetMarkGutter(TInt aGapInPixels);
00113 
00119     IMPORT_C TInt MarkColumn() const;
00120 
00127     IMPORT_C TInt MarkGutter() const;
00128 
00136     IMPORT_C virtual void SetItemCellSize(const TSize& aSizeInPixels);
00137 
00144     IMPORT_C TSize ItemCellSize() const;
00145 
00153     IMPORT_C virtual void SetViewRect(const TRect& aRect);
00154 
00164     IMPORT_C void SetDrawMark(TBool aDrawMark);
00165 
00178     IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, 
00179                                              TInt aCharPos, 
00180                                              TInt aItemCellYPos, 
00181                                              TInt aCurrentItemIndex ) const;
00182 
00193     IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
00194 
00198     IMPORT_C virtual void DrawItemMark(TBool aItemIsSelected, 
00199                                        TBool aViewIsDimmed, 
00200                                        const TPoint& aMarkPos) const;
00201 
00208     IMPORT_C void SetSymbolFont(const CFont* aFont);
00209 
00216     IMPORT_C void SetVerticalInterItemGap(TInt aGapInPixels);
00217 
00224     IMPORT_C void SetData(CListBoxData* aData);
00225 
00234     IMPORT_C CFont* Font(TInt aItemIndex) const;
00235 
00243     IMPORT_C virtual TListItemProperties Properties(TInt aItemIndex) const;
00244 
00255     IMPORT_C void DrawFrame(CWindowGc& aGc,
00256                             const TRect& aRect,
00257                             TInt aFlags) const;
00258 
00259 public:
00260 
00265     enum TFlags
00266         {
00275         EDrawMarkSelection          = 0x0001,
00276         
00281         EPaintedSelection           = 0x0002,
00282         
00284         EDrawOnlyActiveSelection    = 0x0004,
00285         
00287         EDisableHighlight = 0x0008,
00288 
00294         EPressedDownState = 0x0010,
00295 
00300         EDisableMarquee = 0x0020
00301         };
00302 
00303 public:
00304 
00308     enum TListItemAttribute
00309 
00310         {
00312         ECurrent    = 0x0001,       // may be drawn with a frame
00313 
00320         EEmphasized = 0x0002,       // special highlight (not selected)
00321         
00328         ESelected   = 0x0004,       // usually different than emphasized
00329         
00335         EMask       = 0x0007 // sum of all others attributes
00336 
00337         };
00338 
00339 public:
00340 
00346     inline void SetTextColor(TRgb aColor);
00347 
00353     inline void SetBackColor(TRgb aColor);
00354 
00360     inline void SetHighlightedTextColor(TRgb aColor);
00361 
00367     inline void SetHighlightedBackColor(TRgb aColor);
00368 
00374     inline void SetDimmedTextColor(TRgb aColor);
00375 
00381     inline void SetDimmedBackColor(TRgb aColor);
00382 
00388     inline TRgb TextColor() const;
00389 
00395     inline TRgb BackColor() const;
00396 
00402     inline TRgb HighlightedTextColor() const;
00403 
00409     inline TRgb HighlightedBackColor() const;
00410 
00416     inline TRgb DimmedTextColor() const;
00417 
00423     inline TRgb DimmedBackColor() const;
00424 
00430     inline TInt Flags() const;
00431 
00437     IMPORT_C void SetFlags(TInt aFlags);
00438 
00444     IMPORT_C void ClearFlags(TInt aFlags);
00445 
00452     IMPORT_C MAknsControlContext  *SkinBackgroundControlContext() const;
00461     IMPORT_C void SetSkinEnabledL(TBool aEnabled);
00462 
00463 protected:
00464 
00468     IMPORT_C CListItemDrawer();
00469 
00484     virtual void DrawActualItem(TInt aItemIndex, 
00485                                 const TRect& aActualItemRect, 
00486                                 TBool aItemIsCurrent, 
00487                                 TBool aViewIsEmphasized, 
00488                                 TBool aViewIsDimmed, 
00489                                 TBool aItemIsSelected) const = 0;
00490 
00497     IMPORT_C virtual void ResetGc() const;
00498 
00506     inline TRgb MarkColor() const;
00507 
00513     IMPORT_C TInt VerticalInterItemGap() const;
00514     
00521     IMPORT_C void SetupGc(TInt aItemIndex) const;
00522 
00523 private:
00524 
00525     IMPORT_C virtual TAny* Reserved_1();
00526 
00527     inline TInt& VerticalInterItemGap();
00528 
00529     inline const CFont* SymbolFont() const;
00530 
00531     inline const CFont*& SymbolFont();
00532 
00533 protected:
00534     
00536     TSize iItemCellSize;
00537 
00539     TInt iMarkGutter;
00540 
00542     TInt iMarkColumnWidth;
00543 
00545     TRect iViewRect;
00546 
00548     TBool iDrawMark;
00549 
00551     CWindowGc* iGc;
00552 
00554     TRgb iTextColor;
00555     
00557     TRgb iBackColor;
00558 
00560     TRgb iHighlightedTextColor; 
00561 
00563     TRgb iHighlightedBackColor;
00564 
00566     TRgb iDimmedTextColor;
00567 
00569     TRgb iDimmedBackColor;
00570 
00572     TRgb iMarkColor;
00573 
00575     CListBoxData* iData;
00576 
00577 private:
00578 
00579     const CFont* iSymbolFont;
00580 
00581     TInt iVerticalInterItemGap;
00582 
00583     TInt iSpare;
00584 
00585     TUint iFlags;
00586 
00587     };
00588 
00589 
00590 
00591 
00592 class MTextListBoxModel;
00593 
00594 
00601 class CTextListItemDrawer : public CListItemDrawer
00602     {
00603 
00604 public:
00605 
00609     IMPORT_C CTextListItemDrawer();
00610     
00614     IMPORT_C ~CTextListItemDrawer();
00615 
00625     IMPORT_C CTextListItemDrawer(MTextListBoxModel* aTextListBoxModel, 
00626                                  const CFont* aFont);
00627 
00633     IMPORT_C void ConstructL(const CFont* aFont);
00634 
00646     IMPORT_C virtual void DrawActualItem(TInt aItemIndex, 
00647                                          const TRect& aActualItemRect, 
00648                                          TBool aItemIsCurrent, 
00649                                          TBool aViewIsEmphasized, 
00650                                          TBool aViewIsDimmed,
00651                                          TBool aItemIsSelected) const;
00652 
00659     IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
00660 
00667     IMPORT_C virtual TSize MinimumCellSize() const;
00668 
00674     IMPORT_C virtual void SetGc(CWindowGc* aGc);
00675 
00683     IMPORT_C void SetCellWidthInChars(TInt aNumOfCharsToDisplayInCell);
00684 
00695     IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, 
00696                                              TInt aCharPos, 
00697                                              TInt aItemCellYPos, 
00698                                              TInt aCurrentItemIndex ) const;
00699 
00711     IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
00712 
00718     IMPORT_C void SetFont(const CFont* aFont);
00719 
00725     IMPORT_C void SetSearchStringL(const TDesC* aSearchString);
00726 
00733     IMPORT_C const CFont* Font(TInt aIndex) const;
00734 
00735     // SAPLAF new methods.
00736 
00737 
00743     inline void SetItemMarkPosition(TInt aPos);
00744 
00750     inline TInt ItemMarkPosition() const;
00751 
00757     inline void SetItemMarkReplacement(const TDesC &aReplacement);
00758 
00764     inline TPtrC ItemMarkReplacement() const;
00765 
00772     inline void SetItemMarkReverse(TBool aReverse);
00773 
00780     inline TBool ItemMarkReverse() const;
00781 
00782 
00783 protected:
00784 
00798     IMPORT_C virtual void DoDrawItemText(const TDesC& aDes, 
00799                                          const TRect& aItemTextRect, 
00800                                          TBool aItemIsCurrent, 
00801                                          TBool aViewIsEmphasized, 
00802                                          TBool aItemIsSelected, 
00803                                          TInt aItemIndex) const;
00804 
00816     IMPORT_C virtual void DrawItemText(TInt aItemIndex, 
00817                                        const TRect& aItemTextRect, 
00818                                        TBool aItemIsCurrent, 
00819                                        TBool aViewIsEmphasized, 
00820                                        TBool aItemIsSelected) const;
00821 
00827     IMPORT_C virtual void ResetGc() const;
00828 
00829 private:
00830 
00831     IMPORT_C virtual TAny* Reserved_1();
00832 
00833 protected:
00834 
00836     MTextListBoxModel* iModel;
00837 
00839     const CFont* iFont;
00840 
00841 private:
00842     
00843     TInt iNumOfCharsInCell;
00844 
00845     // AVKON LAF 
00846 
00847     TInt iItemMarkPos;
00848 
00849     TPtrC iItemMarkReplacement;
00850 
00851     TBool iItemMarkReverse;
00852 
00853     // AVKON LAF ENDS 
00854 
00855     };
00856 
00857 
00858 
00859 
00868 class TListItemProperties
00869 
00870     {
00871 
00872 public:
00873 
00877     IMPORT_C TListItemProperties();
00878 
00879 public:
00880 
00888     inline void SetBold(TBool aBold);
00889 
00897     inline TBool IsBold() const;
00898 
00906     inline void SetItalics(TBool aItalics);
00907 
00915     inline TBool IsItalics() const;
00916 
00923     inline void SetUnderlined(TBool aUnderlined);
00924 
00931     inline TBool IsUnderlined() const;
00932 
00941     inline void SetDimmed(TBool aDimmed);
00942 
00952     inline TBool IsDimmed() const;
00953 
00959     inline void SetColor(TRgb aColor);
00960 
00966     inline TRgb Color() const;
00967 
00976     inline void SetSeparatorAfter(TBool aSeparator);
00977 
00985     inline TBool IsSeparatorAfter() const;
00986 
00993     inline void SetHiddenSelection(TBool aHidden);
00994 
01000     inline TBool IsSelectionHidden() const;
01001 
01002 private:
01003 
01004     TUint iFlags;
01005 
01006     TRgb iColor;
01007 
01008 private:
01009 
01010     enum
01011 
01012         {
01013 
01014         ELbxItemBold        = 0x0001,
01015 
01016         ELbxItemItalics     = 0x0002,
01017 
01018         ELbxItemUnderlined  = 0x0004,
01019 
01020     ELbxItemDimmed      = 0x0008,
01021 
01022     ELbxItemSeparatorAfter  = 0x0010,
01023     
01024     ELbxItemSelectionHidden = 0x0020
01025     
01026         };
01027 
01028     };
01029 
01030 
01031 
01032 //
01033 
01034 // Inlines
01035 
01036 //
01037 
01038 
01039 
01040 inline void CListItemDrawer::SetTextColor(TRgb aColor)
01041 
01042     {iTextColor=aColor;}
01043 
01044 inline void CListItemDrawer::SetBackColor(TRgb aColor)
01045 
01046     {iBackColor=aColor;}
01047 
01048 inline void CListItemDrawer::SetHighlightedTextColor(TRgb aColor)
01049 
01050     {iHighlightedTextColor=aColor;}
01051 
01052 inline void CListItemDrawer::SetHighlightedBackColor(TRgb aColor)
01053 
01054     {iHighlightedBackColor=aColor;}
01055 
01056 inline void CListItemDrawer::SetDimmedTextColor(TRgb aColor)
01057 
01058     {iDimmedTextColor=aColor;}
01059 
01060 inline void CListItemDrawer::SetDimmedBackColor(TRgb aColor)
01061 
01062     {iDimmedBackColor=aColor;}
01063 
01064 inline TRgb CListItemDrawer::TextColor() const
01065 
01066     {return iTextColor;}
01067 
01068 inline TRgb CListItemDrawer::BackColor() const
01069 
01070     {return iBackColor;}
01071 
01072 inline TRgb CListItemDrawer::HighlightedTextColor() const
01073 
01074     {return iHighlightedTextColor;}
01075 
01076 inline TRgb CListItemDrawer::HighlightedBackColor() const
01077 
01078     {return iHighlightedBackColor;}
01079 
01080 inline TRgb CListItemDrawer::DimmedTextColor() const
01081 
01082     {return iDimmedTextColor;}
01083 
01084 inline TRgb CListItemDrawer::DimmedBackColor() const
01085 
01086     {return iDimmedBackColor;}
01087 
01088 inline TRgb CListItemDrawer::MarkColor() const
01089 
01090     {return iMarkColor;}
01091 
01092 inline TInt CListItemDrawer::Flags() const
01093 
01094     {return iFlags;}
01095 
01096 
01097 
01098 inline TBool TListItemProperties::IsItalics() const
01099 
01100     {return iFlags&ELbxItemItalics;}
01101 
01102 inline TBool TListItemProperties::IsBold() const
01103 
01104     {return iFlags&ELbxItemBold;}
01105 
01106 inline TBool TListItemProperties::IsUnderlined() const
01107 
01108     {return iFlags&ELbxItemUnderlined;}
01109 
01110 inline TBool TListItemProperties::IsDimmed() const
01111 
01112     {return iFlags&ELbxItemDimmed;}
01113 
01114 inline TBool TListItemProperties::IsSeparatorAfter() const
01115 
01116     {return iFlags&ELbxItemSeparatorAfter;}
01117 
01118 inline TBool TListItemProperties::IsSelectionHidden() const
01119 
01120     {return iFlags&ELbxItemSelectionHidden;}
01121 
01122 
01123 
01124 inline void TListItemProperties::SetColor(TRgb aColor)
01125 
01126     {iColor=aColor;}
01127 
01128 inline TRgb TListItemProperties::Color() const
01129 
01130     {return iColor;}
01131 
01132 inline void TListItemProperties::SetBold(TBool aBold)
01133 
01134     {
01135 
01136     if (aBold) 
01137 
01138         iFlags|=ELbxItemBold;
01139 
01140     else
01141 
01142         iFlags&=(~ELbxItemBold);
01143 
01144     }
01145 
01146 inline void TListItemProperties::SetItalics(TBool aItalics)
01147 
01148     {
01149 
01150     if (aItalics)
01151 
01152         iFlags|=ELbxItemItalics;
01153 
01154     else
01155 
01156         iFlags&=(~ELbxItemItalics);
01157 
01158     }
01159 
01160 inline void TListItemProperties::SetUnderlined(TBool aUnderlined)
01161 
01162     {
01163 
01164     if (aUnderlined)
01165 
01166         iFlags|=ELbxItemUnderlined;
01167 
01168     else
01169 
01170         iFlags&=(~ELbxItemUnderlined);
01171 
01172     }
01173 
01174 inline void TListItemProperties::SetDimmed(TBool aDimmed)
01175 
01176     {
01177 
01178     if (aDimmed)
01179 
01180         iFlags|=ELbxItemDimmed;
01181 
01182     else
01183 
01184         iFlags&=(~ELbxItemDimmed);
01185 
01186     }
01187 
01188 
01189 
01190 inline void TListItemProperties::SetSeparatorAfter(TBool aSeparator)
01191 
01192     {
01193 
01194     if (aSeparator) 
01195 
01196         iFlags|=ELbxItemSeparatorAfter;
01197 
01198     else
01199 
01200         iFlags&=(~ELbxItemSeparatorAfter);
01201 
01202     }
01203 
01204 
01205 inline void TListItemProperties::SetHiddenSelection(TBool aBlocked)
01206 
01207     {
01208 
01209     if (aBlocked) 
01210 
01211         iFlags|=ELbxItemSelectionHidden;
01212 
01213     else
01214 
01215         iFlags&=(~ELbxItemSelectionHidden);
01216 
01217     }
01218 
01219 
01220 
01221 
01222  
01223 
01224 // AVKON LAF 
01225 
01226 inline void CTextListItemDrawer::SetItemMarkPosition(TInt aPos) { iItemMarkPos = aPos; }
01227 
01228 inline TInt CTextListItemDrawer::ItemMarkPosition() const { return iItemMarkPos; }
01229 
01230 inline void CTextListItemDrawer::SetItemMarkReplacement(const TDesC & aReplacement) { iItemMarkReplacement.Set(aReplacement); }
01231 
01232 inline TPtrC CTextListItemDrawer::ItemMarkReplacement() const { return iItemMarkReplacement; }
01233 
01234 inline void CTextListItemDrawer::SetItemMarkReverse(TBool aReverse) { iItemMarkReverse = aReverse; }
01235 inline TBool CTextListItemDrawer::ItemMarkReverse() const { return iItemMarkReverse; }
01236 
01237 // END OF AVKON LAF 
01238 
01239 
01240 
01241 #endif  // __EIKLBI_H__
01242 
01243 // End of File

Copyright © Nokia Corporation 2001-2007
Back to top