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

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKConstants.PositionType. 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 jdk8u-jdk 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 #2
Source File: GTKPainter.java    From openjdk-jdk8u-backup 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 #3
Source File: GTKPainter.java    From JDKSourceCode1.8 with MIT License 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 #4
Source File: GTKPainter.java    From openjdk-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 jdk8u60 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 #6
Source File: GTKPainter.java    From jdk8u_jdk 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 #7
Source File: GTKPainter.java    From hottub 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 #8
Source File: GTKPainter.java    From Bytecoder with Apache License 2.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 #9
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 #10
Source File: GTKPainter.java    From openjdk-8-source 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 #11
Source File: GTKPainter.java    From openjdk-jdk8u 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 #12
Source File: GTKPainter.java    From dragonwell8_jdk 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 #13
Source File: GTKPainter.java    From jdk8u-jdk 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 #14
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 #15
Source File: GTKPainter.java    From jdk8u-dev-jdk 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 #16
Source File: GTKPainter.java    From jdk1.8-source-analysis with Apache License 2.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 #17
Source File: GTKEngine.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintExtension(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType, String detail,
        int x, int y, int w, int h, PositionType placement, int tabIndex) {

    state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_extension(widget, state, shadowType.ordinal(), detail,
                           x - x0, y - y0, w, h, placement.ordinal());
}
 
Example #18
Source File: GTKEngine.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void paintBoxGap(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType,
        String detail, int x, int y, int w, int h,
        PositionType boxGapType, int tabBegin, int size) {

    state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_box_gap(widget, state, shadowType.ordinal(), detail,
            x - x0, y - y0, w, h, boxGapType.ordinal(), tabBegin, size);
}
 
Example #19
Source File: GTKPainter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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 - x;
            gapSize = tabBounds.width;
        }
        else {
            gapStart = tabBounds.y - y;
            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();
        }
    }
}
 
Example #20
Source File: GTKPainter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 - x;
            gapSize = tabBounds.width;
        }
        else {
            gapStart = tabBounds.y - y;
            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();
        }
    }
}
 
Example #21
Source File: GTKLookAndFeel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps a swing constant to a GTK constant.
 */
static PositionType SwingOrientationConstantToGTK(int side) {
    switch (side) {
    case SwingConstants.LEFT:
        return PositionType.LEFT;
    case SwingConstants.RIGHT:
        return PositionType.RIGHT;
    case SwingConstants.TOP:
        return PositionType.TOP;
    case SwingConstants.BOTTOM:
        return PositionType.BOTTOM;
    }
    assert false : "Unknown orientation: " + side;
    return PositionType.TOP;
}
 
Example #22
Source File: GTKLookAndFeel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps a swing constant to a GTK constant.
 */
static PositionType SwingOrientationConstantToGTK(int side) {
    switch (side) {
    case SwingConstants.LEFT:
        return PositionType.LEFT;
    case SwingConstants.RIGHT:
        return PositionType.RIGHT;
    case SwingConstants.TOP:
        return PositionType.TOP;
    case SwingConstants.BOTTOM:
        return PositionType.BOTTOM;
    }
    assert false : "Unknown orientation: " + side;
    return PositionType.TOP;
}
 
Example #23
Source File: GTKEngine.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void paintExtension(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType, String detail,
        int x, int y, int w, int h, PositionType placement, int tabIndex) {

    state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_extension(widget, state, shadowType.ordinal(), detail,
                           x - x0, y - y0, w, h, placement.ordinal());
}
 
Example #24
Source File: GTKEngine.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void paintBoxGap(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType,
        String detail, int x, int y, int w, int h,
        PositionType boxGapType, int tabBegin, int size) {

    state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_box_gap(widget, state, shadowType.ordinal(), detail,
            x - x0, y - y0, w, h, boxGapType.ordinal(), tabBegin, size);
}
 
Example #25
Source File: GTKPainter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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 - x;
            gapSize = tabBounds.width;
        }
        else {
            gapStart = tabBounds.y - y;
            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();
        }
    }
}
 
Example #26
Source File: GTKLookAndFeel.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps a swing constant to a GTK constant.
 */
static PositionType SwingOrientationConstantToGTK(int side) {
    switch (side) {
    case SwingConstants.LEFT:
        return PositionType.LEFT;
    case SwingConstants.RIGHT:
        return PositionType.RIGHT;
    case SwingConstants.TOP:
        return PositionType.TOP;
    case SwingConstants.BOTTOM:
        return PositionType.BOTTOM;
    }
    assert false : "Unknown orientation: " + side;
    return PositionType.TOP;
}
 
Example #27
Source File: GTKEngine.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintExtension(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType, String detail,
        int x, int y, int w, int h, PositionType placement, int tabIndex) {

    state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_extension(widget, state, shadowType.ordinal(), detail,
                           x - x0, y - y0, w, h, placement.ordinal());
}
 
Example #28
Source File: GTKEngine.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintBoxGap(Graphics g, SynthContext context,
        Region id, int state, ShadowType shadowType,
        String detail, int x, int y, int w, int h,
        PositionType boxGapType, int tabBegin, int size) {

    state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
    int widget = getWidgetType(context.getComponent(), id).ordinal();
    native_paint_box_gap(widget, state, shadowType.ordinal(), detail,
            x - x0, y - y0, w, h, boxGapType.ordinal(), tabBegin, size);
}
 
Example #29
Source File: GTKPainter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 - x;
            gapSize = tabBounds.width;
        }
        else {
            gapStart = tabBounds.y - y;
            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();
        }
    }
}
 
Example #30
Source File: GTKLookAndFeel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps a swing constant to a GTK constant.
 */
static PositionType SwingOrientationConstantToGTK(int side) {
    switch (side) {
    case SwingConstants.LEFT:
        return PositionType.LEFT;
    case SwingConstants.RIGHT:
        return PositionType.RIGHT;
    case SwingConstants.TOP:
        return PositionType.TOP;
    case SwingConstants.BOTTOM:
        return PositionType.BOTTOM;
    }
    assert false : "Unknown orientation: " + side;
    return PositionType.TOP;
}