1 /* |
|
2 * Copyright (c) 2010 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: Implementation of HbPushButton |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 2 % |
|
19 |
|
20 |
|
21 |
|
22 #include <qgraphicswidget> |
|
23 |
|
24 #include <hbframedrawer.h> |
|
25 |
|
26 #include "mpxvideo_debug.h" |
|
27 #include "hbpushbutton.h" |
|
28 |
|
29 // ------------------------------------------------------------------------------------------------- |
|
30 // HbPushButton::HbPushButton |
|
31 // ------------------------------------------------------------------------------------------------- |
|
32 // |
|
33 HbPushButton::HbPushButton() |
|
34 : mVisible( false ) |
|
35 , mEnabled( false ) |
|
36 , mSelected( false ) |
|
37 , mFrameDrawer( NULL ) |
|
38 { |
|
39 MPX_ENTER_EXIT(_L("HbPushButton::HbPushButton()")); |
|
40 |
|
41 mBackground = new QGraphicsWidget(); |
|
42 } |
|
43 |
|
44 // ------------------------------------------------------------------------------------------------- |
|
45 // HbPushButton::~HbPushButton |
|
46 // ------------------------------------------------------------------------------------------------- |
|
47 // |
|
48 HbPushButton::~HbPushButton() |
|
49 { |
|
50 MPX_DEBUG(_L("HbPushButton::HbPushButton") ); |
|
51 |
|
52 if ( mBackground ) |
|
53 { |
|
54 delete mBackground; |
|
55 mBackground = NULL; |
|
56 } |
|
57 } |
|
58 |
|
59 // ------------------------------------------------------------------------------------------------- |
|
60 // HbPushButton::setEnabled |
|
61 // ------------------------------------------------------------------------------------------------- |
|
62 // |
|
63 void HbPushButton::setEnabled( bool enabled ) |
|
64 { |
|
65 MPX_DEBUG(_L("HbPushButton::setEnabled %d"), enabled ); |
|
66 |
|
67 mEnabled = enabled; |
|
68 } |
|
69 |
|
70 // ------------------------------------------------------------------------------------------------- |
|
71 // HbPushButton::isEnabled |
|
72 // ------------------------------------------------------------------------------------------------- |
|
73 // |
|
74 bool HbPushButton::isEnabled() |
|
75 { |
|
76 MPX_DEBUG(_L("HbPushButton::isEnabled %d"), mEnabled ); |
|
77 |
|
78 return mEnabled; |
|
79 } |
|
80 |
|
81 // ------------------------------------------------------------------------------------------------- |
|
82 // HbPushButton::setVisible |
|
83 // ------------------------------------------------------------------------------------------------- |
|
84 // |
|
85 void HbPushButton::setVisible( bool visible ) |
|
86 { |
|
87 MPX_DEBUG(_L("HbPushButton::setVisible %d"), visible ); |
|
88 |
|
89 mVisible = visible; |
|
90 } |
|
91 |
|
92 // ------------------------------------------------------------------------------------------------- |
|
93 // HbPushButton::isVisible |
|
94 // ------------------------------------------------------------------------------------------------- |
|
95 // |
|
96 bool HbPushButton::isVisible() |
|
97 { |
|
98 MPX_DEBUG(_L("HbPushButton::isVisible %d"), mVisible ); |
|
99 |
|
100 return mVisible; |
|
101 } |
|
102 |
|
103 // ------------------------------------------------------------------------------------------------- |
|
104 // HbPushButton::setSelected |
|
105 // ------------------------------------------------------------------------------------------------- |
|
106 // |
|
107 void HbPushButton::setSelected( bool selected ) |
|
108 { |
|
109 MPX_DEBUG(_L("HbPushButton::setSelected %d"), selected ); |
|
110 |
|
111 mSelected = selected; |
|
112 } |
|
113 |
|
114 // ------------------------------------------------------------------------------------------------- |
|
115 // HbPushButton::isSelected |
|
116 // ------------------------------------------------------------------------------------------------- |
|
117 // |
|
118 bool HbPushButton::isSelected() |
|
119 { |
|
120 MPX_DEBUG(_L("HbPushButton::isSelected %d"), mSelected ); |
|
121 |
|
122 return mSelected; |
|
123 } |
|
124 |
|
125 // ------------------------------------------------------------------------------------------------- |
|
126 // HbPushButton::primitive |
|
127 // ------------------------------------------------------------------------------------------------- |
|
128 // |
|
129 QGraphicsItem* HbPushButton::primitive( HbStyle::Primitive primitive ) const |
|
130 { |
|
131 MPX_DEBUG(_L("HbPushButton::primitive") ); |
|
132 |
|
133 Q_UNUSED( primitive ); |
|
134 return mBackground; |
|
135 } |
|
136 |
|
137 // ------------------------------------------------------------------------------------------------- |
|
138 // HbPushButton::press |
|
139 // ------------------------------------------------------------------------------------------------- |
|
140 // |
|
141 void HbPushButton::press() |
|
142 { |
|
143 MPX_DEBUG(_L("HbPushButton::press") ); |
|
144 |
|
145 emit pressed(); |
|
146 } |
|
147 |
|
148 // ------------------------------------------------------------------------------------------------- |
|
149 // HbPushButton::release |
|
150 // ------------------------------------------------------------------------------------------------- |
|
151 // |
|
152 void HbPushButton::release() |
|
153 { |
|
154 MPX_DEBUG(_L("HbPushButton::release") ); |
|
155 |
|
156 emit released(); |
|
157 } |
|
158 |
|
159 // ------------------------------------------------------------------------------------------------- |
|
160 // HbPushButton::frameBackground |
|
161 // ------------------------------------------------------------------------------------------------- |
|
162 // |
|
163 HbFrameDrawer* HbPushButton::frameBackground() |
|
164 { |
|
165 MPX_DEBUG(_L("HbPushButton::frameBackground") ); |
|
166 |
|
167 return mFrameDrawer; |
|
168 } |
|
169 |
|
170 // ------------------------------------------------------------------------------------------------- |
|
171 // HbPushButton::setFrameBackground |
|
172 // ------------------------------------------------------------------------------------------------- |
|
173 // |
|
174 void HbPushButton::setFrameBackground( HbFrameDrawer *drawer ) |
|
175 { |
|
176 MPX_DEBUG(_L("HbPushButton::setFrameBackground") ); |
|
177 |
|
178 mFrameDrawer = drawer; |
|
179 } |
|
180 |
|
181 // End of file |
|