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 button model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "hnbuttonmodel.h" |
|
20 #include "gulicon.h" |
|
21 #include "hnattributeimage.h" |
|
22 #include "hnattributebase.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS ============================= |
|
25 |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 EXPORT_C CHnButtonModel* CHnButtonModel::NewLC( TInt aIndex ) |
|
32 { |
|
33 CHnButtonModel* self = new( ELeave ) CHnButtonModel( aIndex ); |
|
34 CleanupStack::PushL( self ); |
|
35 self->ConstructL(); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C CHnButtonModel::~CHnButtonModel() |
|
44 { |
|
45 iToolTip.Close(); |
|
46 //delete iIcon; |
|
47 delete iIconAttribute; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C CGulIcon* CHnButtonModel::GetIcon() const |
|
55 { |
|
56 CGulIcon* icon = NULL; |
|
57 |
|
58 if ( iIconAttribute ) |
|
59 { |
|
60 icon = iIconAttribute->GetIcon(); |
|
61 } |
|
62 |
|
63 return icon; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C void CHnButtonModel::SetIcon( CHnAttributeBase* aAttribute ) |
|
71 { |
|
72 delete iIconAttribute; |
|
73 iIconAttribute = NULL; |
|
74 iIconAttribute = aAttribute; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C const TDesC& CHnButtonModel::GetButtonText() const |
|
82 { |
|
83 return iToolTip; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C void CHnButtonModel::SetHelpTextL( const TDesC& aToolTip ) |
|
91 { |
|
92 iToolTip.Close(); |
|
93 iToolTip.CreateL( aToolTip ); |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C TBool CHnButtonModel::GetDimmed() const |
|
101 { |
|
102 return iDimmed; |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 EXPORT_C void CHnButtonModel::SetDimmed( TBool aDimmed ) |
|
110 { |
|
111 iDimmed = aDimmed; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 EXPORT_C TInt CHnButtonModel::GetIndex() const |
|
119 { |
|
120 return iIndex; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C TInt CHnButtonModel::GetEventId() const |
|
128 { |
|
129 return iEventId; |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C void CHnButtonModel::SetEventId( TInt aEventId ) |
|
137 { |
|
138 iEventId = aEventId; |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 void CHnButtonModel::RemoveLiwObjects() |
|
146 { |
|
147 iIconAttribute->RemoveLiwObjects(); |
|
148 } |
|
149 |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 CHnButtonModel::CHnButtonModel( TInt aIndex ) |
|
155 { |
|
156 iIndex = aIndex; |
|
157 iDimmed = EFalse; |
|
158 iEventId = KErrNotFound; |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 void CHnButtonModel::ConstructL() |
|
166 { |
|
167 } |
|
168 |
|