Search in sources :

Example 46 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ScrollMouseProcessor method processBlockIncremementDrag.

private void processBlockIncremementDrag() {
    if (scrollBar.getTrackBounds().contains(mouseLocation)) {
        Box sliderBounds = scrollBar.getSliderBounds();
        final boolean shouldReverseBlockIncrement = (repeater.getScrollDelta() < 0 && isAfterSlider(mouseLocation, sliderBounds)) || (repeater.getScrollDelta() > 0 && isBeforeSlider(mouseLocation, sliderBounds));
        if (shouldReverseBlockIncrement)
            repeater.setScrollDelta(repeater.getScrollDelta() * -1);
        startRepeater();
    } else
        repeater.stop();
}
Also used : Box(limelight.util.Box)

Example 47 with Box

use of limelight.util.Box in project limelight by slagyr.

the class TextPanelBorderPainter method paint.

public void paint(Graphics2D graphics, PaintablePanel panel) {
    if (shouldPaintSpecialBorder(panel)) {
        try {
            Box bounds = panel.getMarginedBounds();
            normalBorder.draw(graphics, bounds.x, bounds.y, bounds.width, bounds.height);
            if (panel.hasFocus())
                focusedBorder.draw(graphics, bounds.x, bounds.y, bounds.width, bounds.height);
        } catch (Exception e) {
            System.err.println("TextPanel: NinePatch choked again");
        }
    } else
        BorderPainter.instance.paint(graphics, panel);
}
Also used : Box(limelight.util.Box)

Example 48 with Box

use of limelight.util.Box in project limelight by slagyr.

the class FloaterLayout method doFinalization.

//TODO Floater need to change position when scrolled too.
@Override
public void doFinalization(Panel thePanel) {
    PanelBase panel = (PanelBase) thePanel;
    if (panel.isFloater()) {
        Box area = panel.getParent().getChildConsumableBounds();
        int newX = panel.getStyle().getCompiledX().getX(0, area);
        int newY = panel.getStyle().getCompiledY().getY(0, area);
        panel.markAsDirty();
        panel.setLocation(newX, newY);
        panel.markAsDirty();
    }
}
Also used : Box(limelight.util.Box)

Example 49 with Box

use of limelight.util.Box in project limelight by slagyr.

the class ImagePanelLayout method doExpansion.

@Override
public void doExpansion(Panel thePanel) {
    ImagePanel panel = (ImagePanel) thePanel;
    Box consumableArea = panel.getParent().getChildConsumableBounds();
    if (panel.getImage() == null)
        return;
    Dimension size;
    if (panel.isScaled())
        size = new Dimension(consumableArea.width, consumableArea.height);
    else
        size = new Dimension((int) (panel.getImageWidth() + 0.5), (int) (panel.getImageHeight() + 0.5));
    if (panel.getImage() != null) {
        handleRotation(panel);
        handleAutoDimensions(panel, size);
    }
    panel.setSize(size.width, size.height);
}
Also used : Box(limelight.util.Box)

Example 50 with Box

use of limelight.util.Box in project limelight by slagyr.

the class PaintJob method paint.

public void paint(Panel panel) {
    Box panelBounds = panel.getAbsoluteBounds();
    int x = panelBounds.x - clip.x;
    int y = panelBounds.y - clip.y;
    Graphics2D graphics = (Graphics2D) rootGraphics.create(x, y, panel.getWidth(), panel.getHeight());
    paint(panel, graphics);
    graphics.dispose();
    rootGraphics.dispose();
}
Also used : Box(limelight.util.Box)

Aggregations

Box (limelight.util.Box)80 Test (org.junit.Test)31 MockGraphics (limelight.ui.MockGraphics)11 Before (org.junit.Before)6 AffineTransform (java.awt.geom.AffineTransform)5 Style (limelight.styles.Style)3 TextLocation (limelight.ui.text.TextLocation)3 TypedLayout (limelight.ui.text.TypedLayout)3 BufferedImage (java.awt.image.BufferedImage)2 Panel (limelight.ui.Panel)2 TextLayout (java.awt.font.TextLayout)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LimelightException (limelight.LimelightException)1 FlatStyle (limelight.styles.FlatStyle)1 StringValue (limelight.styles.abstrstyling.StringValue)1 AutoDimensionValue (limelight.styles.values.AutoDimensionValue)1 GreedyDimensionValue (limelight.styles.values.GreedyDimensionValue)1 BufferedImagePool (limelight.ui.BufferedImagePool)1 MockPanel (limelight.ui.MockPanel)1