aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/widget/HighlightableWidget.java
blob: 82f97ab33c79ed745a86cc6e3e1f53fb2add30a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package me.shedaniel.rei.gui.widget;

import java.awt.*;

public abstract class HighlightableWidget extends Widget {
    
    abstract public Shape getBounds();
    
    public final boolean isHighlighted(int mouseX, int mouseY) {
        return isHighlighted((double) mouseX, (double) mouseY);
    }
    
    public final boolean isHighlighted(Point point) {
        return isHighlighted(point.x, point.y);
    }
    
    public boolean isHighlighted(double mouseX, double mouseY) {
        return getBounds().contains(mouseX, mouseY);
    }
    
    @Override
    public boolean isMouseOver(double double_1, double double_2) {
        return isHighlighted(double_1, double_2);
    }
    
}