aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/widget/DetailedButtonWidget.java
blob: 02f8cfbd194014d85f799cf528ee39f9cdcf41b4 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Roughly Enough Items by Danielshe.
 * Licensed under the MIT License.
 */

package me.shedaniel.rei.gui.widget;

import net.minecraft.text.TextComponent;

import java.awt.*;

public class DetailedButtonWidget extends ButtonWidget {
    
    private DetailedButtonWidget.PressAction pressAction;
    
    public DetailedButtonWidget(Rectangle rectangle, TextComponent text, PressAction pressAction) {
        super(rectangle, text);
        this.pressAction = pressAction;
    }
    
    public DetailedButtonWidget(Rectangle rectangle, String text, PressAction pressAction) {
        super(rectangle, text);
        this.pressAction = pressAction;
    }
    
    public DetailedButtonWidget(int x, int y, int width, int height, String text, PressAction pressAction) {
        super(x, y, width, height, text);
        this.pressAction = pressAction;
    }
    
    public DetailedButtonWidget(int x, int y, int width, int height, TextComponent text, PressAction pressAction) {
        super(x, y, width, height, text);
        this.pressAction = pressAction;
    }
    
    @Override
    public void onPressed() {
        if (pressAction != null)
            pressAction.onPress(this);
    }
    
    public interface PressAction {
        void onPress(ButtonWidget var1);
    }
    
}