00001
00002
00003
00004
00005
00006
00007 #if !defined(__EIKLBV_H__)
00008 #define __EIKLBV_H__
00009
00010 #if !defined(__E32BASE_H__)
00011 #include <e32base.h>
00012 #endif
00013
00014 #if !defined(__GDI_H__)
00015 #include <gdi.h>
00016 #endif
00017
00018 class CListItemDrawer;
00019 class MListBoxModel;
00020 class CWindowGc;
00021 class RWindowGroup;
00022 class CWsScreenDevice;
00023 class CWindowGc;
00024 class RWindow;
00025
00026
00027
00028
00029
00030 class MListVisibilityObserver
00031 {
00032 public:
00033 virtual TBool IsVisible() const = 0;
00034 };
00035
00056 class CListBoxView : public CBase
00057 {
00058 public:
00059
00064 enum TCursorMovement
00065 {
00067 ECursorNextItem,
00068
00070 ECursorPreviousItem,
00071
00073 ECursorNextColumn,
00074
00076 ECursorPreviousColumn,
00077
00079 ECursorPreviousPage,
00080
00082 ECursorNextPage,
00083
00085 ECursorFirstItem,
00086
00088 ECursorLastItem,
00089
00091 ECursorNextScreen,
00092
00094 ECursorPrevScreen
00095 };
00096
00103 enum TFlags
00104 {
00106 EAnchorExists = 0x0001,
00107
00109 EEmphasized = 0x0002,
00110
00112 EDimmed = 0x0004,
00113
00115 EHasMatcherCursor = 0x0008,
00116
00118 EDisableRedraw = 0x0010,
00119
00121 EPaintedSelection = 0x0020,
00122
00124 EMarkSelection = 0x0040,
00125
00127 EUnmarkSelection = 0x0080,
00128
00130 EItemCountModified = 0x0100
00131 };
00132
00150 enum TSelectionMode
00151 {
00156 ENoSelection,
00157
00163 ESingleSelection,
00164
00170 EContiguousSelection,
00171
00177 EDisjointSelection,
00178
00183 EDisjointMarkSelection,
00184
00189 EPenMultiselection,
00190
00196 EChangeMarkMode
00197 };
00198
00200 typedef CArrayFix<TInt> CSelectionIndexArray;
00201
00202 public:
00203
00207 IMPORT_C ~CListBoxView();
00208
00215 IMPORT_C CListBoxView();
00216
00233 IMPORT_C virtual void ConstructL(MListBoxModel* aListBoxModel,
00234 CListItemDrawer* aItemDrawer,
00235 CWsScreenDevice* aScreen,
00236 RWindowGroup* aGroupWin,
00237 RWindow* aWsWindow,
00238 const TRect& aDisplayArea,
00239 TInt aItemHeight);
00240
00241
00242
00248 IMPORT_C TRect ViewRect() const;
00249
00255 IMPORT_C void SetViewRect(const TRect& aRect);
00256
00257
00263 IMPORT_C virtual TInt CurrentItemIndex() const;
00264
00273 IMPORT_C void SetCurrentItemIndex(TInt aItemIndex);
00274
00280 IMPORT_C TInt TopItemIndex() const;
00281
00290 IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex);
00291
00297 IMPORT_C TInt BottomItemIndex() const;
00298
00306 IMPORT_C virtual void CalcBottomItemIndex();
00307
00313 IMPORT_C virtual void SetItemHeight(TInt aItemHeight);
00314
00315
00322 IMPORT_C void SetMatcherCursorColor(TRgb aColor);
00323
00331 IMPORT_C void SetMatcherCursorPos(TInt aPosWithinCurrentItem);
00332
00340 IMPORT_C TInt MatcherCursorPos() const;
00341
00350 IMPORT_C virtual void DrawMatcherCursor();
00351
00357 IMPORT_C void HideMatcherCursor();
00358
00366 IMPORT_C void SetMatcherCursor(TBool aMatcherCursor);
00367
00376 IMPORT_C void SetEmphasized(TBool aEmphasized);
00377
00386 IMPORT_C void SetDimmed(TBool aDimmed);
00387
00398 IMPORT_C void SetDisableRedraw(TBool aDisableRedraw);
00399
00405 IMPORT_C TBool RedrawDisabled() const;
00406
00415 IMPORT_C void SetPaintedSelection( TBool aPaintedSelection );
00416
00417
00425 IMPORT_C const CSelectionIndexArray* SelectionIndexes() const;
00426
00437 IMPORT_C void GetSelectionIndexesL(
00438 CSelectionIndexArray* aSelectionArray) const;
00439
00448 IMPORT_C void SetSelectionIndexesL(const CSelectionIndexArray*
00449 aSelectionIndexes);
00450
00457 IMPORT_C void ClearSelection();
00458
00459
00465 IMPORT_C virtual void UpdateSelectionL(TSelectionMode aSelectionMode);
00466
00474 IMPORT_C void ToggleItemL(TInt aItemIndex);
00475
00486 IMPORT_C void SelectItemL(TInt aItemIndex);
00487
00495 IMPORT_C void DeselectItem(TInt aItemIndex);
00496
00502 IMPORT_C void SetAnchor(TInt aItemIndex);
00503
00507 IMPORT_C void ClearSelectionAnchorAndActiveIndex();
00508
00509
00517 IMPORT_C virtual TBool ScrollToMakeItemVisible(TInt aItemIndex);
00518
00524 IMPORT_C virtual void VScrollTo(TInt aNewTopItemIndex);
00525
00535 IMPORT_C virtual void VScrollTo(TInt aNewTopItemIndex,
00536 TRect& aMinRedrawRect);
00537
00544 IMPORT_C virtual void HScroll(TInt aHScrollAmount);
00545
00552 IMPORT_C TInt HScrollOffset() const;
00553
00560 IMPORT_C void SetHScrollOffset(TInt aHorizontalOffset);
00561
00567 IMPORT_C TInt DataWidth() const;
00568
00574 IMPORT_C virtual void CalcDataWidth();
00575
00584 IMPORT_C virtual TInt VisibleWidth(const TRect& aRect) const;
00585
00595 IMPORT_C virtual TInt CalcNewTopItemIndexSoItemIsVisible(
00596 TInt aItemIndex) const;
00597
00598
00610 IMPORT_C virtual void Draw(const TRect* aClipRect = NULL) const;
00611
00618 IMPORT_C virtual void DrawItem(TInt aItemIndex) const;
00619
00626 IMPORT_C void SetListEmptyTextL(const TDesC& aText);
00627
00633 inline const TDesC* EmptyListText() const;
00634
00641 IMPORT_C TBool ItemIsSelected(TInt aItemIndex) const;
00642
00649 IMPORT_C TBool ItemIsVisible(TInt aItemIndex) const;
00650
00657 IMPORT_C virtual TPoint ItemPos(TInt aItemIndex) const;
00658
00669 IMPORT_C virtual TSize ItemSize(TInt aItemIndex=0) const;
00670
00676 IMPORT_C void SetTextColor(TRgb aColor);
00677
00683 IMPORT_C void SetBackColor(TRgb aColor);
00684
00690 IMPORT_C TRgb TextColor() const;
00691
00697 IMPORT_C TRgb BackColor() const;
00698
00706 IMPORT_C virtual void MoveCursorL(TCursorMovement aCursorMovement,
00707 TSelectionMode aSelectionMode);
00708
00716 IMPORT_C virtual void VerticalMoveToItemL(TInt aTargetItemIndex,
00717 TSelectionMode aSelectionMode);
00718
00731 IMPORT_C virtual TBool XYPosToItemIndex(TPoint aPosition,
00732 TInt& aItemIndex) const;
00733
00740 IMPORT_C virtual TInt NumberOfItemsThatFitInRect(const TRect& aRect) const;
00741
00747 void SetVisibilityObserver(MListVisibilityObserver* aObserver);
00748
00755 IMPORT_C TBool IsVisible() const;
00756
00762 inline CListItemDrawer* ItemDrawer() const;
00763
00769 IMPORT_C virtual void DrawEmptyList(const TRect &aClientRect) const;
00770
00771
00772
00778 void DisableVerticalLineDrawing( TBool aDisable );
00779
00787 IMPORT_C void DeselectRangeL(TInt aItemIndex1, TInt aItemIndex2);
00788
00789 protected:
00790
00791
00799 inline TInt Flags() const;
00800
00808 inline void SetFlags(TInt aMask);
00809
00817 inline void ClearFlags(TInt aMask);
00818
00823 friend class CEikListBox;
00824
00825
00833 IMPORT_C void SelectRangeL(TInt aItemIndex1, TInt aItemIndex2);
00834
00835 protected:
00836
00841 TInt iFlags;
00842
00847 CListItemDrawer* iItemDrawer;
00848
00853 MListBoxModel* iModel;
00854
00858 TInt iDataWidth;
00859
00864 TInt iTopItemIndex;
00865
00870 TInt iBottomItemIndex;
00871
00875 TInt iHScrollOffset;
00876
00880 TInt iCurrentItemIndex;
00881
00885 TInt iItemHeight;
00886
00890 RWindow* iWin;
00891
00895 RWindowGroup* iGroupWin;
00896
00900 CWindowGc* iGc;
00901
00905 TRect iViewRect;
00906
00910 HBufC *iListEmptyText;
00911
00915 TBool iDisableVerticalLineDrawing ;
00916
00917 private:
00918 TInt iMatcherCursorPos;
00919 TRgb iMatcherCursorColor;
00920 TRgb iBackColor;
00921 TRgb iTextColor;
00922 TInt iAnchorIndex;
00923 TInt iActiveEndIndex;
00924 CSelectionIndexArray* iSelectionIndexes;
00925 MListVisibilityObserver* iVisibilityObserver;
00926
00927 TInt iSpare[6];
00928 };
00929
00933 inline const TDesC* CListBoxView::EmptyListText() const
00934 { return(iListEmptyText); }
00935
00936
00937 class CSnakingListBoxView : public CListBoxView
00938 {
00939 public:
00940 IMPORT_C ~CSnakingListBoxView();
00941 IMPORT_C CSnakingListBoxView();
00942 inline TInt ColumnWidth() const;
00943 IMPORT_C void SetColumnWidth(TInt aColumnWidth);
00944 IMPORT_C virtual void MoveCursorL(TCursorMovement aCursorMovement, TSelectionMode aSelectionMode);
00945 IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex);
00946 IMPORT_C virtual void SetItemHeight(TInt aItemHeight);
00947 IMPORT_C virtual TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
00948 IMPORT_C virtual TInt NumberOfItemsThatFitInRect(const TRect& aRect) const;
00949 IMPORT_C virtual void HScroll(TInt aHScrollAmount);
00950 IMPORT_C virtual void CalcDataWidth();
00951 IMPORT_C virtual void CalcBottomItemIndex();
00952 IMPORT_C virtual void Draw(const TRect* aClipRect = NULL) const;
00953 IMPORT_C virtual TInt VisibleWidth(const TRect& aRect) const;
00954 IMPORT_C virtual TBool ScrollToMakeItemVisible(TInt aItemIndex);
00955 IMPORT_C virtual TInt CalculateHScrollOffsetSoItemIsVisible(TInt aItemIndex);
00956 IMPORT_C virtual TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const;
00957 IMPORT_C virtual TPoint ItemPos(TInt aItemIndex) const;
00958 IMPORT_C virtual TSize ItemSize(TInt aItemIndex=0) const;
00959 IMPORT_C void CalcRowAndColIndexesFromItemIndex(TInt aItemIndex, TInt& aRowIndex, TInt& aColIndex) const;
00960 IMPORT_C void CalcItemIndexFromRowAndColIndexes(TInt& aItemIndex, TInt aRowIndex, TInt aColIndex) const;
00961 IMPORT_C virtual TInt NumberOfItemsPerColumn() const;
00962 protected:
00963 IMPORT_C virtual void DrawItemRange(TInt aStartItemIndex, TInt aEndItemIndex) const;
00964 IMPORT_C void DrawColumnRange(TInt aStartColIndex, TInt aEndColIndex) const;
00965 IMPORT_C void MoveToPreviousColumnL(TSelectionMode aSelectionMode);
00966 IMPORT_C void MoveToNextColumnL(TSelectionMode aSelectionMode);
00967 IMPORT_C void ClearUnusedItemSpace(TInt aStartItemIndex, TInt aEndItemIndex) const;
00968 IMPORT_C void UpdateHScrollOffsetBasedOnTopItemIndex();
00969 private:
00970 IMPORT_C virtual TAny* Reserved_1();
00971 protected:
00972 TInt iColumnWidth;
00973 };
00974
00975
00976
00977 inline TInt CListBoxView::Flags() const
00978 { return iFlags; }
00979
00980 inline void CListBoxView::SetFlags(TInt aMask)
00981 { iFlags|=aMask; }
00982
00983 inline void CListBoxView::ClearFlags(TInt aMask)
00984 { iFlags&=(~aMask); }
00985
00986 inline CListItemDrawer* CListBoxView::ItemDrawer() const
00987 { return iItemDrawer; }
00988
00989 inline TInt CSnakingListBoxView::ColumnWidth() const
00990 { return iColumnWidth; }
00991
00992
00993
00994 #endif