|
1 /* |
|
2 ============================================================================ |
|
3 Name : NPRStoryListBox.h |
|
4 Author : Symsource |
|
5 |
|
6 Copyright (c) 2009 Symbian Foundation Ltd |
|
7 This component and the accompanying materials are made available |
|
8 under the terms of the License "Eclipse Public License v1.0" |
|
9 which accompanies this distribution, and is available |
|
10 at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
11 |
|
12 Initial Contributors: |
|
13 - Symsource |
|
14 |
|
15 Contributors: |
|
16 - Symsource |
|
17 |
|
18 Description : Container for Series60 double style list box to show the NPR's story list |
|
19 ============================================================================ |
|
20 */ |
|
21 |
|
22 #ifndef __NPR_STORY_LIST_BOX_H__ |
|
23 #define __NPR_STORY_LIST_BOX_H__ |
|
24 |
|
25 #include <coecntrl.h> |
|
26 #include <gulicon.h> |
|
27 |
|
28 |
|
29 class MEikCommandObserver; |
|
30 class CAknDoubleLargeStyleListBox; |
|
31 class CEikTextListBox; |
|
32 class CNPRStory; |
|
33 class CNPRHtmlCreator; |
|
34 |
|
35 /** |
|
36 * Container class for NPRStoryListBox |
|
37 * |
|
38 * @class CNPRStoryListBox NPRStoryListBox.h |
|
39 */ |
|
40 class CNPRStoryListBox : public CCoeControl |
|
41 { |
|
42 public: |
|
43 enum TControls |
|
44 { |
|
45 EListBox, |
|
46 ELastControl |
|
47 }; |
|
48 enum TListBoxImages |
|
49 { |
|
50 EListBoxFirstUserImageIndex |
|
51 }; |
|
52 |
|
53 public: |
|
54 static CNPRStoryListBox* NewL(const TRect& aRect, const CCoeControl* aParent, MEikCommandObserver* aCommandObserver); |
|
55 static CNPRStoryListBox* NewLC(const TRect& aRect, const CCoeControl* aParent, MEikCommandObserver* aCommandObserver); |
|
56 virtual ~CNPRStoryListBox(); |
|
57 |
|
58 public: |
|
59 void ShowSelectedStoryL(); |
|
60 // from base class CCoeControl |
|
61 TInt CountComponentControls() const; |
|
62 CCoeControl* ComponentControl(TInt aIndex) const; |
|
63 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
64 void HandleResourceChange(TInt aType); |
|
65 static void AddListBoxItemL(CEikTextListBox* aListBox, const TDesC& aString); |
|
66 static RArray< TInt >* GetSelectedListBoxItemsLC(CEikTextListBox* aListBox); |
|
67 static void DeleteSelectedListBoxItemsL(CEikTextListBox* aListBox); |
|
68 CAknDoubleLargeStyleListBox* ListBox(); |
|
69 static void CreateListBoxItemL(TDes& aBuffer, TInt aIconIndex, const TDesC& aMainText, const TDesC& aSecondaryText); |
|
70 void AddListBoxResourceArrayItemL(TInt aResourceId, TInt aIconIndex); |
|
71 void SetupListBoxIconsL(); |
|
72 TBool HandleMarkableListCommandL(TInt aCommand); |
|
73 static CGulIcon* LoadAndScaleIconL(const TDesC& aFileName, TInt aBitmapId, TInt aMaskId, TSize* aSize, TScaleMode aScaleMode); |
|
74 |
|
75 protected: |
|
76 // from base class CCoeControl |
|
77 void SizeChanged(); |
|
78 |
|
79 private: |
|
80 TInt CurrentItemIndex(); |
|
81 void InitializeControlsL(); |
|
82 void LayoutControls(); |
|
83 |
|
84 // from base class CCoeControl |
|
85 void Draw( const TRect& aRect ) const; |
|
86 |
|
87 private: |
|
88 // constructors |
|
89 CNPRStoryListBox(); |
|
90 void ConstructL(const TRect& aRect, const CCoeControl* aParent, MEikCommandObserver* aCommandObserver); |
|
91 |
|
92 private: |
|
93 CCoeControl* iFocusControl; |
|
94 MEikCommandObserver* iCommandObserver; |
|
95 CAknDoubleLargeStyleListBox* iListBox; |
|
96 const RPointerArray<CNPRStory>* iStoryArray; |
|
97 CNPRHtmlCreator* iHtmlCreator; |
|
98 }; |
|
99 |
|
100 #endif // __NPR_STORY_LIST_BOX_H__ |