import * as React from 'react';
import { ZoomSliderOrientation_$type } from './ZoomSliderOrientation';
import { ZoomSliderResolvingAxisValueEventArgs } from './igr-zoom-slider-resolving-axis-value-event-args';
import { RectChangedEventArgs } from "igniteui-react-core/ES2015/igr-rect-changed-event-args";
import { ZoomSlider } from "./ZoomSlider";
import { fromRect, toRect, ensureEnum, brushToString, stringToBrush, ensureBool, initializePropertiesFromCss, isValidProp } from "igniteui-react-core/ES2015/componentUtil";
import { FontInfo } from "igniteui-react-core/ES2015/FontInfo";
import { ReactRenderer } from "igniteui-react-core/ES2015/react-renderer";
import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/type";
export const IgxZoomSliderComponent_PROVIDERS = [];
const ZoomSliderStylingDefaults = {};
export class IgrZoomSlider extends React.Component {
    constructor(props) {
        super(props);
        this._wrapper = null;
        this._implementation = null;
        this._resolvingAxisValue = null;
        this._resolvingAxisValue_wrapped = null;
        this._windowRectChanged = null;
        this._windowRectChanged_wrapped = null;
        this._getMainRef = this._getMainRef.bind(this);
        this._implementation = this.createImplementation();
        if (document) {
            this._container = document.createElement("div");
            this._container.style.display = "block";
            this._container.style.width = "100%";
            this._container.style.height = "100%";
        }
        var root;
        root = this._container;
        if (this._container != null) {
            root = this._container;
        }
        var ren = new ReactRenderer(root, document, true, ZoomSliderStylingDefaults);
        this._wrapper = ren;
        var zoomSlider = this.i;
        this._zoomSlider = zoomSlider;
        zoomSlider.provideContainer(ren);
        zoomSlider.notifySizeChanged();
        this.initializeProperties();
        ren.addSizeWatcher(() => {
            this._zoomSlider.notifySizeChanged();
        });
    }
    set height(value) {
        this._height = value;
        if (this._elRef) {
            this._elRef.style.height = value;
            this._zoomSlider.notifySizeChanged();
        }
    }
    get height() {
        return this._height;
    }
    set width(value) {
        this._width = value;
        if (this._elRef) {
            this._elRef.style.height = value;
            this._zoomSlider.notifySizeChanged();
        }
    }
    get width() {
        return this._width;
    }
    _getMainRef(ref) {
        this._elRef = ref;
    }
    render() {
        let div = React.createElement("div", {
            ref: this._getMainRef
        });
        //}
        return div;
    }
    initializeProperties() {
        for (const p of Object.keys(this.props)) {
            if (isValidProp(this, p)) {
                this[p] = this.props[p];
            }
        }
    }
    // supports angular themes or custom properties set in CSS
    updateStyle() {
        initializePropertiesFromCss(this._elRef, this, "zoom-slider-");
    }
    componentWillUnmount() {
        this._zoomSlider.destroy();
        this._wrapper.destroy();
    }
    componentDidMount() {
        this._elRef.style.width = this._width ? this._width : "";
        this._elRef.style.height = this._height ? this._height : "";
        this._elRef.appendChild(this._container);
        this._zoomSlider.notifySizeChanged();
        this.initializeContent();
    }
    initializeContent() {
        this.updateStyle();
    }
    createImplementation() {
        return new ZoomSlider();
    }
    get i() {
        return this._implementation;
    }
    get panTransitionDuration() {
        return this.i.bl;
    }
    set panTransitionDuration(v) {
        this.i.bl = +v;
    }
    get maxZoomWidth() {
        return this.i.bg;
    }
    set maxZoomWidth(v) {
        this.i.bg = +v;
    }
    /**
     * Gets or sets the scaling value used to affect the pixel density of the control.
     * A higher scaling ratio will produce crisper visuals at the expense of memory.  Lower values will cause the control
     * to appear blurry.
    */
    get pixelScalingRatio() {
        return this.i.bi;
    }
    set pixelScalingRatio(v) {
        this.i.bi = +v;
    }
    get actualPixelScalingRatio() {
        return this.i.a4;
    }
    set actualPixelScalingRatio(v) {
        this.i.a4 = +v;
    }
    get windowRect() {
        return fromRect(this.i.windowRect);
    }
    set windowRect(v) {
        this.i.windowRect = toRect(v);
    }
    get minZoomWidth() {
        return this.i.bh;
    }
    set minZoomWidth(v) {
        this.i.bh = +v;
    }
    get startInset() {
        return this.i.startInset;
    }
    set startInset(v) {
        this.i.startInset = +v;
    }
    get endInset() {
        return this.i.endInset;
    }
    set endInset(v) {
        this.i.endInset = +v;
    }
    get trackStartInset() {
        return this.i.trackStartInset;
    }
    set trackStartInset(v) {
        this.i.trackStartInset = +v;
    }
    get trackEndInset() {
        return this.i.trackEndInset;
    }
    set trackEndInset(v) {
        this.i.trackEndInset = +v;
    }
    get barExtent() {
        return this.i.barExtent;
    }
    set barExtent(v) {
        this.i.barExtent = +v;
    }
    get orientation() {
        return this.i.e;
    }
    set orientation(v) {
        this.i.e = ensureEnum(ZoomSliderOrientation_$type, v);
    }
    get lowerThumbBrush() {
        return brushToString(this.i.e8);
    }
    set lowerThumbBrush(v) {
        this.i.e8 = stringToBrush(v);
    }
    get lowerThumbStrokeThickness() {
        return this.i.be;
    }
    set lowerThumbStrokeThickness(v) {
        this.i.be = +v;
    }
    get higherThumbStrokeThickness() {
        return this.i.a9;
    }
    set higherThumbStrokeThickness(v) {
        this.i.a9 = +v;
    }
    get higherThumbBrush() {
        return brushToString(this.i.e0);
    }
    set higherThumbBrush(v) {
        this.i.e0 = stringToBrush(v);
    }
    get lowerThumbOutline() {
        return brushToString(this.i.e9);
    }
    set lowerThumbOutline(v) {
        this.i.e9 = stringToBrush(v);
    }
    get higherThumbOutline() {
        return brushToString(this.i.e1);
    }
    set higherThumbOutline(v) {
        this.i.e1 = stringToBrush(v);
    }
    get lowerThumbRidgesBrush() {
        return brushToString(this.i.fa);
    }
    set lowerThumbRidgesBrush(v) {
        this.i.fa = stringToBrush(v);
    }
    get higherThumbRidgesBrush() {
        return brushToString(this.i.e2);
    }
    set higherThumbRidgesBrush(v) {
        this.i.e2 = stringToBrush(v);
    }
    get lowerThumbWidth() {
        return this.i.bf;
    }
    set lowerThumbWidth(v) {
        this.i.bf = +v;
    }
    get higherThumbWidth() {
        return this.i.ba;
    }
    set higherThumbWidth(v) {
        this.i.ba = +v;
    }
    get lowerThumbHeight() {
        return this.i.bd;
    }
    set lowerThumbHeight(v) {
        this.i.bd = +v;
    }
    get higherThumbHeight() {
        return this.i.a8;
    }
    set higherThumbHeight(v) {
        this.i.a8 = +v;
    }
    get lowerShadeBrush() {
        return brushToString(this.i.e6);
    }
    set lowerShadeBrush(v) {
        this.i.e6 = stringToBrush(v);
    }
    get lowerShadeOutline() {
        return brushToString(this.i.e7);
    }
    set lowerShadeOutline(v) {
        this.i.e7 = stringToBrush(v);
    }
    get lowerShadeStrokeThickness() {
        return this.i.bc;
    }
    set lowerShadeStrokeThickness(v) {
        this.i.bc = +v;
    }
    get higherShadeBrush() {
        return brushToString(this.i.ey);
    }
    set higherShadeBrush(v) {
        this.i.ey = stringToBrush(v);
    }
    get higherShadeOutline() {
        return brushToString(this.i.ez);
    }
    set higherShadeOutline(v) {
        this.i.ez = stringToBrush(v);
    }
    get higherShadeStrokeThickness() {
        return this.i.a7;
    }
    set higherShadeStrokeThickness(v) {
        this.i.a7 = +v;
    }
    get barBrush() {
        return brushToString(this.i.et);
    }
    set barBrush(v) {
        this.i.et = stringToBrush(v);
    }
    get barOutline() {
        return brushToString(this.i.eu);
    }
    set barOutline(v) {
        this.i.eu = stringToBrush(v);
    }
    get barStrokeThickness() {
        return this.i.a5;
    }
    set barStrokeThickness(v) {
        this.i.a5 = +v;
    }
    get rangeThumbBrush() {
        return brushToString(this.i.fb);
    }
    set rangeThumbBrush(v) {
        this.i.fb = stringToBrush(v);
    }
    get rangeThumbOutline() {
        return brushToString(this.i.fc);
    }
    set rangeThumbOutline(v) {
        this.i.fc = stringToBrush(v);
    }
    get rangeThumbStrokeThickness() {
        return this.i.bj;
    }
    set rangeThumbStrokeThickness(v) {
        this.i.bj = +v;
    }
    get rangeThumbRidgesBrush() {
        return brushToString(this.i.fd);
    }
    set rangeThumbRidgesBrush(v) {
        this.i.fd = stringToBrush(v);
    }
    get lowerCalloutBrush() {
        return brushToString(this.i.e3);
    }
    set lowerCalloutBrush(v) {
        this.i.e3 = stringToBrush(v);
    }
    get lowerCalloutTextColor() {
        return brushToString(this.i.e5);
    }
    set lowerCalloutTextColor(v) {
        this.i.e5 = stringToBrush(v);
    }
    get lowerCalloutOutline() {
        return brushToString(this.i.e4);
    }
    set lowerCalloutOutline(v) {
        this.i.e4 = stringToBrush(v);
    }
    get lowerCalloutStrokeThickness() {
        return this.i.bb;
    }
    set lowerCalloutStrokeThickness(v) {
        this.i.bb = +v;
    }
    get higherCalloutBrush() {
        return brushToString(this.i.ev);
    }
    set higherCalloutBrush(v) {
        this.i.ev = stringToBrush(v);
    }
    get higherCalloutTextColor() {
        return brushToString(this.i.ex);
    }
    set higherCalloutTextColor(v) {
        this.i.ex = stringToBrush(v);
    }
    get higherCalloutOutline() {
        return brushToString(this.i.ew);
    }
    set higherCalloutOutline(v) {
        this.i.ew = stringToBrush(v);
    }
    get higherCalloutStrokeThickness() {
        return this.i.a6;
    }
    set higherCalloutStrokeThickness(v) {
        this.i.a6 = +v;
    }
    get isCustomThumbProvided() {
        return this.i.ab;
    }
    get isCustomRangeThumbProvided() {
        return this.i.z;
    }
    get isCustomBarProvided() {
        return this.i.y;
    }
    get isCustomShadeProvided() {
        return this.i.aa;
    }
    get areThumbCalloutsEnabled() {
        return this.i.q;
    }
    set areThumbCalloutsEnabled(v) {
        this.i.q = ensureBool(v);
    }
    get thumbCalloutTextStyle() {
        if (this.i.o == null) {
            return null;
        }
        return this.i.o.fontString;
    }
    set thumbCalloutTextStyle(v) {
        let fi = new FontInfo();
        fi.fontString = v;
        this.i.o = fi;
    }
    /**
 * Release any resources held by the ZoomSlider.

*/
    destroy() {
        this.i.destroy();
    }
    /**
     * Called by the UI framework to provide a UI container for rendering this control.
    
    * @param container  * The UI container element.
    */
    provideContainer(container) {
        this.i.provideContainer(container);
    }
    flush() {
        this.i.c3();
    }
    trackDirty() {
        this.i.trackDirty();
    }
    /**
     * Shows the ZoomSlider.
    
    */
    show() {
        this.i.show();
    }
    /**
     * Hides the ZoomSlider.
    
    */
    hide() {
        this.i.hide();
    }
    get resolvingAxisValue() {
        return this._resolvingAxisValue;
    }
    set resolvingAxisValue(ev) {
        if (this._resolvingAxisValue_wrapped !== null) {
            this.i.resolvingAxisValue = delegateRemove(this.i.resolvingAxisValue, this._resolvingAxisValue_wrapped);
            this._resolvingAxisValue_wrapped = null;
            this._resolvingAxisValue = null;
        }
        this._resolvingAxisValue = ev;
        this._resolvingAxisValue_wrapped = (o, e) => {
            let outerArgs = new ZoomSliderResolvingAxisValueEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeResolvingAxisValue) {
                this.beforeResolvingAxisValue(this, outerArgs);
            }
            if (this._resolvingAxisValue) {
                this._resolvingAxisValue(this, outerArgs);
            }
        };
        this.i.resolvingAxisValue = delegateCombine(this.i.resolvingAxisValue, this._resolvingAxisValue_wrapped);
    }
    /**
     * Occurs just after the current ZoomSlider's window rectangle is changed.
    */
    get windowRectChanged() {
        return this._windowRectChanged;
    }
    set windowRectChanged(ev) {
        if (this._windowRectChanged_wrapped !== null) {
            this.i.windowRectChanged = delegateRemove(this.i.windowRectChanged, this._windowRectChanged_wrapped);
            this._windowRectChanged_wrapped = null;
            this._windowRectChanged = null;
        }
        this._windowRectChanged = ev;
        this._windowRectChanged_wrapped = (o, e) => {
            let outerArgs = new RectChangedEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeWindowRectChanged) {
                this.beforeWindowRectChanged(this, outerArgs);
            }
            if (this._windowRectChanged) {
                this._windowRectChanged(this, outerArgs);
            }
        };
        this.i.windowRectChanged = delegateCombine(this.i.windowRectChanged, this._windowRectChanged_wrapped);
    }
}
