|
1 /******************************************************************************* |
|
2 * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #ifndef SWTTABLEITEMDRAWER_H |
|
14 #define SWTTABLEITEMDRAWER_H |
|
15 |
|
16 |
|
17 #include <eiklbi.h> |
|
18 #include <eiktxlbm.h> |
|
19 #include <eiklbd.h> |
|
20 #include <gulicon.h> |
|
21 #include "swtcontrolhelper.h" |
|
22 #include "swttable.h" |
|
23 |
|
24 |
|
25 class CSwtImageTextItem; |
|
26 class CSwtTableListBox; |
|
27 class CSwtTable; |
|
28 |
|
29 |
|
30 /** |
|
31 * This class implements the item drawer for the listbox used in Table. |
|
32 * @lib eswt.dll |
|
33 */ |
|
34 NONSHARABLE_CLASS(CSwtTableItemDrawer) |
|
35 : public CTextListItemDrawer |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 /** |
|
41 * The constructor. |
|
42 * @param aTextListBoxModel The model of the listbox |
|
43 * @param aFont The font to draw with |
|
44 * @param aTableListBox The listbox that this drawer is for |
|
45 * @param aTable The parent table |
|
46 */ |
|
47 CSwtTableItemDrawer(MTextListBoxModel* aTextListBoxModel, |
|
48 const CFont* aFont, |
|
49 CSwtTableListBox& aTableListBox, |
|
50 CSwtTable &aTable); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CSwtTableItemDrawer(); |
|
56 |
|
57 /** |
|
58 * Drawing of bi-directional text in the given rectangle. |
|
59 * @param aGc The gc used for drawing. |
|
60 * @param aFont The font used for drawing. |
|
61 * @param aTextColor The pen color used for drawing. |
|
62 * @param aText The text to draw. |
|
63 * @param aTextRect The rectangle to draw in. |
|
64 * @param aAlignment The horizontal alignment of the text inside the rectangle. |
|
65 */ |
|
66 void DrawTableBidiText(CWindowGc& aGc, |
|
67 const CFont* aFont, |
|
68 const TRgb& aTextColor, |
|
69 const TDesC& aText, |
|
70 const TRect& aTextRect, |
|
71 const CGraphicsContext::TTextAlign& aAlignment) const; |
|
72 |
|
73 /** |
|
74 * Calculates the column area based on the given rectangle by removing |
|
75 * the areas that don't belong into the columns such as margins and checkboxes. |
|
76 * @param aRect The whole table data area rectangle |
|
77 * @return The column area rectangle |
|
78 */ |
|
79 TRect ColumnRectFromWholeRect(const TRect& aRect) const; |
|
80 |
|
81 // From CTextListItemDrawer |
|
82 |
|
83 TInt ItemWidthInPixels(TInt aItemIndex) const; |
|
84 TSize MinimumCellSize() const; |
|
85 void DoDrawItemText(const TDesC& aDes, |
|
86 const TRect& aItemTextRect, |
|
87 TBool aItemIsCurrent, |
|
88 TBool aViewIsEmphasized, |
|
89 TBool aItemIsSelected, |
|
90 TInt aItemIndex) const; |
|
91 |
|
92 private: // data |
|
93 |
|
94 /** |
|
95 * The listbox control of this item drawer. |
|
96 */ |
|
97 CSwtTableListBox& iTableListBox; |
|
98 |
|
99 /** |
|
100 * The parent table. |
|
101 */ |
|
102 CSwtTable& iTable; |
|
103 }; |
|
104 |
|
105 #endif // SWTTABLEITEMDRAWER_H |