RobertBColton / DockFX

A fully featured docking library for the JavaFX platform.
Mozilla Public License 2.0
278 stars 106 forks source link

DockTitleBar should be highlighted when it has focus #17

Open jasons2000 opened 8 years ago

jasons2000 commented 8 years ago

DockTitleBar should be highlighted when it has focus, or when one of its subcomponents has focus. Similar to has Tabs have focus in a TabPane.

jasons2000 commented 8 years ago

just to add, it should probably use the same highlighting effect as used with the TabPane when selecting Tabs

RobertBColton commented 8 years ago

The reason why I did not initially add focus indication is because I was following the Qt Framework docking examples which do not indicate when the title bars have focus. I do see that Unity3D and Visual Studio do indicate the focused dock whether it is a tab or single dock node. Further, both of them use the same focus indication for a single dock node as they do for a tab. In the case of the Unity3D editor though, the dock title area is always drawn as a tab, even when it is by itself.

As a temporary work around you can add the following line to DockTitleBar.java:

this.setFocusTraversable(true);

And add the following in the mouse event handler for the left button of that class:

this.requestFocus();

And style it like this in your stylesheet:

.dock-title-bar:focused {
  -fx-background-color: red;
}
jasons2000 commented 8 years ago

The JIDE framework used to do this. Personally I think this looks better and draws the eye to the focused window.

Also, with JIDE you could optionally have a single tab dock node appear as a tab or regular window. I personally don’t like the single tab look, the ClearControl fork has got this working I think, although its not optional.

------ Original Message ------ From: "Robert B Colton" notifications@github.com To: "RobertBColton/DockFX" DockFX@noreply.github.com Cc: "jasons2000" jshattu@gmail.com; "Author" author@noreply.github.com Sent: 14/05/2016 11:14:02 Subject: Re: [RobertBColton/DockFX] DockTitleBar should be highlighted when it has focus (#17)

The reason why I did not initially add focus indication is because I following the Qt Framework docking examples which do not indicate when the title bars have focus. I do see that Unity3D and Visual Studio do indicate the focused dock whether it is a tab or single dock node. Further, both of them use the same focus indication for a single dock node as they do for a tab. In the case of the Unity3D editor though, the dock title area is always drawn as a tab, even when it is by itself.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

RobertBColton commented 8 years ago

Yes I kind of like having the indication myself too, it feels awkward without it and originally I did want to add it. This will take me some time to go read more about the best way to handle the focus. For example, when you actually hit the literal tab key in Visual Studio it only cycles the components on the currently selected dock, so the above will not behave the same as VS. JIDE also seems to be similar to Unity3D in that regard, and I also am not a fan. Visual Studio is my favorite program with docking.