00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __EIKLBX_H__
00021 #define __EIKLBX_H__
00022
00023
00024 #include <gdi.h>
00025 #include <eikbctrl.h>
00026 #include <eiklbo.h>
00027 #include <eiksbfrm.h>
00028 #include <eiklbm.h>
00029 #include <eiklbv.h>
00030 #include <gulbordr.h>
00031 #include <eiklbed.h>
00032 #include <gulutil.h>
00033 #include <lafpublc.h>
00034
00035
00036 enum TKeyCode;
00037 class RIncrMatcherBase;
00038 class CListItemDrawer;
00039 class CEikScrollBarFrame;
00040 class CEikButtonBase;
00041 class CMatchBuffer;
00042 class CListBoxExt;
00043 class CEikListBox;
00044
00045
00046
00055 class MListBoxItemChangeObserver
00056 {
00057 public:
00063 virtual void ListBoxItemsChanged(CEikListBox* aListBox) = 0;
00064 };
00065
00066
00075 class MListBoxSelectionObserver
00076 {
00077 public:
00085 virtual void SelectionModeChanged(CEikListBox* aListBox, TBool aSelectionModeEnabled) = 0;
00086 };
00087
00088
00089
00090
00110 class CEikListBox : public CEikBorderedControl, public MEikScrollBarObserver
00111 {
00112
00113 public:
00114
00115 friend class CListBoxExt;
00116
00117 public:
00118
00122 enum TFlags
00123 {
00124
00129 EMultipleSelection = SLafListBox::EMultipleSelection,
00130
00136 ENoExtendedSelection = SLafListBox::ENoExtendedSelection,
00137
00142 EIncrementalMatching = SLafListBox::EIncrementalMatching,
00143
00148 EPopout = SLafListBox::EPopout,
00149
00154 ELeftDownInViewRect = SLafListBox::ELeftDownInViewRect,
00155
00160 EItemDoubleClicked = SLafListBox::EItemDoubleClicked,
00161
00167 EKeepModel = SLafListBox::EKeepModel,
00168
00174 EScrollBarSizeExcluded = SLafListBox::EScrollBarSizeExcluded,
00175
00179 EStateChanged = SLafListBox::EStateChanged,
00180
00185 ECreateOwnWindow = SLafListBox::ECreateOwnWindow,
00186
00190 ENoFirstLetterMatching = SLafListBox::ENoFirstLetterMatching,
00191
00195 EPaintedSelection = SLafListBox::EPaintedSelection ,
00196
00201 ELoopScrolling = 0x1000,
00202
00206 EEnterMarks = 0x2000,
00207
00212 EShiftEnterMarks = 0x4000,
00213
00218 EViewerFlag = 0x8000,
00219
00224 EPageAtOnceScrolling = 0x8000,
00225
00229 EDisableHighlight = 0x8000,
00230
00235 ES60StyleMultiselection = SLafListBox::ES60StyleMultiselection,
00236
00240 ES60StyleMarkable = SLafListBox::ES60StyleMarkable
00241 };
00242 enum {KEikMaxMatchingBufferLength = 2};
00243
00247 enum TScrollBarOwnerShip
00248 {
00252 ENotOwnedExternally=0x0000,
00256 EOwnedExternally =0x0001
00257 };
00258
00259 protected:
00260
00264 enum TReasonForFocusLost
00265 {
00269 EFocusLostToExternalControl,
00273 EFocusLostToInternalEditor
00274 };
00275
00276 public:
00280 IMPORT_C ~CEikListBox();
00281
00285 IMPORT_C CEikListBox();
00298 IMPORT_C void ConstructL(MListBoxModel* aListBoxModel,
00299 CListItemDrawer* aListItemDrawer,
00300 const CCoeControl* aParent,
00301 TInt aFlags = 0);
00302
00318 IMPORT_C void ConstructL(MListBoxModel* aListBoxModel,
00319 CListItemDrawer* aListItemDrawer,
00320 const CCoeControl* aParent,
00321 TGulBorder aBorder,
00322 TInt aFlags = 0);
00332 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
00333 TEventCode aType);
00334
00341 IMPORT_C virtual void HandlePointerEventL(
00342 const TPointerEvent& aPointerEvent);
00343
00350 IMPORT_C virtual void SetContainerWindowL(const CCoeControl& aContainer);
00351
00357 IMPORT_C virtual TSize MinimumSize();
00358
00365 IMPORT_C virtual void SetDimmed(TBool aDimmed);
00366
00373 IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar,
00374 TEikScrollEvent aEventType);
00375
00376
00382 IMPORT_C MListBoxModel* Model() const;
00383
00389 IMPORT_C CListBoxView* View() const;
00390
00391
00397 IMPORT_C TInt TopItemIndex() const;
00398
00404 IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const;
00405
00411 IMPORT_C TInt BottomItemIndex() const;
00412
00418 IMPORT_C TInt CurrentItemIndex() const;
00419
00427 IMPORT_C void SetCurrentItemIndex(TInt aItemIndex) const;
00428
00435 IMPORT_C void SetCurrentItemIndexAndDraw(TInt aItemIndex) const;
00436
00437
00443 IMPORT_C const CListBoxView::CSelectionIndexArray* SelectionIndexes() const;
00444
00451 IMPORT_C void SetSelectionIndexesL(
00452 CListBoxView::CSelectionIndexArray* aArrayOfSelectionIndexes);
00453
00457 IMPORT_C void ClearSelection();
00458
00459
00460
00461
00465 IMPORT_C void HandleItemAdditionL();
00466
00470 IMPORT_C void HandleItemRemovalL();
00471
00481 IMPORT_C void HandleItemAdditionL(
00482 CArrayFix<TInt> &aArrayOfNewIndexesAfterAddition);
00483
00493 IMPORT_C void HandleItemRemovalL(
00494 CArrayFix<TInt> &aArrayOfOldIndexesBeforeRemoval);
00495
00499 IMPORT_C void Reset();
00500
00508 IMPORT_C void AddItemChangeObserverL( MListBoxItemChangeObserver* aObserver );
00517 IMPORT_C TBool RemoveItemChangeObserver( MListBoxItemChangeObserver* aObserver );
00518
00519
00525 IMPORT_C virtual void SetItemHeightL(TInt aHeight);
00526
00532 IMPORT_C TInt ItemHeight() const;
00533
00534
00542 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc=EFalse);
00543
00551 IMPORT_C void SetScrollBarFrame(CEikScrollBarFrame* aScrollBarFrame, TScrollBarOwnerShip aOwnerShip);
00552
00558 IMPORT_C CEikScrollBarFrame* const ScrollBarFrame();
00559
00563 IMPORT_C virtual void UpdateScrollBarsL();
00564
00565
00575 IMPORT_C void CalculatePopoutRect( TInt aTargetItemIndex,
00576 TInt aTargetYPos,
00577 TRect& aListBoxRect,
00578 TInt aMinHeightInNumOfItems = 1 );
00592 IMPORT_C TSize CalcSizeInPixels(TInt aWidthAsNumOfChars,
00593 TInt aHeightAsNumOfItems) const;
00594
00605 IMPORT_C TInt CalcWidthBasedOnNumOfChars(TInt aNumOfChars) const;
00606
00616 IMPORT_C TInt CalcHeightBasedOnNumOfItems(TInt aNumOfItems) const;
00617
00629 IMPORT_C TInt CalcWidthBasedOnRequiredItemWidth(
00630 TInt aTextWidthInPixels) const;
00631
00632
00640 IMPORT_C void DrawItem(TInt aItemIndex) const;
00641
00647 IMPORT_C void ScrollToMakeItemVisible(TInt aItemIndex) const;
00648
00654 IMPORT_C void RedrawItem( TInt aItemIndex );
00655
00656
00662 IMPORT_C void SetListBoxObserver(MEikListBoxObserver* aObserver);
00663
00664
00671 IMPORT_C TInt VerticalInterItemGap() const;
00672
00673
00680 IMPORT_C void SetLaunchingButton(CEikButtonBase* aButton);
00681
00682
00688 IMPORT_C void SetItemEditor(MEikListBoxEditor* aEditor);
00689
00693 IMPORT_C void ResetItemEditor();
00699 IMPORT_C MEikListBoxEditor* ItemEditor();
00700
00712 IMPORT_C virtual void EditItemL(TInt aMaxLength);
00713
00722 IMPORT_C void StopEditingL(TBool aUpdateModel);
00723
00724
00725
00726
00732 IMPORT_C virtual TInt ShortcutValueForNextList();
00733
00739 IMPORT_C virtual void SetShortcutValueFromPrevList(TInt aValue);
00740
00741
00748 IMPORT_C TRect HighlightRect() const;
00749
00753 IMPORT_C TBool BackgroundDrawingSuppressed() const;
00754
00755 public:
00756
00766 IMPORT_C virtual void GetColorUseListL(
00767 CArrayFix<TCoeColorUse>& aColorUseList) const;
00768
00769
00778 IMPORT_C virtual void HandleResourceChange(TInt aType);
00779
00780
00818 IMPORT_C virtual void ActivateL();
00819
00827 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00828
00829 private:
00833 IMPORT_C void* ExtensionInterface( TUid aInterface );
00834
00835 protected:
00836
00837
00838 friend class AknListBoxShortCutsImplementation;
00839
00840 friend class AknListBoxLayouts;
00841
00856 IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
00857
00876 IMPORT_C virtual void SizeChanged();
00877
00882 IMPORT_C virtual void HandleViewRectSizeChangeL();
00883
00893 IMPORT_C virtual TInt CountComponentControls() const;
00894
00910 IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
00911
00912
00916 IMPORT_C void CreateMatchBufferL();
00917
00921 IMPORT_C void ClearMatchBuffer() const;
00922
00928 IMPORT_C void MatchTypedCharL(TUint aCode);
00929
00934 IMPORT_C void UndoLastChar();
00940 IMPORT_C TBool LastCharMatched() const;
00941
00942
00947 IMPORT_C virtual void UpdateScrollBarThumbs() const;
00948
00956 IMPORT_C virtual TInt HorizScrollGranularityInPixels() const;
00957
00966 IMPORT_C virtual TInt HorizontalNudgeValue() const;
00967
00975 IMPORT_C virtual void AdjustTopItemIndex() const;
00976
00977
00988 IMPORT_C void SimulateArrowKeyEventL(TKeyCode aKeyCode);
00989
00998 IMPORT_C virtual void HandleLeftArrowKeyL(CListBoxView::TSelectionMode aSelectionMode);
00999
01008 IMPORT_C virtual void HandleRightArrowKeyL(CListBoxView::TSelectionMode aSelectionMode);
01009
01010
01018 IMPORT_C void RestoreCommonListBoxPropertiesL(TResourceReader& aReader);
01019
01030 IMPORT_C virtual void ConstructL(const CCoeControl* aParent, TInt aFlags = 0);
01031
01039 IMPORT_C virtual void CreateViewL();
01040
01051 IMPORT_C virtual CListBoxView* MakeViewClassInstanceL();
01052
01059 IMPORT_C void SetViewRectFromClientRect(const TRect& aClientRect);
01060
01072 IMPORT_C virtual void RestoreClientRectFromViewRect( TRect& aClientRect) const;
01073
01081 IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems( TRect& aRect) const;
01082
01083
01089 IMPORT_C TMargins8 ListBoxMargins() const;
01090
01091
01100 IMPORT_C TInt HorizontalMargin() const;
01101
01111 IMPORT_C TInt VerticalMargin() const;
01112
01118 IMPORT_C void SetHorizontalMargin(TInt aMargin);
01119
01125 IMPORT_C void SetVerticalMargin(TInt aMargin);
01126
01133 IMPORT_C RIncrMatcherBase* MatchBuffer() const;
01134
01144 IMPORT_C TInt ViewRectHeightAdjustment() const;
01145
01151 IMPORT_C TRgb BackColor() const;
01152
01158 IMPORT_C void SetViewRectHeightAdjustment(TInt aAdjustment);
01159
01160
01161
01168 IMPORT_C virtual void ReportListBoxEventL( MEikListBoxObserver::TListBoxEvent aEvent );
01169
01176 IMPORT_C virtual void Draw(const TRect& aRect) const;
01177
01182 IMPORT_C void ClearMargins() const;
01183
01191 IMPORT_C virtual void UpdateCurrentItem(TInt aItemIndex) const;
01192
01202 IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos);
01203
01210 IMPORT_C TBool ItemExists(TInt aItemIndex) const;
01211
01227 IMPORT_C void DrawMatcherCursor() const;
01228
01234 IMPORT_C static TInt InterItemGap();
01235
01240 IMPORT_C void UpdateViewColors();
01241
01246 IMPORT_C void UpdateItemDrawerColors();
01247
01255 IMPORT_C void FireItemChange();
01256
01257
01258 protected:
01267 IMPORT_C void SetReasonForFocusLostL( TReasonForFocusLost aReasonForFocusLost );
01268
01274 IMPORT_C TReasonForFocusLost ReasonForFocusLostL();
01275
01282 IMPORT_C TBool IsMatchBuffer() const;
01283
01289 void CheckCreateExtensionL();
01290
01300 TBool CheckCreateExtension();
01301
01306 void CheckCreateBufferL();
01307
01313 CMatchBuffer* Buffer() const;
01314
01315 protected:
01321 IMPORT_C void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
01322
01327 void UpdateMarkUnmarkMSKL() const;
01328
01329 public:
01333 IMPORT_C TInt EventModifiers();
01334
01335
01336
01337
01338 IMPORT_C TBool IsMultiselection();
01339
01352 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc, TBool aRemote);
01353
01369 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc, TBool aRemote, TBool aWindowOwning);
01370
01381 IMPORT_C void EnableMSKObserver(TBool aEnable);
01382
01388 void DoShiftMSKMarkingL();
01389
01396 void InformMSKButtonGroupDeletion();
01397
01405 IMPORT_C void AddSelectionObserverL( MListBoxSelectionObserver* aObserver );
01406
01413 IMPORT_C void RemoveSelectionObserver( MListBoxSelectionObserver* aObserver );
01414
01422 void ChangeSelectionMode(TBool aEnable);
01423
01430 IMPORT_C void SetItemsInSingleLine(TInt aItems);
01431
01442 IMPORT_C void SetPointerEventFilterDisabledL( const CArrayFix<TInt>& aItemIndexes );
01443
01454 IMPORT_C void HandlePhysicsScrollEventL( TInt aDeltaPixels );
01455
01464 IMPORT_C void DisableScrolling( TBool aDisabled );
01465
01466 private:
01467 IMPORT_C virtual void CEikListBox_Reserved();
01468 void HorizontalScroll(TInt aScrollAmountInPixels);
01469 void DrawItemInView(TInt aItemIndex) const;
01470 void ClearMargins(CWindowGc& aGc) const;
01471 TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
01472 void UpdateScrollBarColors(CEikScrollBar* aScrollBar);
01473 void UpdateScrollBarsColors();
01474
01475 void HandleItemRemovalWithoutSelectionsL();
01476
01477 protected:
01479 TInt iListBoxFlags;
01480
01482 CListBoxView* iView;
01483
01485 CListItemDrawer* iItemDrawer;
01486
01488 MListBoxModel* iModel;
01489
01491 TInt iItemHeight;
01492
01494 CEikScrollBarFrame* iSBFrame;
01495
01497 TScrollBarOwnerShip iSBFrameOwned;
01498
01502 TInt iRequiredHeightInNumOfItems;
01503
01507 CEikButtonBase* iLaunchingButton;
01508
01510 MEikListBoxObserver* iListBoxObserver;
01511
01512 private:
01513
01514 TRgb iBackColor;
01515
01516
01517 TMargins8 iMargins ;
01518 CListBoxExt* iListBoxExt;
01519 TInt iViewRectHeightAdjustment;
01520 MEikListBoxEditor* iItemEditor;
01521 TBool* iLbxDestroyed;
01522 TBool iLastCharMatched;
01523 TInt iSpare;
01524 };
01525
01526
01527
01542 class CEikSnakingListBox : public CEikListBox
01543 {
01544 public:
01548 IMPORT_C CEikSnakingListBox();
01549
01553 IMPORT_C ~CEikSnakingListBox();
01554
01567 IMPORT_C virtual CListBoxView* MakeViewClassInstanceL();
01568
01574 IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const;
01575
01581 IMPORT_C TInt ColumnWidth() const;
01582
01588 IMPORT_C void SetColumnWidth(TInt aColumnWidth);
01589
01590 public:
01591
01599 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
01600
01601 protected:
01602
01611 IMPORT_C virtual void HandleViewRectSizeChangeL();
01612
01621 IMPORT_C virtual void HandleLeftArrowKeyL(
01622 CListBoxView::TSelectionMode aSelectionMode);
01623
01632 IMPORT_C virtual void HandleRightArrowKeyL(
01633 CListBoxView::TSelectionMode aSelectionMode);
01634
01644 IMPORT_C virtual TInt HorizontalNudgeValue() const;
01645
01654 IMPORT_C virtual TInt HorizScrollGranularityInPixels() const;
01655
01663 IMPORT_C virtual void AdjustTopItemIndex() const;
01664
01674 IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos);
01675
01687 IMPORT_C virtual void RestoreClientRectFromViewRect(
01688 TRect& aClientRect) const;
01689
01697 IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems(
01698 TRect& aRect) const;
01699
01705 IMPORT_C void MoveToNextOrPreviousItemL(TPoint aPoint);
01706
01707 protected:
01708
01715 IMPORT_C virtual void SizeChanged();
01716
01726 IMPORT_C virtual void GetColorUseListL(
01727 CArrayFix<TCoeColorUse>& aColorUseList) const;
01728
01737 IMPORT_C virtual void HandleResourceChange(TInt aType);
01738
01739
01740 private:
01741 IMPORT_C void Reserved_1();
01742
01743 IMPORT_C void Reserved_2();
01744
01745 private:
01749 IMPORT_C void* ExtensionInterface( TUid aInterface );
01750
01751 private:
01752 IMPORT_C virtual void CEikListBox_Reserved();
01753 };
01754
01755 #endif // __EIKLBX_H__