com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType Java Examples

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GTKPainter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void paintMenuArrowIcon(SynthContext context, Graphics g,
        int state, int x, int y, int w, int h, ArrowType dir) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), state);
    ShadowType shadow = ShadowType.OUT;
    if (gtkState == SynthConstants.MOUSE_OVER) {
        shadow = ShadowType.IN;
    }
    if (!GTKLookAndFeel.is3()) {
        x += 3;
        y += 3;
        w = h = 7;
    }
    ENGINE.paintArrow(g, context, Region.MENU_ITEM, gtkState, shadow,
            dir, "menuitem", x, y, w, h);
}
 
Example #2
Source File: GTKPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void paintMetacityElement(SynthContext context, Graphics g,
        int gtkState, String detail, int x, int y, int w, int h,
        ShadowType shadow, ArrowType direction) {
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(
                g, x, y, w, h, gtkState, detail, shadow, direction)) {
            ENGINE.startPainting(
                    g, x, y, w, h, gtkState, detail, shadow, direction);
            if (detail == "metacity-arrow") {
                ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, direction, "", x, y, w, h);

            } else if (detail == "metacity-box") {
                ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, "", x, y, w, h);

            } else if (detail == "metacity-vline") {
                ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, "", x, y, w, h);
            }
            ENGINE.finishPainting();
        }
    }
}
 
Example #3
Source File: GTKPainter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void paintRadioButtonMenuItemBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState,
                        shadow, "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example #4
Source File: GTKPainter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example #5
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void paintProgressBarForeground(SynthContext context, Graphics g,
                                        int x, int y, int w, int h,
                                        int orientation) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        // Note that we don't call paintCachedImage() here.  Since the
        // progress bar foreground is painted differently for each value
        // it would be wasteful to try to cache an image for each state,
        // so instead we simply avoid caching in this case.
        if (w <= 0 || h <= 0) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, "fg");
        ENGINE.paintBox(g, context, id, SynthConstants.MOUSE_OVER,
                        ShadowType.OUT, "bar", x, y, w, h);
        ENGINE.finishPainting(false); // don't bother caching the image
    }
}
 
Example #6
Source File: GTKPainter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void paintMenuBarBackground(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)) {
            return;
        }
        GTKStyle style = (GTKStyle)context.getStyle();
        int shadow = style.getClassSpecificIntValue(
                context, "shadow-type", 2);
        ShadowType shadowType = SHADOWS[shadow];
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                id, context.getComponentState());
        ENGINE.startPainting(g, x, y, w, h, id);
        ENGINE.paintBox(g, context, id, gtkState,
            shadowType, "menubar", x, y, w, h);
        ENGINE.finishPainting();
    }
}
 
Example #7
Source File: GTKEngine.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void paintShadow(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType, String detail,
        int x, int y, int w, int h) {

    int gtkState =
        GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int synthState = context.getComponentState();
    Container parent = context.getComponent().getParent();
    if(GTKLookAndFeel.is3()) {
        if (parent != null && parent.getParent() instanceof JComboBox) {
            if (parent.getParent().hasFocus()) {
                synthState |= SynthConstants.FOCUSED;
            }
        }
    }
    int dir = getTextDirection(context);
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
                        x - x0, y - y0, w, h, synthState, dir);
}
 
Example #8
Source File: GTKPainter.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
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();
        }
    }
}
 
Example #9
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void paintRadioButtonMenuItemBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState,
                        shadow, "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example #10
Source File: GTKPainter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void paintMenuItemBackground(SynthContext context,
                                 Graphics g,
                                 int x, int y, int w, int h) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        Region id = Region.MENU_ITEM;
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState, shadow,
                        "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example #11
Source File: GTKPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y,
                        int w, int h) {
    SynthContext context = getContext((JComponent)c);
    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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintShadow(g, context, id, gtkState, ShadowType.ETCHED_IN,
                              "frame", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example #12
Source File: GTKPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example #13
Source File: GTKPainter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y,
                        int w, int h) {
    SynthContext context = getContext((JComponent)c);
    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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintShadow(g, context, id, gtkState, ShadowType.ETCHED_IN,
                              "frame", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example #14
Source File: GTKPainter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void paintToolBarBackground(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);
    int orientation = ((JToolBar)context.getComponent()).getOrientation();
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(g, x, y, w, h, id,
                                      state, orientation))
        {
            ENGINE.startPainting(g, x, y, w, h, id, state, orientation);
            ENGINE.paintBox(g, context, id, gtkState, ShadowType.OUT,
                            "handlebox_bin", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example #15
Source File: GTKPainter.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public void paintPopupMenuBackground(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)) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, gtkState);
        ENGINE.paintBox(g, context, id, gtkState,
                ShadowType.OUT, "menu", x, y, w, h);

        GTKStyle style = (GTKStyle)context.getStyle();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        ENGINE.finishPainting();
    }
}
 
Example #16
Source File: GTKEngine.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public void paintShadow(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType, String detail,
        int x, int y, int w, int h) {

    int gtkState =
        GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int synthState = context.getComponentState();
    Container parent = context.getComponent().getParent();
    if(GTKLookAndFeel.is3()) {
        if (parent != null && parent.getParent() instanceof JComboBox) {
            if (parent.getParent().hasFocus()) {
                synthState |= SynthConstants.FOCUSED;
            }
        }
    }
    int dir = getTextDirection(context);
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
                        x - x0, y - y0, w, h, synthState, dir);
}
 
Example #17
Source File: GTKPainter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example #18
Source File: GTKPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example #19
Source File: GTKEngine.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void paintShadow(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType, String detail,
        int x, int y, int w, int h) {

    int gtkState =
        GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int synthState = context.getComponentState();
    Container parent = context.getComponent().getParent();
    if(GTKLookAndFeel.is3()) {
        if (parent != null && parent.getParent() instanceof JComboBox) {
            if (parent.getParent().hasFocus()) {
                synthState |= SynthConstants.FOCUSED;
            }
        }
    }
    int dir = getTextDirection(context);
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
                        x - x0, y - y0, w, h, synthState, dir);
}
 
Example #20
Source File: GTKPainter.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public void paintRadioButtonBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        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.MOUSE_OVER, ShadowType.ETCHED_OUT,
                        "checkbutton", x, y, w, h, ColorType.BACKGROUND);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example #21
Source File: GTKPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y,
                        int w, int h) {
    SynthContext context = getContext((JComponent)c);
    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)) {
            ENGINE.startPainting(g, x, y, w, h, id);
            ENGINE.paintShadow(g, context, id, gtkState, ShadowType.ETCHED_IN,
                              "frame", x, y, w, h);
            ENGINE.finishPainting();
        }
    }
}
 
Example #22
Source File: GTKPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example #23
Source File: GTKPainter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example #24
Source File: GTKPainter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void paintMetacityElement(SynthContext context, Graphics g,
        int gtkState, String detail, int x, int y, int w, int h,
        ShadowType shadow, ArrowType direction) {
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(
                g, x, y, w, h, gtkState, detail, shadow, direction)) {
            ENGINE.startPainting(
                    g, x, y, w, h, gtkState, detail, shadow, direction);
            if (detail == "metacity-arrow") {
                ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, direction, "", x, y, w, h);

            } else if (detail == "metacity-box") {
                ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, "", x, y, w, h);

            } else if (detail == "metacity-vline") {
                ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, "", x, y, w, h);
            }
            ENGINE.finishPainting();
        }
    }
}
 
Example #25
Source File: GTKPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void paintPopupMenuBackground(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)) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, gtkState);
        ENGINE.paintBox(g, context, id, gtkState,
                ShadowType.OUT, "menu", x, y, w, h);

        GTKStyle style = (GTKStyle)context.getStyle();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        ENGINE.finishPainting();
    }
}
 
Example #26
Source File: GTKPainter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void paintProgressBarForeground(SynthContext context, Graphics g,
                                        int x, int y, int w, int h,
                                        int orientation) {
    Region id = context.getRegion();
    synchronized (UNIXToolkit.GTK_LOCK) {
        // Note that we don't call paintCachedImage() here.  Since the
        // progress bar foreground is painted differently for each value
        // it would be wasteful to try to cache an image for each state,
        // so instead we simply avoid caching in this case.
        if (w <= 0 || h <= 0) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, "fg");
        ENGINE.paintBox(g, context, id, SynthConstants.MOUSE_OVER,
                        ShadowType.OUT, "bar", x, y, w, h);
        ENGINE.finishPainting(false); // don't bother caching the image
    }
}
 
Example #27
Source File: GTKPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void paintMetacityElement(SynthContext context, Graphics g,
        int gtkState, String detail, int x, int y, int w, int h,
        ShadowType shadow, ArrowType direction) {
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (! ENGINE.paintCachedImage(
                g, x, y, w, h, gtkState, detail, shadow, direction)) {
            ENGINE.startPainting(
                    g, x, y, w, h, gtkState, detail, shadow, direction);
            if (detail == "metacity-arrow") {
                ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, direction, "", x, y, w, h);

            } else if (detail == "metacity-box") {
                ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, shadow, "", x, y, w, h);

            } else if (detail == "metacity-vline") {
                ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE,
                        gtkState, "", x, y, w, h);
            }
            ENGINE.finishPainting();
        }
    }
}
 
Example #28
Source File: GTKPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void paintMenuItemBackground(SynthContext context,
                                 Graphics g,
                                 int x, int y, int w, int h) {
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            context.getRegion(), context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        Region id = Region.MENU_ITEM;
        synchronized (UNIXToolkit.GTK_LOCK) {
            if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) {
                ShadowType shadow = (GTKLookAndFeel.is2_2() ?
                    ShadowType.NONE : ShadowType.OUT);
                ENGINE.startPainting(g, x, y, w, h, id);
                ENGINE.paintBox(g, context, id, gtkState, shadow,
                        "menuitem", x, y, w, h);
                ENGINE.finishPainting();
            }
        }
    }
}
 
Example #29
Source File: GTKPainter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void paintMenuBarBackground(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)) {
            return;
        }
        GTKStyle style = (GTKStyle)context.getStyle();
        int shadow = style.getClassSpecificIntValue(
                context, "shadow-type", 2);
        ShadowType shadowType = SHADOWS[shadow];
        int gtkState = GTKLookAndFeel.synthStateToGTKState(
                id, context.getComponentState());
        ENGINE.startPainting(g, x, y, w, h, id);
        ENGINE.paintBox(g, context, id, gtkState,
            shadowType, "menubar", x, y, w, h);
        ENGINE.finishPainting();
    }
}
 
Example #30
Source File: GTKPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void paintRadioButtonBackground(SynthContext context,
                                 Graphics g, int x, int y,
                                 int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    if (gtkState == SynthConstants.MOUSE_OVER) {
        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.MOUSE_OVER, ShadowType.ETCHED_OUT,
                        "checkbutton", x, y, w, h, ColorType.BACKGROUND);
                ENGINE.finishPainting();
            }
        }
    }
}