Commit | Line | Data |
---|---|---|
c879c4db AM |
1 | /* |
2 | * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com> | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | */ | |
9 | ||
10 | package org.lttng.scope.tmf2.views.ui.timeline.widgets.timegraph.toolbar; | |
11 | ||
12 | import org.lttng.scope.tmf2.views.ui.jfx.JfxImageFactory; | |
13 | import org.lttng.scope.tmf2.views.ui.timeline.widgets.timegraph.TimeGraphWidget; | |
14 | ||
15 | import javafx.scene.control.Button; | |
16 | import javafx.scene.control.Tooltip; | |
17 | import javafx.scene.image.Image; | |
18 | import javafx.scene.image.ImageView; | |
19 | ||
20 | /** | |
21 | * Button for zooming in. It should do the same action as one ctrl+mouse-scroll. | |
22 | * | |
23 | * @author Alexandre Montplaisir | |
24 | */ | |
25 | class ZoomInButton extends Button { | |
26 | ||
27 | private static final String ZOOM_IN_ICON_PATH = "/icons/toolbar/zoom_in.gif"; //$NON-NLS-1$ | |
28 | ||
29 | public ZoomInButton(TimeGraphWidget viewer) { | |
30 | Image icon = JfxImageFactory.instance().getImageFromResource(ZOOM_IN_ICON_PATH); | |
31 | setGraphic(new ImageView(icon)); | |
32 | setTooltip(new Tooltip(Messages.sfZoomInActionDescription)); | |
33 | setOnAction(e -> { | |
34 | viewer.getZoomActions().zoom(true, false, null); | |
35 | }); | |
36 | } | |
37 | } |