use of org.apache.pivot.wtk.Bounds in project pivot by apache.
the class TerraTextInputSkin method getCaretRectangle.
private Rectangle getCaretRectangle(TextHitInfo textCaret) {
TextInput textInput = (TextInput) getComponent();
AttributedStringCharacterIterator composedText = textInput.getComposedText();
Bounds selectionStartBounds = getCharacterBounds(textInput.getSelectionStart());
return GraphicsUtilities.getCaretRectangle(textCaret, composedText, selectionStartBounds.x, padding.top + 1);
}
use of org.apache.pivot.wtk.Bounds in project pivot by apache.
the class TerraPaletteSkin method paint.
@Override
public void paint(Graphics2D graphics) {
// Call the base class to paint the background
super.paint(graphics);
int width = getWidth();
int height = getHeight();
int titleBarHeight = titleBarTablePane.getHeight();
graphics.setStroke(new BasicStroke());
Palette palette = (Palette) getComponent();
boolean active = palette.getOwner().isActive();
boolean enabled = palette.isEnabled();
Color currentTitleBarBackgroundColor = (active && enabled) ? titleBarBackgroundColor : inactiveTitleBarBackgroundColor;
Color currentTitleBarBorderColor = (active && enabled) ? titleBarBorderColor : inactiveTitleBarBorderColor;
Color titleBarBevelColor = TerraTheme.brighten(currentTitleBarBackgroundColor);
if (!themeIsFlat()) {
// Draw the title area
graphics.setPaint(new GradientPaint(width / 2f, 0, titleBarBevelColor, width / 2f, titleBarHeight + 1, currentTitleBarBackgroundColor));
graphics.fillRect(0, 0, width, titleBarHeight + 1);
// Draw the border
graphics.setPaint(currentTitleBarBorderColor);
GraphicsUtilities.drawRect(graphics, 0, 0, width, titleBarHeight + 1);
// Draw the content area
Bounds contentAreaRectangle = new Bounds(0, titleBarHeight + 2, width, height - (titleBarHeight + 2));
graphics.setPaint(contentBorderColor);
GraphicsUtilities.drawRect(graphics, contentAreaRectangle.x, contentAreaRectangle.y, contentAreaRectangle.width, contentAreaRectangle.height);
graphics.setPaint(contentBevelColor);
GraphicsUtilities.drawLine(graphics, contentAreaRectangle.x + 1, contentAreaRectangle.y + 1, contentAreaRectangle.width - 2, Orientation.HORIZONTAL);
} else {
// Draw the title area
graphics.setPaint(currentTitleBarBackgroundColor);
graphics.fillRect(0, 0, width, titleBarHeight + 1);
}
}
use of org.apache.pivot.wtk.Bounds in project pivot by apache.
the class TerraPaletteSkin method mouseDown.
@Override
public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseDown(component, button, x, y);
Window window = (Window) getComponent();
boolean maximized = window.isMaximized();
if (button == Mouse.Button.LEFT && !maximized) {
Bounds titleBarBounds = titleBarTablePane.getBounds();
if (titleBarBounds.contains(x, y)) {
dragOffset = new Point(x, y);
Mouse.capture(component);
} else {
if (resizeHandle.isVisible() && x > resizeHandle.getX() && y > resizeHandle.getY()) {
resizeOffset = new Point(getWidth() - x, getHeight() - y);
Mouse.capture(component);
}
}
}
return consumed;
}
use of org.apache.pivot.wtk.Bounds in project pivot by apache.
the class TerraPaletteSkin method getClientArea.
@Override
public Bounds getClientArea() {
int width = getWidth();
int height = getHeight();
int titleBarHeight = titleBarTablePane.getHeight();
return new Bounds(0, titleBarHeight + 2, width, height - (titleBarHeight + 2));
}
use of org.apache.pivot.wtk.Bounds in project pivot by apache.
the class TerraTreeViewSkin method mouseWheel.
@Override
public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y) {
if (highlightedNode != null) {
Bounds nodeBounds = getNodeBounds(highlightedNode);
highlightedNode.setHighlighted(false);
highlightedNode = null;
if (nodeBounds != null) {
repaintComponent(nodeBounds.x, nodeBounds.y, nodeBounds.width, nodeBounds.height, true);
}
}
return super.mouseWheel(component, scrollType, scrollAmount, wheelRotation, x, y);
}
Aggregations