!157 完善标签页右键菜单的图标支持

Merge pull request !157 from 格物方能致知/develop
This commit is contained in:
格物方能致知 2023-10-08 14:58:29 +00:00 committed by Gitee
commit 48589365b7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 15 additions and 0 deletions

View File

@ -324,6 +324,11 @@ public class TabUtil {
CenterTabPaneManager.getInstance().addNewTab(tab);
}
/**
* Updates the context menu for a given tab in the center tab pane.
*
* @param tab The tab for which the context menu is being updated.
*/
public static void updateTabContextMenu(CenterTab tab) {
ContextMenuBuilder builder = new ContextMenuBuilder();
CenterTabPaneManager centerTabPaneManager = CenterTabPaneManager.getInstance();

View File

@ -14,12 +14,15 @@ import org.jcnc.jnotepad.util.PopUpUtil;
import org.jcnc.jnotepad.views.root.center.main.center.tab.CenterTab;
import org.jcnc.jnotepad.views.root.center.main.center.tab.CenterTabPane;
import org.jcnc.jnotepad.views.root.top.menubar.TopMenuBar;
import org.kordamp.ikonli.javafx.FontIcon;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static org.kordamp.ikonli.antdesignicons.AntDesignIconsFilled.PUSHPIN;
/**
* 中心标签页窗格管理类
*
@ -305,6 +308,13 @@ public class CenterTabPaneManager {
*/
public void updateTabPinnedState(CenterTab tab, CheckMenuItem checkMenuItem) {
tab.setFixed(!tab.isFixed());
if (tab.isFixed()) {
FontIcon icon = FontIcon.of(PUSHPIN);
icon.setRotate(-45);
tab.setGraphic(icon);
} else {
tab.setGraphic(new FontIcon());
}
checkMenuItem.setSelected(tab.isFixed());
}