|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: A drawer class for the capture setup list box items* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef CAMCAPTURESETUPLISTITEMDRAWER_H |
|
19 #define CAMCAPTURESETUPLISTITEMDRAWER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <eiklbi.h> |
|
23 #include <AknUtils.h> |
|
24 #include <AknLayout2ScalableDef.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MCamListboxModel; |
|
28 class CAknIconArray; |
|
29 class CAknsBasicBackgroundControlContext; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Item drawer for CCamCaptureSetupListBox |
|
35 * |
|
36 * @since 2.8 |
|
37 */ |
|
38 class CCamCaptureSetupListItemDrawer : public CListItemDrawer |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Symbian OS two-phased constructor |
|
44 * @since 2.8 |
|
45 * @param aListBoxModel reference to a list box model used to access item data |
|
46 * @return pointer to the newly created object |
|
47 */ |
|
48 static CCamCaptureSetupListItemDrawer* NewL( MCamListboxModel& aListBoxModel ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 * @since 2.8 |
|
53 */ |
|
54 virtual ~CCamCaptureSetupListItemDrawer(); |
|
55 |
|
56 public: |
|
57 /** |
|
58 * Sets the parent control of the listbox |
|
59 * @since 2.8 |
|
60 * @param aControl pointer the the listbox's parent |
|
61 */ |
|
62 void SetParentControl( const CCoeControl* aControl ); |
|
63 |
|
64 private: |
|
65 |
|
66 /** |
|
67 * C++ default constructor. |
|
68 * @since 2.8 |
|
69 * @param aListBoxModel reference to a list box model used to access item data |
|
70 */ |
|
71 CCamCaptureSetupListItemDrawer( MCamListboxModel& aListBoxModel ); |
|
72 |
|
73 /** |
|
74 * Second phase construction |
|
75 */ |
|
76 void ConstructL(); |
|
77 |
|
78 private: // Methods from base classes |
|
79 |
|
80 |
|
81 /** |
|
82 * From CListItemDrawer |
|
83 * Calculates the minimum size for a cell |
|
84 * @since 2.8 |
|
85 * @return the minimum size of a cell |
|
86 */ |
|
87 TSize MinimumCellSize() const; |
|
88 |
|
89 /** |
|
90 * From CListItemDrawer |
|
91 * Draws an item to the screen |
|
92 * @since 2.8 |
|
93 * @param aItemIndex the item to draw |
|
94 * @param aActualItemRect the screen area occupied by the item |
|
95 * @param aItemIsCurrent whether or not the item is highlighted |
|
96 * @param aViewIsEmphasized unused |
|
97 * @param aViewIsDimmed unused |
|
98 * @param aItemIsSelected whether or not the item is selected |
|
99 */ |
|
100 void DrawActualItem( TInt aItemIndex, |
|
101 const TRect& aActualItemRect, |
|
102 TBool aItemIsCurrent, |
|
103 TBool aViewIsEmphasized, |
|
104 TBool aViewIsDimmed, |
|
105 TBool aItemIsSelected ) const; |
|
106 |
|
107 private: // New methods |
|
108 |
|
109 /** |
|
110 * Draws the highlight rectangle |
|
111 * @since 2.8 |
|
112 * @param aActualItemRect the screen area occupied by the item |
|
113 */ |
|
114 void DrawHighlight( const TRect& aActualItemRect ) const; |
|
115 |
|
116 /** |
|
117 * Draws the radio button according to the items current state |
|
118 * @since 2.8 |
|
119 * @param remainingItemRect the remaining are for the item |
|
120 * @param aItemIsSelected whether or not the item is selected |
|
121 * @param aColor The colour to draw the radio button in |
|
122 */ |
|
123 void DrawRadioButton( const TRect& remainingItemRect, |
|
124 TBool aItemIsSelected, const TRgb& aColor ) const; |
|
125 |
|
126 /** |
|
127 * Draws a rectangle for an item. |
|
128 * @since 2.8 |
|
129 * @param the rectangular area to be drawn. |
|
130 */ |
|
131 void DrawItemRect( const TRect& aActualItemRect ) const; |
|
132 |
|
133 /** |
|
134 * Read list layout |
|
135 */ |
|
136 void ReadLayout(); |
|
137 |
|
138 void CreateIconAndAddToArrayL( CArrayPtr<CGulIcon>*& aIconArray, |
|
139 const TAknsItemID& aId, |
|
140 const TInt aColorIndex, |
|
141 const TDesC& aBmpFile, |
|
142 const TInt32 aBmp, |
|
143 const TInt32 aBmpM ); |
|
144 |
|
145 private: // Data |
|
146 |
|
147 // Array of icons for different radio button states. |
|
148 CArrayPtr<CGulIcon>* iRadioButtonIconArray; |
|
149 |
|
150 // Model class providing access to item data |
|
151 MCamListboxModel& iModel; |
|
152 |
|
153 // Item height read from resource |
|
154 TInt iCaptureSetupItemHeight; |
|
155 |
|
156 // the parent control of the listbox |
|
157 const CCoeControl* iParentControl; |
|
158 |
|
159 // Layouts |
|
160 TAknTextComponentLayout iTxtLayout; |
|
161 TAknWindowComponentLayout iBmpLayout; |
|
162 TAknTextComponentLayout iTxtWithRbLayout; |
|
163 TAknWindowComponentLayout iBmpWithRbLayout; |
|
164 TAknWindowComponentLayout iHighlightLayout; |
|
165 }; |
|
166 |
|
167 #endif // CAMCAPTURESETUPLISTITEMDRAWER_H |
|
168 |
|
169 // End of File |