|
30 | 30 | import com.codename1.ui.Image;
|
31 | 31 | import com.codename1.ui.TextArea;
|
32 | 32 | import com.codename1.ui.events.ActionListener;
|
| 33 | +import com.codename1.ui.events.ActionSource; |
33 | 34 | import com.codename1.ui.geom.Dimension;
|
34 | 35 | import com.codename1.ui.layouts.BorderLayout;
|
35 | 36 | import com.codename1.ui.layouts.BoxLayout;
|
|
47 | 48 | *
|
48 | 49 | * @author Shai Almog
|
49 | 50 | */
|
50 |
| -public class SpanButton extends Container { |
| 51 | +public class SpanButton extends Container implements ActionSource { |
51 | 52 |
|
52 | 53 | private Button actualButton;
|
53 | 54 | private TextArea text;
|
@@ -84,6 +85,7 @@ public SpanButton(String txt) {
|
84 | 85 | text.setEditable(false);
|
85 | 86 | text.setFocusable(false);
|
86 | 87 | text.setActAsLabel(true);
|
| 88 | + setFocusable(true); |
87 | 89 | removeBackground(text.getUnselectedStyle());
|
88 | 90 | removeBackground(text.getSelectedStyle());
|
89 | 91 | removeBackground(text.getPressedStyle());
|
@@ -207,6 +209,24 @@ public Image getIcon() {
|
207 | 209 | return actualButton.getIcon();
|
208 | 210 | }
|
209 | 211 |
|
| 212 | + /** |
| 213 | + * Binds long press listener to button events. |
| 214 | + * @param l |
| 215 | + * @since 7.0 |
| 216 | + */ |
| 217 | + public void addLongPressListener(ActionListener l) { |
| 218 | + actualButton.addLongPressListener(l); |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * Unbinds long press listener to button events. |
| 223 | + * @param l |
| 224 | + * @since 7.0 |
| 225 | + */ |
| 226 | + public void removeLongPressListener(ActionListener l) { |
| 227 | + actualButton.removeLongPressListener(l); |
| 228 | + } |
| 229 | + |
210 | 230 | /**
|
211 | 231 | * Binds an action listener to button events
|
212 | 232 | *
|
|
0 commit comments