Re: RFR: 8313424: JavaFX controls in the title bar [v16]

2024-10-31 Thread Michael Strauß
On Mon, 28 Oct 2024 23:46:16 GMT, Andy Goryachev  wrote:

> no flicker on win11, thanks!
> 
> the height of the title bar is slightly off. I think it should be the same as 
> the native title bar of DECORATED window.

This seems to be an artifact of different JavaFX/Windows rendering. If I make 
the title bar just one pixel taller, it is very slightly off in the other 
direction.

-

PR Comment: https://git.openjdk.org/jfx/pull/1605#issuecomment-2450285978


Re: RFR: 8313424: JavaFX controls in the title bar [v16]

2024-10-28 Thread Andy Goryachev
On Mon, 28 Oct 2024 23:08:54 GMT, Michael Strauß  wrote:

>> This PR is a new take on a highly requested feature: JavaFX controls in the 
>> header bar (see also #594 for an earlier iteration).
>> 
>> This is a feature with many possible ways to skin the cat, and it has taken 
>> quite a bit of effort to come up with a good user model. In contrast to the 
>> previous iteration, the focus has shifted from providing an entirely 
>> undecorated window to providing a window with a user-configurable header bar.
>> 
>> The customizable header bar is a new layout container: 
>> `javafx.scene.layout.HeaderBar`. It has three areas that accept child nodes: 
>> leading, center, and trailing.  `HeaderBar` also automatically adjusts for 
>> the placement of the default window buttons (minimize, maximize, close) on 
>> the left or right side of the window.
>> 
>> The customizable header bar is combined with a new `EXTENDED` stage style, 
>> which extends the client area into the header bar area. The new extended 
>> stage style is supported on Windows, macOS, and Linux. For platforms that 
>> don't support this stage style, it automatically downgrades to `DECORATED`.
>> 
>> This is how it looks like on each of the three operating systems:
>> 
>> ![extendedwindow](https://github.com/user-attachments/assets/9d798af6-09f4-4337-8210-6eae91079d3a)
>> 
>> The window buttons (minimize, maximize, close) are provided by JavaFX, not 
>> by the application developer. This makes it easier to get basic window 
>> functionality without recreating the entirety of the window controls for all 
>> platforms.
>> 
>> ## Usage
>> This is a minimal example that uses a custom header bar with a `TextField` 
>> in the center area. `HeaderBar` is usually placed in the top area of a 
>> `BorderPane` root container:
>> 
>> public class MyApp extends Application {
>> @Override
>> public void start(Stage stage) {
>> var headerBar = new HeaderBar();
>> headerBar.setCenter(new TextField());
>> 
>> var root = new BorderPane();
>> root.setTop(headerBar);
>> 
>> stage.setScene(new Scene(root));
>> stage.initStyle(StageStyle.EXTENDED);
>> stage.show();
>> }
>> }
>> 
>> To learn more about the details of the API, refer to the documentation of 
>> `StageStyle.EXTENDED` and `HeaderBar`.
>> 
>> ## Platform integration
>> The implementation varies per platform, and ranges from pretty easy to quite 
>> involved:
>> 1. **macOS**: The window buttons are provided by macOS, we just leave an 
>> empty area where the window buttons will appear. The client area is extended 
>> to cover the entire window by setting the `NSW...
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fix header bar height flicker

no flicker on win11, thanks!

the height of the title bar is slightly off.   I think it should be the same as 
the native title bar of DECORATED window.

-

PR Comment: https://git.openjdk.org/jfx/pull/1605#issuecomment-2442880862


Re: RFR: 8313424: JavaFX controls in the title bar [v16]

2024-10-28 Thread Michael Strauß
> This PR is a new take on a highly requested feature: JavaFX controls in the 
> header bar (see also #594 for an earlier iteration).
> 
> This is a feature with many possible ways to skin the cat, and it has taken 
> quite a bit of effort to come up with a good user model. In contrast to the 
> previous iteration, the focus has shifted from providing an entirely 
> undecorated window to providing a window with a user-configurable header bar.
> 
> The customizable header bar is a new layout container: 
> `javafx.scene.layout.HeaderBar`. It has three areas that accept child nodes: 
> leading, center, and trailing.  `HeaderBar` also automatically adjusts for 
> the placement of the default window buttons (minimize, maximize, close) on 
> the left or right side of the window.
> 
> The customizable header bar is combined with a new `EXTENDED` stage style, 
> which extends the client area into the header bar area. The new extended 
> stage style is supported on Windows, macOS, and Linux. For platforms that 
> don't support this stage style, it automatically downgrades to `DECORATED`.
> 
> This is how it looks like on each of the three operating systems:
> 
> ![extendedwindow](https://github.com/user-attachments/assets/9d798af6-09f4-4337-8210-6eae91079d3a)
> 
> The window buttons (minimize, maximize, close) are provided by JavaFX, not by 
> the application developer. This makes it easier to get basic window 
> functionality without recreating the entirety of the window controls for all 
> platforms.
> 
> ## Usage
> This is a minimal example that uses a custom header bar with a `TextField` in 
> the center area. `HeaderBar` is usually placed in the top area of a 
> `BorderPane` root container:
> 
> public class MyApp extends Application {
> @Override
> public void start(Stage stage) {
> var headerBar = new HeaderBar();
> headerBar.setCenter(new TextField());
> 
> var root = new BorderPane();
> root.setTop(headerBar);
> 
> stage.setScene(new Scene(root));
> stage.initStyle(StageStyle.EXTENDED);
> stage.show();
> }
> }
> 
> To learn more about the details of the API, refer to the documentation of 
> `StageStyle.EXTENDED` and `HeaderBar`.
> 
> ## Platform integration
> The implementation varies per platform, and ranges from pretty easy to quite 
> involved:
> 1. **macOS**: The window buttons are provided by macOS, we just leave an 
> empty area where the window buttons will appear. The client area is extended 
> to cover the entire window by setting the 
> `NSWindowStyleMaskFullSizeContentView` flag. A click-and-drag operation is 
> ini...

Michael Strauß has updated the pull request incrementally with one additional 
commit since the last revision:

  fix header bar height flicker

-

Changes:
  - all: https://git.openjdk.org/jfx/pull/1605/files
  - new: https://git.openjdk.org/jfx/pull/1605/files/804d0be7..f5e3121f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1605&range=15
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1605&range=14-15

  Stats: 3 lines in 1 file changed: 0 ins; 2 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/1605.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1605/head:pull/1605

PR: https://git.openjdk.org/jfx/pull/1605