|
1 /* |
|
2 * Copyright (c) 2007-2008 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: toolbar presentation model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HNTOOLBARMODEL_H_ |
|
20 #define HNTOOLBARMODEL_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32cmn.h> |
|
24 |
|
25 class CHnButtonModel; |
|
26 |
|
27 /** |
|
28 * Toolbar model class. |
|
29 * |
|
30 * Toolbar represents toolbar class from meta data model. Contains buttons. |
|
31 * UI layer can fetch the data from toolbar model to display it on screen. |
|
32 * |
|
33 * @lib hnpresentationmodel |
|
34 * @since S60 5.0 |
|
35 * @ingroup group_hnpresentationmodel |
|
36 */ |
|
37 NONSHARABLE_CLASS( CHnToolbarModel ) : public CBase |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * |
|
44 * @since S60 5.0 |
|
45 */ |
|
46 IMPORT_C static CHnToolbarModel* NewLC(); |
|
47 |
|
48 /** |
|
49 * Virtual Destructor. |
|
50 * |
|
51 * @since S60 5.0 |
|
52 */ |
|
53 IMPORT_C ~CHnToolbarModel(); |
|
54 |
|
55 /** |
|
56 * Adds toolbar button. |
|
57 * |
|
58 * @since S60 5.0 |
|
59 * @param aButton Toolbar button to add |
|
60 */ |
|
61 IMPORT_C void AddButtonL( CHnButtonModel* aButton ); |
|
62 |
|
63 /** |
|
64 * Gets toolbar button model. |
|
65 * |
|
66 * @since S60 5.0 |
|
67 * @param aIndex Index of toolbar button |
|
68 * @return Toolbar button model for item, NULL if not exist |
|
69 */ |
|
70 IMPORT_C const CHnButtonModel* GetButton( TInt aIndex ) const; |
|
71 |
|
72 /** |
|
73 * Informs if toolbar has any buttons. |
|
74 * |
|
75 * @since S60 5.0 |
|
76 * @return true if has, false if doesn't |
|
77 */ |
|
78 IMPORT_C TBool HasButtons() const; |
|
79 |
|
80 /** |
|
81 * Removes all LIW objects owned by this object. |
|
82 * |
|
83 * LIW objects owned by non-LIW objects that are owned by |
|
84 * this object are also removed. |
|
85 * @since S60 5.0 |
|
86 */ |
|
87 void RemoveLiwObjects(); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * Default constructor. |
|
93 * |
|
94 * @param aMaxCount Maximal number of buttons in the toolbar. |
|
95 * @since S60 5.0 |
|
96 */ |
|
97 CHnToolbarModel( TInt aMaxCount = 3); |
|
98 |
|
99 /** |
|
100 * Second phase constructor. |
|
101 * |
|
102 * @since S60 5.0 |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 private: // data |
|
107 |
|
108 /** |
|
109 * Buttons for toolbar. Max 3 buttons. |
|
110 */ |
|
111 RPointerArray< CHnButtonModel > iButtons; |
|
112 |
|
113 private: // constants |
|
114 |
|
115 /** |
|
116 * Max button count. |
|
117 */ |
|
118 const TInt KMaxButtonCount; |
|
119 }; |
|
120 |
|
121 |
|
122 #endif // HNTOOLBARMODEL_H_ |