Search in sources :

Example 1 with ToolTipMaker

use of com.cburch.logisim.tools.ToolTipMaker in project logisim-evolution by reds-heig.

the class Canvas method getToolTipText.

@Override
public String getToolTipText(MouseEvent event) {
    boolean showTips = AppPreferences.COMPONENT_TIPS.getBoolean();
    if (showTips) {
        Canvas.snapToGrid(event);
        Location loc = Location.create(event.getX(), event.getY());
        ComponentUserEvent e = null;
        for (Component comp : getCircuit().getAllContaining(loc)) {
            Object makerObj = comp.getFeature(ToolTipMaker.class);
            if (makerObj != null && makerObj instanceof ToolTipMaker) {
                ToolTipMaker maker = (ToolTipMaker) makerObj;
                if (e == null) {
                    e = new ComponentUserEvent(this, loc.getX(), loc.getY());
                }
                String ret = maker.getToolTip(e);
                if (ret != null) {
                    unrepairMouseEvent(event);
                    return ret;
                }
            }
        }
    }
    return null;
}
Also used : ToolTipMaker(com.cburch.logisim.tools.ToolTipMaker) ComponentUserEvent(com.cburch.logisim.comp.ComponentUserEvent) Component(com.cburch.logisim.comp.Component) Location(com.cburch.logisim.data.Location)

Aggregations

Component (com.cburch.logisim.comp.Component)1 ComponentUserEvent (com.cburch.logisim.comp.ComponentUserEvent)1 Location (com.cburch.logisim.data.Location)1 ToolTipMaker (com.cburch.logisim.tools.ToolTipMaker)1