📄 gtkpainter.java
字号:
w - 2 * focusSize, h - 2 * focusSize); if (focused) { ENGINE.paintFocus(g, context, id, SynthConstants.ENABLED, "trough", x, y, w, h); } ENGINE.finishPainting(); } } } public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int dir) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir)) { Orientation orientation = (dir == JSlider.HORIZONTAL ? Orientation.HORIZONTAL : Orientation.VERTICAL); String detail = (dir == JSlider.HORIZONTAL ? "hscale" : "vscale"); ENGINE.startPainting(g, x, y, w, h, id, gtkState, dir); ENGINE.paintSlider(g, context, id, gtkState, ShadowType.OUT, detail, x, y, w, h, orientation); ENGINE.finishPainting(); } } } // // SPINNER // public void paintSpinnerBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // This is handled in paintTextFieldBackground } // // SPLIT_PANE_DIVIDER // public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); JSplitPane splitPane = (JSplitPane)context.getComponent(); Orientation orientation = (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? Orientation.VERTICAL : Orientation.HORIZONTAL); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, orientation)) { ENGINE.startPainting(g, x, y, w, h, id, gtkState, orientation); ENGINE.paintHandle(g, context, id, gtkState, ShadowType.OUT, "paned", x, y, w, h, orientation); ENGINE.finishPainting(); } } } public void paintSplitPaneDragDivider(SynthContext context, Graphics g,int x, int y, int w, int h, int orientation) { paintSplitPaneDividerForeground(context, g, x, y, w, h, orientation); } public void paintTabbedPaneContentBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { JTabbedPane pane = (JTabbedPane)context.getComponent(); int selectedIndex = pane.getSelectedIndex(); PositionType placement = GTKLookAndFeel.SwingOrientationConstantToGTK( pane.getTabPlacement()); int gapStart = 0; int gapSize = 0; if (selectedIndex != -1) { Rectangle tabBounds = pane.getBoundsAt(selectedIndex); if (placement == PositionType.TOP || placement == PositionType.BOTTOM) { gapStart = tabBounds.x - 1; gapSize = tabBounds.width; } else { gapStart = tabBounds.y - 1; gapSize = tabBounds.height; } } Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, placement, gapStart, gapSize)) { ENGINE.startPainting(g, x, y, w, h, id, gtkState, placement, gapStart, gapSize); ENGINE.paintBoxGap(g, context, id, gtkState, ShadowType.OUT, "notebook", x, y, w, h, placement, gapStart, gapSize); ENGINE.finishPainting(); } } } public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) { Region id = context.getRegion(); int state = context.getComponentState(); int gtkState = ((state & SynthConstants.SELECTED) != 0 ? SynthConstants.ENABLED : SynthConstants.PRESSED); JTabbedPane pane = (JTabbedPane)context.getComponent(); int placement = pane.getTabPlacement(); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, placement, tabIndex)) { PositionType side = POSITIONS[placement - 1]; ENGINE.startPainting(g, x, y, w, h, id, gtkState, placement, tabIndex); ENGINE.paintExtension(g, context, id, gtkState, ShadowType.OUT, "tab", x, y, w, h, side, tabIndex); ENGINE.finishPainting(); } } } // // TEXT_AREA // public void paintTextAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // Does not call into ENGINE for better performance fillArea(context, g, x, y, w, h, GTKColorType.TEXT_BACKGROUND); } // // TEXT_FIELD // // NOTE: Combobox and Label, Password and FormattedTextField calls this // too. private void paintTextBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND. JComponent c = context.getComponent(); GTKStyle style = (GTKStyle)context.getStyle(); if (c.isOpaque() && c.getBackground() instanceof ColorUIResource) { g.setColor(style.getGTKColor(context, SynthConstants.ENABLED, GTKColorType.TEXT_BACKGROUND)); g.fillRect(x, y, w, h); } Region id = context.getRegion(); int state = context.getComponentState(); synchronized (UNIXToolkit.GTK_LOCK) { if (ENGINE.paintCachedImage(g, x, y, w, h, id, state)) { return; } int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); int focusSize = 0; boolean interiorFocus = style.getClassSpecificBoolValue( context, "interior-focus", true); if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) { focusSize = style.getClassSpecificIntValue(context, "focus-line-width",1); x += focusSize; y += focusSize; w -= 2 * focusSize; h -= 2 * focusSize; } int xThickness = style.getXThickness(); int yThickness = style.getYThickness(); ENGINE.startPainting(g, x, y, w, h, id, state); ENGINE.paintShadow(g, context, id, SynthConstants.ENABLED, ShadowType.IN, "entry", x, y, w, h); ENGINE.paintFlatBox(g, context, id, SynthConstants.ENABLED, ShadowType.NONE, "entry_bg", x + xThickness, y + yThickness, w - (2 * xThickness), h - (2 * yThickness), ColorType.TEXT_BACKGROUND); if (focusSize > 0) { x -= focusSize; y -= focusSize; w += 2 * focusSize; h += 2 * focusSize; ENGINE.paintFocus(g, context, id, gtkState, "entry", x, y, w, h); } ENGINE.finishPainting(); } } private void paintTreeCellEditorBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState)) { ENGINE.startPainting(g, x, y, w, h, id, gtkState); ENGINE.paintFlatBox(g, context, id, gtkState, ShadowType.NONE, "entry_bg", x, y, w, h, ColorType.TEXT_BACKGROUND); ENGINE.finishPainting(); } } } // // ROOT_PANE // public void paintRootPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // Does not call into ENGINE for better performance fillArea(context, g, x, y, w, h, GTKColorType.BACKGROUND); } // // TOGGLE_BUTTON // public void paintToggleButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); JToggleButton toggleButton = (JToggleButton)context.getComponent(); boolean paintBG = toggleButton.isContentAreaFilled() && toggleButton.isBorderPainted(); boolean paintFocus = toggleButton.isFocusPainted(); boolean toolButton = (toggleButton.getParent() instanceof JToolBar); paintButtonBackgroundImpl(context, g, id, "button", x, y, w, h, paintBG, paintFocus, false, toolButton); } // // SCROLL_BAR // public void paintScrollBarBackground(SynthContext context, Graphics g, int x, int y, int w,int h) { Region id = context.getRegion(); boolean focused = (context.getComponentState() & SynthConstants.FOCUSED) != 0; synchronized (UNIXToolkit.GTK_LOCK) { if (ENGINE.paintCachedImage(g, x, y, w, h, id, focused)) { return; } ENGINE.startPainting(g, x, y, w, h, id, focused); GTKStyle style = (GTKStyle)context.getStyle(); int focusSize = style.getClassSpecificIntValue( context, "focus-line-width",1); int focusPad = style.getClassSpecificIntValue( context, "focus-padding", 1); int totalFocus = focusSize + focusPad; ENGINE.paintBox(g, context, id, SynthConstants.PRESSED, ShadowType.IN, "trough", x + totalFocus, y + totalFocus, w - 2 * totalFocus, h - 2 * totalFocus); if (focused) { ENGINE.paintFocus(g, context, id, SynthConstants.ENABLED, "trough", x, y, w, h); } ENGINE.finishPainting(); } } // // SCROLL_BAR_THUMB // public void paintScrollBarThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int dir) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir)) { ENGINE.startPainting(g, x, y, w, h, id, gtkState, dir); Orientation orientation = (dir == JScrollBar.HORIZONTAL ? Orientation.HORIZONTAL : Orientation.VERTICAL); ENGINE.paintSlider(g, context, id, gtkState, ShadowType.OUT, "slider", x, y, w, h, orientation); ENGINE.finishPainting(); } } } // // TOOL_TIP // public void paintToolTipBackground(SynthContext context, Graphics g, int x, int y, int w,int h) { Region id = context.getRegion(); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) { ENGINE.startPainting(g, x, y, w, h, id); ENGINE.paintFlatBox(g, context, id, SynthConstants.ENABLED, ShadowType.OUT, "tooltip", x, y, w, h, ColorType.BACKGROUND); ENGINE.finishPainting(); } } } // // TREE_CELL // public void paintTreeCellBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int state = context.getComponentState(); int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state)) { ENGINE.startPainting(g, x, y, w, h, id, state); // the string arg should alternate based on row being painted, // but we currently don't pass that in. ENGINE.paintFlatBox(g, context, id, gtkState, ShadowType.NONE, "cell_odd", x, y, w, h, ColorType.TEXT_BACKGROUND); ENGINE.finishPainting(); } } } public void paintTreeCellFocus(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = Region.TREE_CELL; int state = context.getComponentState(); paintFocus(context, g, id, state, "treeview", x, y, w, h); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -