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