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

The following examples show how to use com.sun.java.swing.plaf.gtk.GTKConstants.PositionType. 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
Source Project: jdk1.8-source-analysis   Source File: GTKPainter.java    License: 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 2
Source Project: dragonwell8_jdk   Source File: GTKPainter.java    License: 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 Project: TencentKona-8   Source File: GTKPainter.java    License: 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 4
Source Project: jdk8u60   Source File: GTKPainter.java    License: 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 Project: JDKSourceCode1.8   Source File: GTKPainter.java    License: 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 6
Source Project: openjdk-jdk8u   Source File: GTKPainter.java    License: 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
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 Project: Bytecoder   Source File: GTKPainter.java    License: 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 Project: openjdk-jdk9   Source File: GTKPainter.java    License: 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 Project: jdk8u-jdk   Source File: GTKPainter.java    License: 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 Project: hottub   Source File: GTKPainter.java    License: 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 Project: openjdk-8-source   Source File: GTKPainter.java    License: 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 Project: openjdk-8   Source File: GTKPainter.java    License: 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 Project: jdk8u_jdk   Source File: GTKPainter.java    License: 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 Project: jdk8u-jdk   Source File: GTKPainter.java    License: 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 Project: jdk8u-dev-jdk   Source File: GTKPainter.java    License: 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 17
Source Project: jdk1.8-source-analysis   Source File: GTKLookAndFeel.java    License: Apache License 2.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 18
Source Project: jdk1.8-source-analysis   Source File: GTKPainter.java    License: Apache License 2.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 19
Source Project: jdk1.8-source-analysis   Source File: GTKEngine.java    License: Apache License 2.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 20
Source Project: jdk1.8-source-analysis   Source File: GTKEngine.java    License: Apache License 2.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 21
/**
 * 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 Project: dragonwell8_jdk   Source File: GTKPainter.java    License: 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 23
Source Project: dragonwell8_jdk   Source File: GTKEngine.java    License: 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 24
Source Project: dragonwell8_jdk   Source File: GTKEngine.java    License: 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 25
Source Project: TencentKona-8   Source File: GTKLookAndFeel.java    License: 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 26
Source Project: TencentKona-8   Source File: GTKPainter.java    License: 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 27
Source Project: TencentKona-8   Source File: GTKEngine.java    License: 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 28
Source Project: TencentKona-8   Source File: GTKEngine.java    License: 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 29
Source Project: jdk8u60   Source File: GTKLookAndFeel.java    License: 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 30
Source Project: jdk8u60   Source File: GTKPainter.java    License: 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();
        }
    }
}