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 #include "hntoolbarmodel.h" |
|
20 #include "hnbuttonmodel.h" |
|
21 |
|
22 // ============================ MEMBER FUNCTIONS ============================= |
|
23 |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 EXPORT_C CHnToolbarModel* CHnToolbarModel::NewLC() |
|
30 { |
|
31 CHnToolbarModel* self = new( ELeave ) CHnToolbarModel(); |
|
32 CleanupStack::PushL( self ); |
|
33 self->ConstructL(); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C CHnToolbarModel::~CHnToolbarModel() |
|
42 { |
|
43 iButtons.ResetAndDestroy(); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C void CHnToolbarModel::AddButtonL( CHnButtonModel* aButton ) |
|
51 { |
|
52 if( iButtons.Count() <= KMaxButtonCount ) |
|
53 { |
|
54 iButtons.AppendL( aButton ); |
|
55 } |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C const CHnButtonModel* CHnToolbarModel::GetButton( TInt aIndex ) const |
|
63 { |
|
64 CHnButtonModel* button = NULL; |
|
65 for( TInt i( 0 ); i < iButtons.Count(); i++ ) |
|
66 { |
|
67 if( iButtons[ i ]->GetIndex() == aIndex ) |
|
68 { |
|
69 button = iButtons[ i ]; |
|
70 } |
|
71 } |
|
72 return button; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C TBool CHnToolbarModel::HasButtons() const |
|
80 { |
|
81 TBool hasButtons = EFalse; |
|
82 if( iButtons.Count() != 0 ) |
|
83 { |
|
84 hasButtons = ETrue; |
|
85 } |
|
86 return hasButtons; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CHnToolbarModel::RemoveLiwObjects() |
|
94 { |
|
95 for( TInt i( 0 ); i < iButtons.Count(); i++ ) |
|
96 { |
|
97 iButtons[i]->RemoveLiwObjects(); |
|
98 } |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 CHnToolbarModel::CHnToolbarModel( TInt aMaxCount ) : |
|
106 KMaxButtonCount( aMaxCount ) |
|
107 { |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 void CHnToolbarModel::ConstructL() |
|
115 { |
|
116 } |
|
117 |
|