Search in sources :

Example 21 with Box

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

the class PropPanelLayout method layoutScrollBars.

//  private boolean hasNonScrollBarChildren(PropPanel panel)
//  {
//    List<Panel> children = panel.getChildren();
//    if(children.size() == 0)
//      return false;
//    else if(children.size() == 1)
//      return !(children.contains(panel.getVerticalScrollbar()) || children.contains(panel.getHorizontalScrollbar()));
//    else if(children.size() == 2)
//      return !(children.contains(panel.getVerticalScrollbar()) && children.contains(panel.getHorizontalScrollbar()));
//    else
//      return true;
//  }
private void layoutScrollBars(PropPanel panel, Dimension consumedDimensions) {
    ScrollBarPanel vertical = panel.getVerticalScrollbar();
    ScrollBarPanel horizontal = panel.getHorizontalScrollbar();
    Box area = panel.getChildConsumableBounds();
    if (vertical != null) {
        vertical.setHeight(area.height);
        vertical.setLocation(area.right() + 1, area.y);
        vertical.configure(area.height, consumedDimensions.height);
    }
    if (horizontal != null) {
        horizontal.setWidth(area.width);
        horizontal.setLocation(area.x, area.bottom() + 1);
        horizontal.configure(area.width, consumedDimensions.width);
    }
}
Also used : ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel) Box(limelight.util.Box)

Example 22 with Box

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

the class PaintJob method paintChildren.

public void paintChildren(ParentPanelBase panel, Graphics2D graphics) {
    if (panel.hasChildren()) {
        Box innards = panel instanceof PropPanel ? ((PropPanel) panel).getPaddedBounds() : panel.getChildConsumableBounds();
        graphics.clipRect(innards.x, innards.y, innards.width, innards.height);
        for (Panel child : panel.getChildren()) if (!child.isFloater())
            paintChild(graphics, child);
        for (Panel child : panel.getChildren()) if (child.isFloater())
            paintChild(graphics, child);
    }
}
Also used : Panel(limelight.ui.Panel) Box(limelight.util.Box)

Example 23 with Box

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

the class PanelBase method getAbsoluteBounds.

public Box getAbsoluteBounds() {
    if (absoluteBounds == null) {
        Point absoluteLocation = getAbsoluteLocation();
        absoluteBounds = new Box(absoluteLocation.x, absoluteLocation.y, getWidth(), getHeight());
    }
    return absoluteBounds;
}
Also used : Box(limelight.util.Box)

Example 24 with Box

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

the class RepeatYFillStrategyValueTest method setUp.

public void setUp() throws Exception {
    attribute = new RepeatYFillStrategyValue();
    graphics = new MockGraphics();
    clip = new Box(0, 0, 60, 60);
    graphics.clip = clip;
}
Also used : MockGraphics(limelight.ui.MockGraphics) Box(limelight.util.Box)

Example 25 with Box

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

the class ScaleFillStrategyValueTest method setUp.

public void setUp() throws Exception {
    attribute = new ScaleFillStrategyValue();
    graphics = new MockGraphics();
    clip = new Box(0, 0, 60, 60);
    graphics.clip = clip;
}
Also used : MockGraphics(limelight.ui.MockGraphics) 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