-
Notifications
You must be signed in to change notification settings - Fork 704
DRAFT adaptive header layout #4980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
* always show the buttons of the toolbar at the right side * at least show one view item for the view (plus the chevron), but if the title is shorter, show more * show as much as possible of the title Issue: #4975
@mierin12 I tried to implement (with the help of Claude Code) the layout. But for whatever reason, every once in a while it does not render right - see screenshot. I also did not test on Linux yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I made two propositions of change, also visible here (easier to see the green/red intended changes): feature/adaptive_header_layout...mierin12:portfolio:pr-4980-fix
I tried a bit on Windows11, it looks ok to me. :) But Linux I do not know, and there may subtle changes that are hard to see, I did not saw the Payment's toolbar being not centered yesterday for example, only today.
int y = marginHeight + (availableHeight - actionSize.y) / 2; | ||
|
||
// title at left | ||
titleLabel.setBounds(marginWidth, y, titleWidth, actionSize.y); | ||
|
||
// Action toolbar at right | ||
int actionX = bounds.width - marginWidth - actionWidth; | ||
actionToolbar.setBounds(actionX, y, actionWidth, actionSize.y); | ||
|
||
// View toolbar between title and action toolbar (right-aligned within | ||
// its space) | ||
int viewX = actionX - HORIZONTAL_SPACING - viewActualWidth; | ||
viewToolbarWrapper.setBounds(viewX, marginHeight, viewActualWidth, availableHeight); | ||
|
||
// Update the view toolbar wrapper's layout with the actual available | ||
// width | ||
if (viewToolbarWrapper.getLayout() instanceof ToolBarPlusChevronLayout layout) | ||
{ | ||
layout.setMaxWidth(viewActualWidth); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int y = marginHeight + (availableHeight - actionSize.y) / 2; | |
// title at left | |
titleLabel.setBounds(marginWidth, y, titleWidth, actionSize.y); | |
// Action toolbar at right | |
int actionX = bounds.width - marginWidth - actionWidth; | |
actionToolbar.setBounds(actionX, y, actionWidth, actionSize.y); | |
// View toolbar between title and action toolbar (right-aligned within | |
// its space) | |
int viewX = actionX - HORIZONTAL_SPACING - viewActualWidth; | |
viewToolbarWrapper.setBounds(viewX, marginHeight, viewActualWidth, availableHeight); | |
// Update the view toolbar wrapper's layout with the actual available | |
// width | |
if (viewToolbarWrapper.getLayout() instanceof ToolBarPlusChevronLayout layout) | |
{ | |
layout.setMaxWidth(viewActualWidth); | |
} | |
var titleSize = titleLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache); | |
var viewSize = viewToolbarWrapper.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache); | |
int yTitle = marginHeight + (availableHeight - titleSize.y) / 2; | |
int yAction = marginHeight + (availableHeight - actionSize.y) / 2; | |
int yView = marginHeight + (availableHeight - viewSize.y) / 2; | |
// title at left | |
titleLabel.setBounds(marginWidth, yTitle, titleWidth, titleSize.y); | |
// Action toolbar at right | |
int actionX = bounds.width - marginWidth - actionWidth; | |
actionToolbar.setBounds(actionX, yAction, actionWidth, actionSize.y); | |
// Update the view toolbar wrapper's layout with the actual available | |
// width | |
if (viewToolbarWrapper.getLayout() instanceof ToolBarPlusChevronLayout layout) | |
{ | |
layout.setMaxWidth(viewActualWidth); | |
} | |
// View toolbar between title and action toolbar (right-aligned within | |
// its space) | |
int viewX = actionX - HORIZONTAL_SPACING - viewActualWidth; | |
viewToolbarWrapper.setBounds(viewX, yView, viewActualWidth, viewSize.y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposition :
- for the height, each one of the 3 should to be centered compared to its own height, here actionSize.y was used for more than the action Toolbar, and viewToolbar not centered. I think this fix the "horizontally cut title" and the not centered viewToolBar in Payment.
- create the viewToolBar after setMaxWidth. I think setMaxWidth itselft does not retrigger a layout update.
Issue: #4975