Java Code Examples for com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType#NONE

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType#NONE . These examples are extracted from open source projects. 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
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 2
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 3
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 Project: jdk8u60   File: GTKPainter.java    License: GNU General Public License v2.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 5
Source Project: JDKSourceCode1.8   File: GTKPainter.java    License: MIT License 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 6
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 7
Source Project: jdk1.8-source-analysis   File: Metacity.java    License: Apache License 2.0 5 votes vote down vote up
protected void drawGTKBox(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }
    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-box", x, y, w, h, shadowType, null);
}
 
Example 8
protected void drawGTKBox(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }
    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-box", x, y, w, h, shadowType, null);
}
 
Example 9
Source Project: Bytecoder   File: Metacity.java    License: Apache License 2.0 5 votes vote down vote up
protected void drawGTKBox(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }
    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-box", x, y, w, h, shadowType, null);
}
 
Example 10
protected void drawGTKBox(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }
    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-box", x, y, w, h, shadowType, null);
}
 
Example 11
Source Project: jdk8u-jdk   File: Metacity.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected void drawGTKBox(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }
    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-box", x, y, w, h, shadowType, null);
}
 
Example 12
Source Project: JDKSourceCode1.8   File: Metacity.java    License: MIT License 5 votes vote down vote up
protected void drawGTKBox(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }
    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-box", x, y, w, h, shadowType, null);
}
 
Example 13
Source Project: jdk1.8-source-analysis   File: Metacity.java    License: Apache License 2.0 4 votes vote down vote up
protected void drawGTKArrow(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String arrow    = getStringAttr(attrs, "arrow");
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }

    ArrowType direction = null;
    if ("up".equals(arrow)) {
        direction = ArrowType.UP;
    } else if ("down".equals(arrow)) {
        direction = ArrowType.DOWN;
    } else if ("left".equals(arrow)) {
        direction = ArrowType.LEFT;
    } else if ("right".equals(arrow)) {
        direction = ArrowType.RIGHT;
    }

    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-arrow", x, y, w, h, shadowType, direction);
}
 
Example 14
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) {
        if (GTKLookAndFeel.is3() && context.getRegion() == Region.MENU) {
            GTKStyle style = (GTKStyle)context.getStyle();
            Color highlightColor = style.getGTKColor(
                    GTKEngine.WidgetType.MENU_ITEM.ordinal(),
                    gtkState, ColorType.BACKGROUND.getID());
            Color backgroundColor = style.getGTKColor(
                    GTKEngine.WidgetType.MENU_BAR.ordinal(),
                    SynthConstants.ENABLED, ColorType.BACKGROUND.getID());

            int minBrightness = 0, maxBrightness = 255;
            int minBrightnessDifference = 100;
            int actualBrightnessDifference =
                    getMaxColorDiff(highlightColor, backgroundColor);
            if (actualBrightnessDifference < minBrightnessDifference) {
                int highlightBrightness =
                        getBrightness(highlightColor);
                int backgroundBrightness =
                        getBrightness(backgroundColor);
                int originalHighlightBrightness =
                        highlightBrightness;
                if (highlightBrightness >= backgroundBrightness) {
                    if (backgroundBrightness + minBrightnessDifference <=
                            maxBrightness) {
                        highlightBrightness =
                                backgroundBrightness +
                                        minBrightnessDifference;
                    } else {
                        highlightBrightness =
                                backgroundBrightness -
                                        minBrightnessDifference;
                    }
                } else {
                    if (backgroundBrightness - minBrightnessDifference >=
                            minBrightness) {
                        highlightBrightness =
                                backgroundBrightness -
                                        minBrightnessDifference;
                    } else {
                        highlightBrightness =
                                backgroundBrightness +
                                        minBrightnessDifference;
                    }
                }

                g.setColor(deriveColor(highlightColor,
                        originalHighlightBrightness,
                        highlightBrightness));
                g.fillRect(x, y, w, h);
                return;
            }
        }
        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 15
Source Project: jdk8u-jdk   File: Metacity.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected void drawGTKArrow(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String arrow    = getStringAttr(attrs, "arrow");
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }

    ArrowType direction = null;
    if ("up".equals(arrow)) {
        direction = ArrowType.UP;
    } else if ("down".equals(arrow)) {
        direction = ArrowType.DOWN;
    } else if ("left".equals(arrow)) {
        direction = ArrowType.LEFT;
    } else if ("right".equals(arrow)) {
        direction = ArrowType.RIGHT;
    }

    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-arrow", x, y, w, h, shadowType, direction);
}
 
Example 16
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) {
        if (GTKLookAndFeel.is3() && context.getRegion() == Region.MENU) {
            GTKStyle style = (GTKStyle)context.getStyle();
            Color highlightColor = style.getGTKColor(
                    GTKEngine.WidgetType.MENU_ITEM.ordinal(),
                    gtkState, ColorType.BACKGROUND.getID());
            Color backgroundColor = style.getGTKColor(
                    GTKEngine.WidgetType.MENU_BAR.ordinal(),
                    SynthConstants.ENABLED, ColorType.BACKGROUND.getID());

            int minBrightness = 0, maxBrightness = 255;
            int minBrightnessDifference = 100;
            int actualBrightnessDifference =
                    getMaxColorDiff(highlightColor, backgroundColor);
            if (actualBrightnessDifference < minBrightnessDifference) {
                int highlightBrightness =
                        getBrightness(highlightColor);
                int backgroundBrightness =
                        getBrightness(backgroundColor);
                int originalHighlightBrightness =
                        highlightBrightness;
                if (highlightBrightness >= backgroundBrightness) {
                    if (backgroundBrightness + minBrightnessDifference <=
                            maxBrightness) {
                        highlightBrightness =
                                backgroundBrightness +
                                        minBrightnessDifference;
                    } else {
                        highlightBrightness =
                                backgroundBrightness -
                                        minBrightnessDifference;
                    }
                } else {
                    if (backgroundBrightness - minBrightnessDifference >=
                            minBrightness) {
                        highlightBrightness =
                                backgroundBrightness -
                                        minBrightnessDifference;
                    } else {
                        highlightBrightness =
                                backgroundBrightness +
                                        minBrightnessDifference;
                    }
                }

                g.setColor(deriveColor(highlightColor,
                        originalHighlightBrightness,
                        highlightBrightness));
                g.fillRect(x, y, w, h);
                return;
            }
        }
        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 17
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) {
        if (GTKLookAndFeel.is3() && context.getRegion() == Region.MENU) {
            GTKStyle style = (GTKStyle)context.getStyle();
            Color highlightColor = style.getGTKColor(
                    GTKEngine.WidgetType.MENU_ITEM.ordinal(),
                    gtkState, ColorType.BACKGROUND.getID());
            Color backgroundColor = style.getGTKColor(
                    GTKEngine.WidgetType.MENU_BAR.ordinal(),
                    SynthConstants.ENABLED, ColorType.BACKGROUND.getID());

            int minBrightness = 0, maxBrightness = 255;
            int minBrightnessDifference = 100;
            int actualBrightnessDifference =
                    getMaxColorDiff(highlightColor, backgroundColor);
            if (actualBrightnessDifference < minBrightnessDifference) {
                int highlightBrightness =
                        getBrightness(highlightColor);
                int backgroundBrightness =
                        getBrightness(backgroundColor);
                int originalHighlightBrightness =
                        highlightBrightness;
                if (highlightBrightness >= backgroundBrightness) {
                    if (backgroundBrightness + minBrightnessDifference <=
                            maxBrightness) {
                        highlightBrightness =
                                backgroundBrightness +
                                        minBrightnessDifference;
                    } else {
                        highlightBrightness =
                                backgroundBrightness -
                                        minBrightnessDifference;
                    }
                } else {
                    if (backgroundBrightness - minBrightnessDifference >=
                            minBrightness) {
                        highlightBrightness =
                                backgroundBrightness -
                                        minBrightnessDifference;
                    } else {
                        highlightBrightness =
                                backgroundBrightness +
                                        minBrightnessDifference;
                    }
                }

                g.setColor(deriveColor(highlightColor,
                        originalHighlightBrightness,
                        highlightBrightness));
                g.fillRect(x, y, w, h);
                return;
            }
        }
        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 18
Source Project: jdk8u60   File: Metacity.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected void drawGTKArrow(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String arrow    = getStringAttr(attrs, "arrow");
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }

    ArrowType direction = null;
    if ("up".equals(arrow)) {
        direction = ArrowType.UP;
    } else if ("down".equals(arrow)) {
        direction = ArrowType.DOWN;
    } else if ("left".equals(arrow)) {
        direction = ArrowType.LEFT;
    } else if ("right".equals(arrow)) {
        direction = ArrowType.RIGHT;
    }

    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-arrow", x, y, w, h, shadowType, direction);
}
 
Example 19
Source Project: Bytecoder   File: Metacity.java    License: Apache License 2.0 4 votes vote down vote up
protected void drawGTKArrow(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String arrow    = getStringAttr(attrs, "arrow");
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }

    ArrowType direction = null;
    if ("up".equals(arrow)) {
        direction = ArrowType.UP;
    } else if ("down".equals(arrow)) {
        direction = ArrowType.DOWN;
    } else if ("left".equals(arrow)) {
        direction = ArrowType.LEFT;
    } else if ("right".equals(arrow)) {
        direction = ArrowType.RIGHT;
    }

    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-arrow", x, y, w, h, shadowType, direction);
}
 
Example 20
Source Project: JDKSourceCode1.8   File: Metacity.java    License: MIT License 4 votes vote down vote up
protected void drawGTKArrow(Node node, Graphics g) {
    NamedNodeMap attrs = node.getAttributes();
    String arrow    = getStringAttr(attrs, "arrow");
    String shadow   = getStringAttr(attrs, "shadow");
    String stateStr = getStringAttr(attrs, "state").toUpperCase();
    int x = aee.evaluate(getStringAttr(attrs, "x"));
    int y = aee.evaluate(getStringAttr(attrs, "y"));
    int w = aee.evaluate(getStringAttr(attrs, "width"));
    int h = aee.evaluate(getStringAttr(attrs, "height"));

    int state = -1;
    if ("NORMAL".equals(stateStr)) {
        state = ENABLED;
    } else if ("SELECTED".equals(stateStr)) {
        state = SELECTED;
    } else if ("INSENSITIVE".equals(stateStr)) {
        state = DISABLED;
    } else if ("PRELIGHT".equals(stateStr)) {
        state = MOUSE_OVER;
    }

    ShadowType shadowType = null;
    if ("in".equals(shadow)) {
        shadowType = ShadowType.IN;
    } else if ("out".equals(shadow)) {
        shadowType = ShadowType.OUT;
    } else if ("etched_in".equals(shadow)) {
        shadowType = ShadowType.ETCHED_IN;
    } else if ("etched_out".equals(shadow)) {
        shadowType = ShadowType.ETCHED_OUT;
    } else if ("none".equals(shadow)) {
        shadowType = ShadowType.NONE;
    }

    ArrowType direction = null;
    if ("up".equals(arrow)) {
        direction = ArrowType.UP;
    } else if ("down".equals(arrow)) {
        direction = ArrowType.DOWN;
    } else if ("left".equals(arrow)) {
        direction = ArrowType.LEFT;
    } else if ("right".equals(arrow)) {
        direction = ArrowType.RIGHT;
    }

    GTKPainter.INSTANCE.paintMetacityElement(context, g, state,
            "metacity-arrow", x, y, w, h, shadowType, direction);
}