diff -r 000000000000 -r eb1f2e154e89 textinput/peninputcommonctrls/inc/peninputselectionlist/peninputselectionlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/textinput/peninputcommonctrls/inc/peninputselectionlist/peninputselectionlist.h Tue Feb 02 01:02:04 2010 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef C_CPENINPUTSELECTIONLIST_H +#define C_CPENINPUTSELECTIONLIST_H + +#include +#include +#include + +class CPenInputSelectionList : public CFepUiBaseCtrl + { +public: + struct SItem + { + SItem(TRect aRect, const TDesC& aText) + :iRect(aRect), iText(aText) + { + } + + TRect iRect; + const TDesC& iText; + }; + + enum TSelectionListBmpType + { + EBmpNormal, + EBmpNormalMask, + EBmpHighlight, + EBmpHighlightMask, + EBmpLastType = EBmpHighlightMask + }; + +public: + IMPORT_C static CPenInputSelectionList* NewL(CFepUiLayout* aUiLayout, + TInt aControlId, + TPoint aTopLeftPoint, + TSize aItemSize, + TInt aItemHorizontalMargin); + + IMPORT_C ~CPenInputSelectionList(); + + IMPORT_C void SizeChanged(TPoint aTopLeftPoint, + TSize aItemSize, + TInt aItemHorizontalMargin); + + // control rect is calculated by item count + IMPORT_C void SetItemsL(const RPointerArray& aItemList); + + IMPORT_C void AddItemL(const TDesC& aItem); + + IMPORT_C void RemoveItem(TInt aItemIndex); + + IMPORT_C void RemoveAllItems(); + + IMPORT_C void ConstructFromResourceL(); + + IMPORT_C void SetTextProperty(const CFont* aFont, + TRgb aFontColor); + + IMPORT_C CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint); + IMPORT_C CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint); + IMPORT_C CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint); + + IMPORT_C void Display(); + + IMPORT_C void CloseWindow(); + + inline void SetTextLineLayout(TAknTextLineLayout aTextLine); + + inline void SetEventIdForItemSelected(TInt aEventId); + + inline void SetBgFrId(TAknsItemID aFrId, TAknsItemID aCenterFrId); + + void Draw(); + +private: + + CPenInputSelectionList(CFepUiLayout* aUiLayout, + TInt aControlId, + TPoint aTopLeftPoint, + TSize aItemSize, + TInt aItemHorizontalMargin); + + void ConstructL(); + + void RecalculateCtrlRect(); + + // get item whose region contains the point + TInt HitTest(const TPoint& aPoint); + + void DrawItem(TInt aItemIndex); + + void CalculateFrameRects(const TRect aRect, TRect& aOuterRect, TRect& aInnerRect) const; +private: + + RArray iItemList; + TPoint iTopLeftPoint; + TSize iItemSize; + TInt iItemHorizontalMargin; + TInt iBaselineOffset; + const CFont* iFont; + TRgb iFontColor; + TAknTextLineLayout iTextLine; + + TInt iFocusItemIndex; + + RPointerArray iBmpList; + + TInt iEventId; + TBool iTextLineSet; + TAknsItemID iFrId; + TAknsItemID iCenterFrId; + }; + +inline void CPenInputSelectionList::SetTextLineLayout(TAknTextLineLayout aTextLine) + { + iTextLine = aTextLine; + iTextLineSet = ETrue; + } + +inline void CPenInputSelectionList::SetEventIdForItemSelected(TInt aEventId) + { + iEventId = aEventId; + } + +inline void CPenInputSelectionList::SetBgFrId(TAknsItemID aFrId, TAknsItemID aCenterFrId) + { + iFrId = aFrId; + iCenterFrId = aCenterFrId; + } + +#endif // C_CPENINPUTSELECTIONLIST_H \ No newline at end of file