1 /* 2 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.javafx.embed; 27 28 import java.nio.IntBuffer; 29 30 import com.sun.javafx.scene.traversal.Direction; 31 import javafx.collections.ObservableList; 32 import javafx.event.EventType; 33 import javafx.scene.image.PixelFormat; 34 import javafx.scene.input.InputMethodEvent; 35 import javafx.scene.input.InputMethodRequests; 36 import javafx.scene.input.InputMethodTextRun; 37 38 /** 39 * An interface for embedded FX scene peer. It is used by HostInterface 40 * object to send various notifications to the scene, for example, when 41 * an input event is received in the host application and should be 42 * forwarded to FX. 43 * 44 */ 45 public interface EmbeddedSceneInterface { 46 47 /* 48 * A notification about the embedded container is resized. 49 */ 50 public void setSize(int width, int height); 51 52 /* 53 * A notification about the scale factor is changed. 54 */ 55 public void setPixelScaleFactors(float scalex, float scaley); 56 57 /* 58 * A request to fetch all the FX scene pixels into a offscreen buffer. 59 */ 60 public boolean getPixels(IntBuffer dest, int width, int height); 61 62 /* 63 * A request to get the FX scene's pixel format. 64 */ 65 public PixelFormat<?> getPixelFormat(); 66 67 /* 68 * A notification about mouse event received by host container. 69 */ 70 public void mouseEvent(int type, int button, 71 boolean primaryBtnDown, boolean middleBtnDown, boolean secondaryBtnDown, 72 int x, int y, int xAbs, int yAbs, 73 boolean shift, boolean ctrl, boolean alt, boolean meta, 74 boolean popupTrigger); 75 /* 76 * A notification about mouse wheel scroll events received by the host container; 77 */ 78 public void scrollEvent(int type, double scrollX, double scrollY, 79 double totalScrollX, double totalScrollY, 80 double xMultiplier, double yMultiplier, 81 double x, double y, double screenX, double screenY, 82 boolean shift, boolean ctrl, 83 boolean alt, boolean meta, boolean inertia); 84 /* 85 * A notification about key event received by host container. 86 */ 87 public void keyEvent(int type, int key, char[] chars, int modifiers); 88 89 /* 90 * A notification about zoom events received by the host container. 91 */ 92 public void zoomEvent(final int type, final double zoomFactor, final double totalZoomFactor, 93 final double x, final double y, final double screenX, final double screenY, 94 boolean shift, boolean ctrl, boolean alt, boolean meta, boolean inertia); 95 96 /* 97 * A notification about rotate events received by the host container. 98 */ 99 public void rotateEvent(final int type, final double angle, final double totalAngle, 100 final double x, final double y, final double screenX, final double screenY, 101 boolean shift, boolean ctrl, boolean alt, boolean meta, boolean inertia); 102 103 /* 104 * A notification about swipe events received by the host container. 105 */ 106 public void swipeEvent(final int type, final double x, final double y, final double screenX, final double screenY, 107 boolean shift, boolean ctrl, boolean alt, boolean meta); 108 109 /* 110 * A notification about menu event received by host container. 111 */ 112 public void menuEvent(int x, int y, int xAbs, int yAbs, boolean isKeyboardTrigger); 113 114 public boolean traverseOut(Direction dir); 115 116 public void setDragStartListener(HostDragStartListener l); 117 118 public EmbeddedSceneDTInterface createDropTarget(); 119 120 public void inputMethodEvent(EventType<InputMethodEvent> type, 121 ObservableList<InputMethodTextRun> composed, String committed, 122 int caretPosition); 123 124 public InputMethodRequests getInputMethodRequests(); 125 }