1 /*
2 * Copyright (c) 2011, 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
98 static final int DOCUMENT_MODAL = 1;
99 static final int APPLICATION_MODAL = 2;
100 static final int TOOLKIT_MODAL = 3;
101
102 // window style bits
103 static final int _RESERVED_FOR_DATA = 1 << 0;
104
105 // corresponds to native style mask bits
106 static final int DECORATED = 1 << 1;
107 static final int TEXTURED = 1 << 2;
108 static final int UNIFIED = 1 << 3;
109 static final int UTILITY = 1 << 4;
110 static final int HUD = 1 << 5;
111 static final int SHEET = 1 << 6;
112
113 static final int CLOSEABLE = 1 << 7;
114 static final int MINIMIZABLE = 1 << 8;
115
116 static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
117 static final int NONACTIVATING = 1 << 24;
118
119 static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
120
121 // corresponds to method-based properties
122 static final int HAS_SHADOW = 1 << 10;
123 static final int ZOOMABLE = 1 << 11;
124
125 static final int ALWAYS_ON_TOP = 1 << 15;
126 static final int HIDES_ON_DEACTIVATE = 1 << 17;
127 static final int DRAGGABLE_BACKGROUND = 1 << 19;
128 static final int DOCUMENT_MODIFIED = 1 << 21;
129 static final int FULLSCREENABLE = 1 << 23;
130
131 static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE;
132
133 // corresponds to callback-based properties
134 static final int SHOULD_BECOME_KEY = 1 << 12;
135 static final int SHOULD_BECOME_MAIN = 1 << 13;
136 static final int MODAL_EXCLUDED = 1 << 16;
137
354 if (prop != null) {
355 styleBits = SET(styleBits, ZOOMABLE, Boolean.parseBoolean(prop.toString()));
356 }
357
358 prop = rootpane.getClientProperty(WINDOW_FULLSCREENABLE);
359 if (prop != null) {
360 styleBits = SET(styleBits, FULLSCREENABLE, Boolean.parseBoolean(prop.toString()));
361 }
362
363 prop = rootpane.getClientProperty(WINDOW_SHADOW);
364 if (prop != null) {
365 styleBits = SET(styleBits, HAS_SHADOW, Boolean.parseBoolean(prop.toString()));
366 }
367
368 prop = rootpane.getClientProperty(WINDOW_DRAGGABLE_BACKGROUND);
369 if (prop != null) {
370 styleBits = SET(styleBits, DRAGGABLE_BACKGROUND, Boolean.parseBoolean(prop.toString()));
371 }
372 }
373
374 peer.setTextured(IS(TEXTURED, styleBits));
375
376 return styleBits;
377 }
378
379 // this is the counter-point to -[CWindow _nativeSetStyleBit:]
380 protected void setStyleBits(final int mask, final boolean value) {
381 nativeSetNSWindowStyleBits(getNSWindowPtr(), mask, value ? mask : 0);
382 }
383
384 private native void _toggleFullScreenMode(final long model);
385
386 public void toggleFullScreen() {
387 _toggleFullScreenMode(getNSWindowPtr());
388 }
389
390 @Override // PlatformWindow
391 public void setMenuBar(MenuBar mb) {
392 final long nsWindowPtr = getNSWindowPtr();
393 CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb);
|
1 /*
2 * Copyright (c) 2011, 2013, 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
98 static final int DOCUMENT_MODAL = 1;
99 static final int APPLICATION_MODAL = 2;
100 static final int TOOLKIT_MODAL = 3;
101
102 // window style bits
103 static final int _RESERVED_FOR_DATA = 1 << 0;
104
105 // corresponds to native style mask bits
106 static final int DECORATED = 1 << 1;
107 static final int TEXTURED = 1 << 2;
108 static final int UNIFIED = 1 << 3;
109 static final int UTILITY = 1 << 4;
110 static final int HUD = 1 << 5;
111 static final int SHEET = 1 << 6;
112
113 static final int CLOSEABLE = 1 << 7;
114 static final int MINIMIZABLE = 1 << 8;
115
116 static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
117 static final int NONACTIVATING = 1 << 24;
118 static final int IS_DIALOG = 1 << 25;
119 static final int IS_MODAL = 1 << 26;
120
121 static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
122
123 // corresponds to method-based properties
124 static final int HAS_SHADOW = 1 << 10;
125 static final int ZOOMABLE = 1 << 11;
126
127 static final int ALWAYS_ON_TOP = 1 << 15;
128 static final int HIDES_ON_DEACTIVATE = 1 << 17;
129 static final int DRAGGABLE_BACKGROUND = 1 << 19;
130 static final int DOCUMENT_MODIFIED = 1 << 21;
131 static final int FULLSCREENABLE = 1 << 23;
132
133 static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE;
134
135 // corresponds to callback-based properties
136 static final int SHOULD_BECOME_KEY = 1 << 12;
137 static final int SHOULD_BECOME_MAIN = 1 << 13;
138 static final int MODAL_EXCLUDED = 1 << 16;
139
356 if (prop != null) {
357 styleBits = SET(styleBits, ZOOMABLE, Boolean.parseBoolean(prop.toString()));
358 }
359
360 prop = rootpane.getClientProperty(WINDOW_FULLSCREENABLE);
361 if (prop != null) {
362 styleBits = SET(styleBits, FULLSCREENABLE, Boolean.parseBoolean(prop.toString()));
363 }
364
365 prop = rootpane.getClientProperty(WINDOW_SHADOW);
366 if (prop != null) {
367 styleBits = SET(styleBits, HAS_SHADOW, Boolean.parseBoolean(prop.toString()));
368 }
369
370 prop = rootpane.getClientProperty(WINDOW_DRAGGABLE_BACKGROUND);
371 if (prop != null) {
372 styleBits = SET(styleBits, DRAGGABLE_BACKGROUND, Boolean.parseBoolean(prop.toString()));
373 }
374 }
375
376 if (isDialog) {
377 styleBits = SET(styleBits, IS_DIALOG, true);
378 if (((Dialog) target).isModal()) {
379 styleBits = SET(styleBits, IS_MODAL, true);
380 }
381 }
382
383 peer.setTextured(IS(TEXTURED, styleBits));
384
385 return styleBits;
386 }
387
388 // this is the counter-point to -[CWindow _nativeSetStyleBit:]
389 protected void setStyleBits(final int mask, final boolean value) {
390 nativeSetNSWindowStyleBits(getNSWindowPtr(), mask, value ? mask : 0);
391 }
392
393 private native void _toggleFullScreenMode(final long model);
394
395 public void toggleFullScreen() {
396 _toggleFullScreenMode(getNSWindowPtr());
397 }
398
399 @Override // PlatformWindow
400 public void setMenuBar(MenuBar mb) {
401 final long nsWindowPtr = getNSWindowPtr();
402 CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb);
|