Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package com.sun.glass.ui;

import javafx.geometry.Dimension2D;
import javafx.scene.layout.HeaderBar;
import javafx.stage.StageStyle;
import java.util.Objects;

Expand All @@ -37,7 +36,6 @@
* @param rightInset the size of the right inset
* @param minHeight the minimum height of the window buttons
* @see HeaderButtonOverlay
* @see HeaderBar
*/
public record HeaderButtonMetrics(Dimension2D leftInset, Dimension2D rightInset, double minHeight) {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package com.sun.javafx.stage;

import javafx.geometry.Dimension2D;
import javafx.scene.layout.HeaderBar;
import javafx.stage.StageStyle;
import java.util.Objects;

/**
* Provides metrics about the header buttons of {@link StageStyle#EXTENDED} windows.
*
* @param leftInset the size of the left inset
* @param rightInset the size of the right inset
* @param minHeight the minimum height of the window buttons
* @see HeaderBar
*/
public record HeaderButtonMetrics(Dimension2D leftInset, Dimension2D rightInset, double minHeight) {

public HeaderButtonMetrics {
Objects.requireNonNull(leftInset);
Objects.requireNonNull(rightInset);

if (minHeight < 0) {
throw new IllegalArgumentException("minHeight cannot be negative");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package com.sun.javafx.stage;

import com.sun.glass.ui.HeaderButtonMetrics;
import com.sun.javafx.util.Utils;
import javafx.beans.value.ObservableValue;
import javafx.stage.Stage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@

package com.sun.javafx.stage;

import com.sun.glass.ui.HeaderButtonMetrics;
import javafx.stage.Stage;


public class StagePeerListener extends WindowPeerListener {
private final Stage stage;
private final StageAccessor stageAccessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.sun.javafx.PlatformUtil;
import com.sun.javafx.iio.common.PushbroomScaler;
import com.sun.javafx.iio.common.ScalerFactory;
import com.sun.javafx.stage.HeaderButtonMetrics;
import com.sun.javafx.stage.StagePeerListener;
import com.sun.javafx.tk.FocusCause;
import com.sun.javafx.tk.TKScene;
Expand Down Expand Up @@ -227,7 +228,9 @@ private void computeAndSetBackground(List<javafx.scene.paint.Stop> stops) {

private void notifyHeaderButtonMetricsChanged() {
if (stageListener instanceof StagePeerListener listener && platformWindow != null) {
listener.changedHeaderButtonMetrics(platformWindow.headerButtonMetricsProperty().get());
var metrics = platformWindow.headerButtonMetricsProperty().get();
listener.changedHeaderButtonMetrics(
new HeaderButtonMetrics(metrics.leftInset(), metrics.rightInset(), metrics.minHeight()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

package javafx.scene.layout;

import com.sun.glass.ui.HeaderButtonMetrics;
import com.sun.javafx.PreviewFeature;
import com.sun.javafx.geom.Vec2d;
import com.sun.javafx.scene.layout.HeaderButtonBehavior;
import com.sun.javafx.stage.HeaderButtonMetrics;
import com.sun.javafx.stage.StageHelper;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.BooleanPropertyBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.HeaderBar;

import com.sun.glass.ui.HeaderButtonMetrics;
import com.sun.javafx.PreviewFeature;
import com.sun.javafx.collections.VetoableListDecorator;
import com.sun.javafx.collections.TrackableObservableList;
import com.sun.javafx.scene.SceneHelper;
import com.sun.javafx.stage.HeaderButtonMetrics;
import com.sun.javafx.stage.StageHelper;
import com.sun.javafx.stage.StagePeerListener;
import com.sun.javafx.tk.TKStage;
Expand Down