package Common.Visual.Controls;
import Common.Passes.Pass;

import java.awt.*;
public class PassButton extends MenuBarButton implements PassControl {
    public PassButton(Pass pass, boolean tab) {
        setText(pass.getButtonText());
        setToolTipText(pass.getDescription());
        if (pass.getIconPath() != null) {
            if (tab) {
                setIcon(pass.getTabIcon());
                setPreferredSize(new Dimension(18, 18));
                setMaximumSize(new Dimension(18, 18));
                setMinimumSize(new Dimension(18, 18));
            } else
                setIcon(pass.getIconPath());
        }
        addActionListener(pass.getControlAction());
        pass.addControl(this);
    }
    public PassButton(Pass pass) {
        this(pass, false);
    }
}
