Skip to content

Commit

Permalink
Use proper title bar and non caption nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Nov 25, 2023
1 parent 6b577f7 commit 706f413
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Slf4j
@RequiredArgsConstructor
public class HeaderBarController implements Controller<Node> {
public class HeaderBarController implements Controller<HBox> {

private static final PseudoClass HIGHLIGHTED = PseudoClass.getPseudoClass("highlighted");

private final EventBus eventBus;
private final FxApplicationThreadExecutor fxApplicationThreadExecutor;

public MenuButton mainMenuButton;
public HBox mainHeader;
public ToggleButton newsButton;
public ToggleButton chatButton;
Expand All @@ -52,6 +53,7 @@ public class HeaderBarController implements Controller<Node> {
public ToggleButton unitsButton;
public ToggleGroup mainNavigation;
public Pane leftMenuPane;
public Pane rightMenuPane;
/** Dropdown for when there is not enough room for all navigation buttons to be displayed. */
public MenuButton navigationDropdown;

Expand Down Expand Up @@ -140,4 +142,8 @@ public void onNavigateButtonClicked(ActionEvent event) {
private NavigationItem getSelectedNavigationItem() {
return navigationItemMap.get((ToggleButton) mainNavigation.getSelectedToggle());
}

public List<Node> getNonCaptionNodes() {
return List.of(leftMenuPane, navigationDropdown, rightMenuPane, mainMenuButton);

Check warning on line 147 in src/main/java/com/faforever/client/headerbar/HeaderBarController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/faforever/client/headerbar/HeaderBarController.java#L147

Added line #L147 was not covered by tests
}
}
7 changes: 4 additions & 3 deletions src/main/java/com/faforever/client/main/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.faforever.client.fx.Controller;
import com.faforever.client.fx.FxApplicationThreadExecutor;
import com.faforever.client.fx.JavaFxUtil;
import com.faforever.client.headerbar.HeaderBarController;
import com.faforever.client.i18n.I18n;
import com.faforever.client.login.LoginController;
import com.faforever.client.main.event.NavigateEvent;
Expand Down Expand Up @@ -98,11 +99,11 @@ public class MainController implements Controller<Node>, InitializingBean {
private final ChangeListener<Path> backgroundImageListener = (observable, oldValue, newValue) ->
setBackgroundImage(newValue);

public Pane mainHeaderPane;
public Pane contentPane;
public StackPane contentWrapperPane;
public StackPane mainRoot;
public HBox headerBar;
public HeaderBarController headerBarController;

@VisibleForTesting
protected Popup transientNotificationsPopup;
Expand Down Expand Up @@ -306,8 +307,8 @@ private void enterLoggedInState() {
stage.setTitle(clientProperties.getMainWindowTitle());

fxStage.setContent(getRoot());
fxStage.getNonCaptionNodes().setAll(headerBar.getChildren());
fxStage.setTitleBar(mainHeaderPane);
fxStage.getNonCaptionNodes().setAll(headerBarController.getNonCaptionNodes());
fxStage.setTitleBar(headerBar);

Check warning on line 311 in src/main/java/com/faforever/client/main/MainController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/faforever/client/main/MainController.java#L310-L311

Added lines #L310 - L311 were not covered by tests

openStartTab();
});
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/theme/headerbar/header_bar.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
fx:id="mainHeader" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity"
styleClass="main-navigation-top">
<children>
<fx:include source="main_menu_button.fxml"/>
<fx:include fx:id="mainMenuButton" source="main_menu_button.fxml"/>
<HBox fx:id="leftMenuPane" minWidth="10.0">
<children>
<fx:define>
Expand Down Expand Up @@ -46,7 +46,7 @@
</HBox>
<MenuButton fx:id="navigationDropdown" minHeight="-Infinity" minWidth="-Infinity"/>
<Pane maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS"/>
<HBox alignment="TOP_RIGHT" maxHeight="-Infinity" minHeight="-Infinity"
<HBox fx:id="rightMenuPane" alignment="TOP_RIGHT" maxHeight="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" styleClass="right-menu">
<children>
<fx:include source="notification_button.fxml"/>
Expand Down

0 comments on commit 706f413

Please sign in to comment.