Tab button bar for Libraries, Modes, Tools, and Updates, across the top of the Contribution Manager. Tab content is in ContributionTab. Most of the sizing dimensions are identical to EditorHeader.
| 50 | * Most of the sizing dimensions are identical to EditorHeader. |
| 51 | */ |
| 52 | public class ManagerTabs extends Box { |
| 53 | // height of this tab bar |
| 54 | static final int HIGH = Toolkit.zoom(31); |
| 55 | |
| 56 | // amount of space around the entire window |
| 57 | static final int BORDER = Toolkit.zoom(8); |
| 58 | |
| 59 | static final int CURVE_RADIUS = Toolkit.zoom(6); |
| 60 | |
| 61 | // amount of extra space between individual tabs |
| 62 | static final int TAB_BETWEEN = Toolkit.zoom(2); |
| 63 | // amount of margin on the left/right for the text on the tab |
| 64 | static final int MARGIN = Toolkit.zoom(13); |
| 65 | |
| 66 | static final int UNSELECTED = 0; |
| 67 | static final int SELECTED = 1; |
| 68 | |
| 69 | Color[] textColor = new Color[2]; |
| 70 | Color[] tabColor = new Color[2]; |
| 71 | |
| 72 | List<Tab> tabList = new ArrayList<>(); |
| 73 | |
| 74 | Font font; |
| 75 | int fontAscent; |
| 76 | |
| 77 | Image gradient; |
| 78 | |
| 79 | JPanel cardPanel; |
| 80 | CardLayout cardLayout; |
| 81 | Controller controller; |
| 82 | |
| 83 | Component currentPanel; |
| 84 | |
| 85 | |
| 86 | public ManagerTabs() { |
| 87 | super(BoxLayout.Y_AXIS); |
| 88 | |
| 89 | updateTheme(); |
| 90 | |
| 91 | setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER)); |
| 92 | |
| 93 | controller = new Controller(); |
| 94 | add(controller); |
| 95 | |
| 96 | cardLayout = new CardLayout(); |
| 97 | cardPanel = new JPanel(cardLayout); |
| 98 | add(cardPanel); |
| 99 | } |
| 100 | |
| 101 | |
| 102 | protected void updateTheme() { |
| 103 | textColor[SELECTED] = Theme.getColor("manager.tab.text.selected.color"); |
| 104 | textColor[UNSELECTED] = Theme.getColor("manager.tab.text.unselected.color"); |
| 105 | font = Theme.getFont("manager.tab.text.font"); |
| 106 | |
| 107 | tabColor[SELECTED] = Theme.getColor("manager.tab.selected.color"); |
| 108 | tabColor[UNSELECTED] = Theme.getColor("manager.tab.unselected.color"); |
| 109 |