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         };
00289 
00290 public:
00291 
00295     enum TListItemAttribute
00296 
00297         {
00299         ECurrent    = 0x0001,       // may be drawn with a frame
00300 
00307         EEmphasized = 0x0002,       // special highlight (not selected)
00308         
00315         ESelected   = 0x0004,       // usually different than emphasized
00316         
00322         EMask       = 0x0007 // sum of all others attributes
00323 
00324         };
00325 
00326 public:
00327 
00333     inline void SetTextColor(TRgb aColor);
00334 
00340     inline void SetBackColor(TRgb aColor);
00341 
00347     inline void SetHighlightedTextColor(TRgb aColor);
00348 
00354     inline void SetHighlightedBackColor(TRgb aColor);
00355 
00361     inline void SetDimmedTextColor(TRgb aColor);
00362 
00368     inline void SetDimmedBackColor(TRgb aColor);
00369 
00375     inline TRgb TextColor() const;
00376 
00382     inline TRgb BackColor() const;
00383 
00389     inline TRgb HighlightedTextColor() const;
00390 
00396     inline TRgb HighlightedBackColor() const;
00397 
00403     inline TRgb DimmedTextColor() const;
00404 
00410     inline TRgb DimmedBackColor() const;
00411 
00417     inline TInt Flags() const;
00418 
00424     IMPORT_C void SetFlags(TInt aFlags);
00425 
00431     IMPORT_C void ClearFlags(TInt aFlags);
00432 
00439     IMPORT_C MAknsControlContext  *SkinBackgroundControlContext() const;
00448     IMPORT_C void SetSkinEnabledL(TBool aEnabled);
00449 
00450 protected:
00451 
00455     IMPORT_C CListItemDrawer();
00456 
00471     virtual void DrawActualItem(TInt aItemIndex, 
00472                                 const TRect& aActualItemRect, 
00473                                 TBool aItemIsCurrent, 
00474                                 TBool aViewIsEmphasized, 
00475                                 TBool aViewIsDimmed, 
00476                                 TBool aItemIsSelected) const = 0;
00477 
00484     IMPORT_C virtual void ResetGc() const;
00485 
00493     inline TRgb MarkColor() const;
00494 
00500     IMPORT_C TInt VerticalInterItemGap() const;
00501     
00508     IMPORT_C void SetupGc(TInt aItemIndex) const;
00509 
00510 private:
00511 
00512     IMPORT_C virtual TAny* Reserved_1();
00513 
00514     inline TInt& VerticalInterItemGap();
00515 
00516     inline const CFont* SymbolFont() const;
00517 
00518     inline const CFont*& SymbolFont();
00519 
00520 protected:
00521     
00523     TSize iItemCellSize;
00524 
00526     TInt iMarkGutter;
00527 
00529     TInt iMarkColumnWidth;
00530 
00532     TRect iViewRect;
00533 
00535     TBool iDrawMark;
00536 
00538     CWindowGc* iGc;
00539 
00541     TRgb iTextColor;
00542     
00544     TRgb iBackColor;
00545 
00547     TRgb iHighlightedTextColor; 
00548 
00550     TRgb iHighlightedBackColor;
00551 
00553     TRgb iDimmedTextColor;
00554 
00556     TRgb iDimmedBackColor;
00557 
00559     TRgb iMarkColor;
00560 
00562     CListBoxData* iData;
00563 
00564 private:
00565 
00566     const CFont* iSymbolFont;
00567 
00568     TInt iVerticalInterItemGap;
00569 
00570     TInt iSpare;
00571 
00572     TUint iFlags;
00573 
00574     };
00575 
00576 
00577 
00578 
00579 class MTextListBoxModel;
00580 
00581 
00588 class CTextListItemDrawer : public CListItemDrawer
00589     {
00590 
00591 public:
00592 
00596     IMPORT_C CTextListItemDrawer();
00597     
00601     IMPORT_C ~CTextListItemDrawer();
00602 
00612     IMPORT_C CTextListItemDrawer(MTextListBoxModel* aTextListBoxModel, 
00613                                  const CFont* aFont);
00614 
00620     IMPORT_C void ConstructL(const CFont* aFont);
00621 
00633     IMPORT_C virtual void DrawActualItem(TInt aItemIndex, 
00634                                          const TRect& aActualItemRect, 
00635                                          TBool aItemIsCurrent, 
00636                                          TBool aViewIsEmphasized, 
00637                                          TBool aViewIsDimmed,
00638                                          TBool aItemIsSelected) const;
00639 
00646     IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
00647 
00654     IMPORT_C virtual TSize MinimumCellSize() const;
00655 
00661     IMPORT_C virtual void SetGc(CWindowGc* aGc);
00662 
00670     IMPORT_C void SetCellWidthInChars(TInt aNumOfCharsToDisplayInCell);
00671 
00682     IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, 
00683                                              TInt aCharPos, 
00684                                              TInt aItemCellYPos, 
00685                                              TInt aCurrentItemIndex ) const;
00686 
00698     IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
00699 
00705     IMPORT_C void SetFont(const CFont* aFont);
00706 
00712     IMPORT_C void SetSearchStringL(const TDesC* aSearchString);
00713 
00720     IMPORT_C const CFont* Font(TInt aIndex) const;
00721 
00722     // SAPLAF new methods.
00723 
00724 
00730     inline void SetItemMarkPosition(TInt aPos);
00731 
00737     inline TInt ItemMarkPosition() const;
00738 
00744     inline void SetItemMarkReplacement(const TDesC &aReplacement);
00745 
00751     inline TPtrC ItemMarkReplacement() const;
00752 
00759     inline void SetItemMarkReverse(TBool aReverse);
00760 
00767     inline TBool ItemMarkReverse() const;
00768 
00769 
00770 protected:
00771 
00785     IMPORT_C virtual void DoDrawItemText(const TDesC& aDes, 
00786                                          const TRect& aItemTextRect, 
00787                                          TBool aItemIsCurrent, 
00788                                          TBool aViewIsEmphasized, 
00789                                          TBool aItemIsSelected, 
00790                                          TInt aItemIndex) const;
00791 
00803     IMPORT_C virtual void DrawItemText(TInt aItemIndex, 
00804                                        const TRect& aItemTextRect, 
00805                                        TBool aItemIsCurrent, 
00806                                        TBool aViewIsEmphasized, 
00807                                        TBool aItemIsSelected) const;
00808 
00814     IMPORT_C virtual void ResetGc() const;
00815 
00816 private:
00817 
00818     IMPORT_C virtual TAny* Reserved_1();
00819 
00820 protected:
00821 
00823     MTextListBoxModel* iModel;
00824 
00826     const CFont* iFont;
00827 
00828 private:
00829     
00830     TInt iNumOfCharsInCell;
00831 
00832     // AVKON LAF 
00833 
00834     TInt iItemMarkPos;
00835 
00836     TPtrC iItemMarkReplacement;
00837 
00838     TBool iItemMarkReverse;
00839 
00840     // AVKON LAF ENDS 
00841 
00842     };
00843 
00844 
00845 
00846 
00855 class TListItemProperties
00856 
00857     {
00858 
00859 public:
00860 
00864     IMPORT_C TListItemProperties();
00865 
00866 public:
00867 
00875     inline void SetBold(TBool aBold);
00876 
00884     inline TBool IsBold() const;
00885 
00893     inline void SetItalics(TBool aItalics);
00894 
00902     inline TBool IsItalics() const;
00903 
00910     inline void SetUnderlined(TBool aUnderlined);
00911 
00918     inline TBool IsUnderlined() const;
00919 
00928     inline void SetDimmed(TBool aDimmed);
00929 
00939     inline TBool IsDimmed() const;
00940 
00946     inline void SetColor(TRgb aColor);
00947 
00953     inline TRgb Color() const;
00954 
00963     inline void SetSeparatorAfter(TBool aSeparator);
00964 
00972     inline TBool IsSeparatorAfter() const;
00973 
00980     inline void SetHiddenSelection(TBool aHidden);
00981 
00987     inline TBool IsSelectionHidden() const;
00988 
00989 private:
00990 
00991     TUint iFlags;
00992 
00993     TRgb iColor;
00994 
00995 private:
00996 
00997     enum
00998 
00999         {
01000 
01001         ELbxItemBold        = 0x0001,
01002 
01003         ELbxItemItalics     = 0x0002,
01004 
01005         ELbxItemUnderlined  = 0x0004,
01006 
01007     ELbxItemDimmed      = 0x0008,
01008 
01009     ELbxItemSeparatorAfter  = 0x0010,
01010     
01011     ELbxItemSelectionHidden = 0x0020
01012     
01013         };
01014 
01015     };
01016 
01017 
01018 
01019 //
01020 
01021 // Inlines
01022 
01023 //
01024 
01025 
01026 
01027 inline void CListItemDrawer::SetTextColor(TRgb aColor)
01028 
01029     {iTextColor=aColor;}
01030 
01031 inline void CListItemDrawer::SetBackColor(TRgb aColor)
01032 
01033     {iBackColor=aColor;}
01034 
01035 inline void CListItemDrawer::SetHighlightedTextColor(TRgb aColor)
01036 
01037     {iHighlightedTextColor=aColor;}
01038 
01039 inline void CListItemDrawer::SetHighlightedBackColor(TRgb aColor)
01040 
01041     {iHighlightedBackColor=aColor;}
01042 
01043 inline void CListItemDrawer::SetDimmedTextColor(TRgb aColor)
01044 
01045     {iDimmedTextColor=aColor;}
01046 
01047 inline void CListItemDrawer::SetDimmedBackColor(TRgb aColor)
01048 
01049     {iDimmedBackColor=aColor;}
01050 
01051 inline TRgb CListItemDrawer::TextColor() const
01052 
01053     {return iTextColor;}
01054 
01055 inline TRgb CListItemDrawer::BackColor() const
01056 
01057     {return iBackColor;}
01058 
01059 inline TRgb CListItemDrawer::HighlightedTextColor() const
01060 
01061     {return iHighlightedTextColor;}
01062 
01063 inline TRgb CListItemDrawer::HighlightedBackColor() const
01064 
01065     {return iHighlightedBackColor;}
01066 
01067 inline TRgb CListItemDrawer::DimmedTextColor() const
01068 
01069     {return iDimmedTextColor;}
01070 
01071 inline TRgb CListItemDrawer::DimmedBackColor() const
01072 
01073     {return iDimmedBackColor;}
01074 
01075 inline TRgb CListItemDrawer::MarkColor() const
01076 
01077     {return iMarkColor;}
01078 
01079 inline TInt CListItemDrawer::Flags() const
01080 
01081     {return iFlags;}
01082 
01083 
01084 
01085 inline TBool TListItemProperties::IsItalics() const
01086 
01087     {return iFlags&ELbxItemItalics;}
01088 
01089 inline TBool TListItemProperties::IsBold() const
01090 
01091     {return iFlags&ELbxItemBold;}
01092 
01093 inline TBool TListItemProperties::IsUnderlined() const
01094 
01095     {return iFlags&ELbxItemUnderlined;}
01096 
01097 inline TBool TListItemProperties::IsDimmed() const
01098 
01099     {return iFlags&ELbxItemDimmed;}
01100 
01101 inline TBool TListItemProperties::IsSeparatorAfter() const
01102 
01103     {return iFlags&ELbxItemSeparatorAfter;}
01104 
01105 inline TBool TListItemProperties::IsSelectionHidden() const
01106 
01107     {return iFlags&ELbxItemSelectionHidden;}
01108 
01109 
01110 
01111 inline void TListItemProperties::SetColor(TRgb aColor)
01112 
01113     {iColor=aColor;}
01114 
01115 inline TRgb TListItemProperties::Color() const
01116 
01117     {return iColor;}
01118 
01119 inline void TListItemProperties::SetBold(TBool aBold)
01120 
01121     {
01122 
01123     if (aBold) 
01124 
01125         iFlags|=ELbxItemBold;
01126 
01127     else
01128 
01129         iFlags&=(~ELbxItemBold);
01130 
01131     }
01132 
01133 inline void TListItemProperties::SetItalics(TBool aItalics)
01134 
01135     {
01136 
01137     if (aItalics)
01138 
01139         iFlags|=ELbxItemItalics;
01140 
01141     else
01142 
01143         iFlags&=(~ELbxItemItalics);
01144 
01145     }
01146 
01147 inline void TListItemProperties::SetUnderlined(TBool aUnderlined)
01148 
01149     {
01150 
01151     if (aUnderlined)
01152 
01153         iFlags|=ELbxItemUnderlined;
01154 
01155     else
01156 
01157         iFlags&=(~ELbxItemUnderlined);
01158 
01159     }
01160 
01161 inline void TListItemProperties::SetDimmed(TBool aDimmed)
01162 
01163     {
01164 
01165     if (aDimmed)
01166 
01167         iFlags|=ELbxItemDimmed;
01168 
01169     else
01170 
01171         iFlags&=(~ELbxItemDimmed);
01172 
01173     }
01174 
01175 
01176 
01177 inline void TListItemProperties::SetSeparatorAfter(TBool aSeparator)
01178 
01179     {
01180 
01181     if (aSeparator) 
01182 
01183         iFlags|=ELbxItemSeparatorAfter;
01184 
01185     else
01186 
01187         iFlags&=(~ELbxItemSeparatorAfter);
01188 
01189     }
01190 
01191 
01192 inline void TListItemProperties::SetHiddenSelection(TBool aBlocked)
01193 
01194     {
01195 
01196     if (aBlocked) 
01197 
01198         iFlags|=ELbxItemSelectionHidden;
01199 
01200     else
01201 
01202         iFlags&=(~ELbxItemSelectionHidden);
01203 
01204     }
01205 
01206 
01207 
01208 
01209  
01210 
01211 // AVKON LAF 
01212 
01213 inline void CTextListItemDrawer::SetItemMarkPosition(TInt aPos) { iItemMarkPos = aPos; }
01214 
01215 inline TInt CTextListItemDrawer::ItemMarkPosition() const { return iItemMarkPos; }
01216 
01217 inline void CTextListItemDrawer::SetItemMarkReplacement(const TDesC & aReplacement) { iItemMarkReplacement.Set(aReplacement); }
01218 
01219 inline TPtrC CTextListItemDrawer::ItemMarkReplacement() const { return iItemMarkReplacement; }
01220 
01221 inline void CTextListItemDrawer::SetItemMarkReverse(TBool aReverse) { iItemMarkReverse = aReverse; }
01222 inline TBool CTextListItemDrawer::ItemMarkReverse() const { return iItemMarkReverse; }
01223 
01224 // END OF AVKON LAF 
01225 
01226 
01227 
01228 // __EIKLBI_H__
01229 #endif
01230 
01231 // End of File

Copyright © Nokia Corporation 2001-2008
Back to top