import * as React from 'react';
import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/type";
import { LegendMouseButtonEventArgs } from "./igr-legend-mouse-button-event-args";
import { LegendMouseEventArgs } from "./igr-legend-mouse-event-args";
import { getModifiedProps, isValidProp } from "igniteui-react-core/ES2015/componentUtil";
/**
 * Represents the base class for a legend in IgxDataChartComponent.
*/
export class IgrLegendBase extends React.Component {
    constructor(props) {
        super(props);
        this._legendItemMouseLeftButtonDown = null;
        this._legendItemMouseLeftButtonDown_wrapped = null;
        this._legendItemMouseLeftButtonUp = null;
        this._legendItemMouseLeftButtonUp_wrapped = null;
        this._legendItemMouseEnter = null;
        this._legendItemMouseEnter_wrapped = null;
        this._legendItemMouseLeave = null;
        this._legendItemMouseLeave_wrapped = null;
        this._legendItemMouseMove = null;
        this._legendItemMouseMove_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return null;
    }
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    componentDidMount() {
        for (const p of Object.keys(this.props)) {
            if (isValidProp(this, p)) {
                this[p] = this.props[p];
            }
        }
    }
    shouldComponentUpdate(nextProps, nextState) {
        const mod = getModifiedProps(this.props, nextProps);
        for (const p of Object.keys(mod)) {
            if (isValidProp(this, p)) {
                this[p] = mod[p];
            }
        }
        return true;
    }
    render() {
        return null;
    }
    /**
     * Event raised when the left mouse button is pressed while the mouse pointer is over a legend item
     * in this Legend.
    */
    get legendItemMouseLeftButtonDown() {
        return this._legendItemMouseLeftButtonDown;
    }
    set legendItemMouseLeftButtonDown(ev) {
        if (this._legendItemMouseLeftButtonDown !== null) {
            this.i.legendItemMouseLeftButtonDown = delegateRemove(this.i.legendItemMouseLeftButtonDown, this._legendItemMouseLeftButtonDown_wrapped);
            this._legendItemMouseLeftButtonDown_wrapped = null;
            this._legendItemMouseLeftButtonDown = null;
        }
        this._legendItemMouseLeftButtonDown = ev;
        this._legendItemMouseLeftButtonDown_wrapped = (o, e) => {
            let outerArgs = new LegendMouseButtonEventArgs();
            outerArgs._provideImplementation(e);
            this._legendItemMouseLeftButtonDown(this, outerArgs);
        };
        this.i.legendItemMouseLeftButtonDown = delegateCombine(this.i.legendItemMouseLeftButtonDown, this._legendItemMouseLeftButtonDown_wrapped);
    }
    /**
     * Event raised when the left mouse button is released while the mouse pointer is over a legend item
     * in this Legend.
    */
    get legendItemMouseLeftButtonUp() {
        return this._legendItemMouseLeftButtonUp;
    }
    set legendItemMouseLeftButtonUp(ev) {
        if (this._legendItemMouseLeftButtonUp !== null) {
            this.i.legendItemMouseLeftButtonUp = delegateRemove(this.i.legendItemMouseLeftButtonUp, this._legendItemMouseLeftButtonUp_wrapped);
            this._legendItemMouseLeftButtonUp_wrapped = null;
            this._legendItemMouseLeftButtonUp = null;
        }
        this._legendItemMouseLeftButtonUp = ev;
        this._legendItemMouseLeftButtonUp_wrapped = (o, e) => {
            let outerArgs = new LegendMouseButtonEventArgs();
            outerArgs._provideImplementation(e);
            this._legendItemMouseLeftButtonUp(this, outerArgs);
        };
        this.i.legendItemMouseLeftButtonUp = delegateCombine(this.i.legendItemMouseLeftButtonUp, this._legendItemMouseLeftButtonUp_wrapped);
    }
    /**
     * Event raised when the mouse pointer enters a legend item of this legend.
    */
    get legendItemMouseEnter() {
        return this._legendItemMouseEnter;
    }
    set legendItemMouseEnter(ev) {
        if (this._legendItemMouseEnter !== null) {
            this.i.legendItemMouseEnter = delegateRemove(this.i.legendItemMouseEnter, this._legendItemMouseEnter_wrapped);
            this._legendItemMouseEnter_wrapped = null;
            this._legendItemMouseEnter = null;
        }
        this._legendItemMouseEnter = ev;
        this._legendItemMouseEnter_wrapped = (o, e) => {
            let outerArgs = new LegendMouseEventArgs();
            outerArgs._provideImplementation(e);
            this._legendItemMouseEnter(this, outerArgs);
        };
        this.i.legendItemMouseEnter = delegateCombine(this.i.legendItemMouseEnter, this._legendItemMouseEnter_wrapped);
    }
    /**
     * Event raised when the mouse pointer leaves a legend item of this legend.
    */
    get legendItemMouseLeave() {
        return this._legendItemMouseLeave;
    }
    set legendItemMouseLeave(ev) {
        if (this._legendItemMouseLeave !== null) {
            this.i.legendItemMouseLeave = delegateRemove(this.i.legendItemMouseLeave, this._legendItemMouseLeave_wrapped);
            this._legendItemMouseLeave_wrapped = null;
            this._legendItemMouseLeave = null;
        }
        this._legendItemMouseLeave = ev;
        this._legendItemMouseLeave_wrapped = (o, e) => {
            let outerArgs = new LegendMouseEventArgs();
            outerArgs._provideImplementation(e);
            this._legendItemMouseLeave(this, outerArgs);
        };
        this.i.legendItemMouseLeave = delegateCombine(this.i.legendItemMouseLeave, this._legendItemMouseLeave_wrapped);
    }
    /**
     * Event raised when the mouse pointer moves over a legend item of this legend.
    */
    get legendItemMouseMove() {
        return this._legendItemMouseMove;
    }
    set legendItemMouseMove(ev) {
        if (this._legendItemMouseMove !== null) {
            this.i.legendItemMouseMove = delegateRemove(this.i.legendItemMouseMove, this._legendItemMouseMove_wrapped);
            this._legendItemMouseMove_wrapped = null;
            this._legendItemMouseMove = null;
        }
        this._legendItemMouseMove = ev;
        this._legendItemMouseMove_wrapped = (o, e) => {
            let outerArgs = new LegendMouseEventArgs();
            outerArgs._provideImplementation(e);
            this._legendItemMouseMove(this, outerArgs);
        };
        this.i.legendItemMouseMove = delegateCombine(this.i.legendItemMouseMove, this._legendItemMouseMove_wrapped);
    }
}
