1 /* 2 * Copyright (c) 2015, 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 javafx.scene.layout; 27 28 import javafx.geometry.HPos; 29 import javafx.geometry.Insets; 30 import javafx.geometry.VPos; 31 import javafx.scene.Node; 32 import javafx.scene.image.Image; 33 34 public class RegionShim extends Region { 35 36 public static double boundedSize(double min, double pref, double max) { 37 return Region.boundedSize(min, pref, max); 38 } 39 40 public static void addImageListener(Region r, Image image) { 41 r.addImageListener(image); 42 } 43 44 public static double computeChildMaxAreaHeight(Region r, 45 Node child, double maxBaselineComplement, Insets margin, double width) { 46 return r.computeChildMaxAreaHeight(child, maxBaselineComplement, margin, width); 47 } 48 49 public static double computeChildMaxAreaWidth(Region r, 50 Node child, double baselineComplement, 51 Insets margin, double height, boolean fillHeight) { 52 return r.computeChildMaxAreaWidth(child, 53 baselineComplement, margin, height, fillHeight); 54 } 55 56 public static double computeChildMinAreaHeight(Region r, 57 Node child, double minBaselineComplement, 58 Insets margin, double width) { 59 return r.computeChildMinAreaHeight(child, 60 minBaselineComplement, 61 margin, width ); 62 } 63 64 public static double computeChildMinAreaWidth(Region r, 65 Node child, Insets margin) { 66 return r.computeChildMinAreaWidth(child, margin); 67 } 68 69 public static double computeChildMinAreaWidth(Region r, 70 Node child, double baselineComplement, 71 Insets margin, double height, boolean fillHeight) { 72 return r.computeChildMinAreaWidth(child, 73 baselineComplement, 74 margin, height, fillHeight); 75 } 76 77 public static double computeChildPrefAreaHeight(Region r, 78 Node child, Insets margin) { 79 return r.computeChildPrefAreaHeight(child, margin); 80 } 81 82 public static double computeChildPrefAreaHeight(Region r, 83 Node child, double prefBaselineComplement, 84 Insets margin, double width) { 85 return r.computeChildPrefAreaHeight(child, 86 prefBaselineComplement, margin, width); 87 } 88 89 public static double computeChildPrefAreaWidth(Region r, 90 Node child, Insets margin) { 91 return r.computeChildPrefAreaWidth(child, margin); 92 } 93 94 public static double computeChildPrefAreaWidth(Region r, 95 Node child, double baselineComplement, Insets margin, 96 double height, boolean fillHeight) { 97 return r.computeChildPrefAreaWidth(child, baselineComplement, 98 margin, height, fillHeight); 99 } 100 101 public static void layoutInArea(Region r, 102 Node child, double areaX, double areaY, 103 double areaWidth, double areaHeight, 104 double areaBaselineOffset, 105 HPos halignment, VPos valignment) { 106 r.layoutInArea(child, areaX, areaY, 107 areaWidth, areaHeight, areaBaselineOffset, 108 halignment, valignment); 109 } 110 111 public static void layoutInArea(Region r, 112 Node child, double areaX, double areaY, 113 double areaWidth, double areaHeight, 114 double areaBaselineOffset, 115 Insets margin, 116 HPos halignment, VPos valignment) { 117 r.layoutInArea(child, areaX, areaY, 118 areaWidth, areaHeight, 119 areaBaselineOffset, 120 margin, 121 halignment, valignment); 122 } 123 124 public static void layoutInArea(Region r, 125 Node child, double areaX, double areaY, 126 double areaWidth, double areaHeight, 127 double areaBaselineOffset, 128 Insets margin, boolean fillWidth, boolean fillHeight, 129 HPos halignment, VPos valignment) { 130 r.layoutInArea(child, areaX, areaY, 131 areaWidth, areaHeight, 132 areaBaselineOffset, 133 margin, fillWidth, fillHeight, 134 halignment, valignment); 135 136 } 137 138 public static void positionInArea(Region r, 139 Node child, double areaX, double areaY, 140 double areaWidth, double areaHeight, 141 double areaBaselineOffset, HPos halignment, 142 VPos valignment) { 143 r.positionInArea(child, areaX, areaY, 144 areaWidth, areaHeight, 145 areaBaselineOffset, halignment, 146 valignment); 147 } 148 149 public static void removeImageListener(Region r, Image image) { 150 r.addImageListener(image); 151 } 152 153 //---------------------------------------------------------- 154 155 @Override public void addImageListener(Image image) { 156 super.addImageListener(image); 157 } 158 159 @Override public void removeImageListener(Image image) { 160 super.removeImageListener(image); 161 } 162 163 }