1 /*
2 * Copyright (c) 2002, 2014, 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
1062 return peer;
1063 }
1064
1065 private static Boolean sunAwtDisableGtkFileDialogs = null;
1066
1067 /**
1068 * Returns the value of "sun.awt.disableGtkFileDialogs" property. Default
1069 * value is {@code false}.
1070 */
1071 public synchronized static boolean getSunAwtDisableGtkFileDialogs() {
1072 if (sunAwtDisableGtkFileDialogs == null) {
1073 sunAwtDisableGtkFileDialogs = AccessController.doPrivileged(
1074 new GetBooleanAction("sun.awt.disableGtkFileDialogs"));
1075 }
1076 return sunAwtDisableGtkFileDialogs.booleanValue();
1077 }
1078
1079 public FileDialogPeer createFileDialog(FileDialog target) {
1080 FileDialogPeer peer = null;
1081 // The current GtkFileChooser is available from GTK+ 2.4
1082 if (!getSunAwtDisableGtkFileDialogs() && checkGtkVersion(2, 4, 0)) {
1083 peer = new GtkFileDialogPeer(target);
1084 } else {
1085 peer = new XFileDialogPeer(target);
1086 }
1087 targetCreatedPeer(target, peer);
1088 return peer;
1089 }
1090
1091 public MenuBarPeer createMenuBar(MenuBar target) {
1092 XMenuBarPeer peer = new XMenuBarPeer(target);
1093 targetCreatedPeer(target, peer);
1094 return peer;
1095 }
1096
1097 public MenuPeer createMenu(Menu target) {
1098 XMenuPeer peer = new XMenuPeer(target);
1099 //vb157120: looks like we don't need to map menu items
1100 //in new menus implementation
1101 //targetCreatedPeer(target, peer);
1102 return peer;
|
1 /*
2 * Copyright (c) 2002, 2018, 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
1062 return peer;
1063 }
1064
1065 private static Boolean sunAwtDisableGtkFileDialogs = null;
1066
1067 /**
1068 * Returns the value of "sun.awt.disableGtkFileDialogs" property. Default
1069 * value is {@code false}.
1070 */
1071 public synchronized static boolean getSunAwtDisableGtkFileDialogs() {
1072 if (sunAwtDisableGtkFileDialogs == null) {
1073 sunAwtDisableGtkFileDialogs = AccessController.doPrivileged(
1074 new GetBooleanAction("sun.awt.disableGtkFileDialogs"));
1075 }
1076 return sunAwtDisableGtkFileDialogs.booleanValue();
1077 }
1078
1079 public FileDialogPeer createFileDialog(FileDialog target) {
1080 FileDialogPeer peer = null;
1081 // The current GtkFileChooser is available from GTK+ 2.4
1082 if (!getSunAwtDisableGtkFileDialogs() &&
1083 (checkGtkVersion(2, 4, 0) || checkGtkVersion(3, 0, 0))) {
1084 peer = new GtkFileDialogPeer(target);
1085 } else {
1086 peer = new XFileDialogPeer(target);
1087 }
1088 targetCreatedPeer(target, peer);
1089 return peer;
1090 }
1091
1092 public MenuBarPeer createMenuBar(MenuBar target) {
1093 XMenuBarPeer peer = new XMenuBarPeer(target);
1094 targetCreatedPeer(target, peer);
1095 return peer;
1096 }
1097
1098 public MenuPeer createMenu(Menu target) {
1099 XMenuPeer peer = new XMenuPeer(target);
1100 //vb157120: looks like we don't need to map menu items
1101 //in new menus implementation
1102 //targetCreatedPeer(target, peer);
1103 return peer;
|