/**
 * Creates the base structure of Tree.
 * @member Ext.tree.Panel
 */
@mixin extjs-tree {

    // Tree tables must assume either full width of the View element, or, when necessary, must overflow
    // They must not shrink wrap the width and only be as wide as their widest node's content.
    .#{$prefix}autowidth-table table.#{$prefix}grid-table {
        table-layout: auto;
        width: auto!important;
    }

    .#{$prefix}tree-expander {
        cursor: pointer;
        position: relative;
        top: -2px;
    }

    //arrows
    .#{$prefix}tree-arrows {
        .#{$prefix}tree-expander {
            background: theme-background-image($theme-name, 'tree/arrows.gif') no-repeat 0 0;
        }

        .#{$prefix}tree-expander-over .#{$prefix}tree-expander {
            background-position: -32px 0;
        }

        .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-expander {
            background-position: -16px 0;
        }

        .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-expander-over .#{$prefix}tree-expander {
            background-position: -48px 0;
        }

        @if $include-rtl {
            .#{$prefix}rtl.#{$prefix}tree-expander {
                background: theme-background-image($theme-name, 'tree/arrows-rtl.gif') no-repeat -48px 0;
            }

            .#{$prefix}tree-expander-over .#{$prefix}rtl.#{$prefix}tree-expander {
                background-position: -16px 0;
            }

            .#{$prefix}grid-tree-node-expanded .#{$prefix}rtl.#{$prefix}tree-expander {
                background-position: -32px 0;
            }

            .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-expander-over .#{$prefix}rtl.#{$prefix}tree-expander {
                background-position: 0 0;
            }
        }
    }

    //elbows
    .#{$prefix}tree-lines {
        .#{$prefix}tree-elbow {
            background-image: theme-background-image($theme-name, 'tree/elbow.gif');
        }

        .#{$prefix}tree-elbow-end {
            background-image: theme-background-image($theme-name, 'tree/elbow-end.gif');
        }

        .#{$prefix}tree-elbow-plus {
            background-image: theme-background-image($theme-name, 'tree/elbow-plus.gif');
        }

        .#{$prefix}tree-elbow-end-plus {
            background-image: theme-background-image($theme-name, 'tree/elbow-end-plus.gif');
        }

        .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-elbow-plus {
            background-image: theme-background-image($theme-name, 'tree/elbow-minus.gif');
        }

        .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-elbow-end-plus {
            background-image: theme-background-image($theme-name, 'tree/elbow-end-minus.gif');
        }

        .#{$prefix}tree-elbow-line {
            background-image: theme-background-image($theme-name, 'tree/elbow-line.gif');
        }

        @if $include-rtl {
            .#{$prefix}rtl.#{$prefix}tree-elbow {
                background-image: theme-background-image($theme-name, 'tree/elbow-rtl.gif');
            }

            .#{$prefix}rtl.#{$prefix}tree-elbow-end {
                background-image: theme-background-image($theme-name, 'tree/elbow-end-rtl.gif');
            }

            .#{$prefix}rtl.#{$prefix}tree-elbow-plus {
                background-image: theme-background-image($theme-name, 'tree/elbow-plus-rtl.gif');
            }

            .#{$prefix}rtl.#{$prefix}tree-elbow-end-plus {
                background-image: theme-background-image($theme-name, 'tree/elbow-end-plus-rtl.gif');
            }

            .#{$prefix}grid-tree-node-expanded .#{$prefix}rtl.#{$prefix}tree-elbow-plus {
                background-image: theme-background-image($theme-name, 'tree/elbow-minus-rtl.gif');
            }

            .#{$prefix}grid-tree-node-expanded .#{$prefix}rtl.#{$prefix}tree-elbow-end-plus {
                background-image: theme-background-image($theme-name, 'tree/elbow-end-minus-rtl.gif');
            }

            .#{$prefix}rtl.#{$prefix}tree-elbow-line {
                background-image: theme-background-image($theme-name, 'tree/elbow-line-rtl.gif');
            }
        }
    }

    .#{$prefix}tree-no-lines {
        .#{$prefix}tree-expander {
        	background-image: theme-background-image($theme-name, 'tree/elbow-plus-nl.gif');
        }

        .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-expander {
            background-image: theme-background-image($theme-name, 'tree/elbow-minus-nl.gif');
        }

        @if $include-rtl {
            .#{$prefix}rtl.#{$prefix}tree-expander {
                background-image: theme-background-image($theme-name, 'tree/elbow-plus-nl-rtl.gif');
            }

            .#{$prefix}grid-tree-node-expanded .#{$prefix}rtl.#{$prefix}tree-expander {
                background-image: theme-background-image($theme-name, 'tree/elbow-minus-nl-rtl.gif');
            }
        }
    }

    .#{$prefix}tree-icon {
        margin: $tree-icon-margin;
    }

    @if $include-rtl {
        .#{$prefix}rtl.#{$prefix}tree-icon {
            margin: rtl($tree-icon-margin);
        }
    }

    .#{$prefix}grid-with-row-lines .#{$prefix}tree-icon {
        margin-top: top($tree-icon-margin) - 1
    }

    .#{$prefix}tree-elbow,
    .#{$prefix}tree-elbow-end,
    .#{$prefix}tree-elbow-plus,
    .#{$prefix}tree-elbow-end-plus,
    .#{$prefix}tree-elbow-empty,
    .#{$prefix}tree-elbow-line {
        height: $tree-elbow-height;
        width: $tree-elbow-width;
    }

    .#{$prefix}grid-with-row-lines {
        .#{$prefix}tree-elbow,
        .#{$prefix}tree-elbow-end,
        .#{$prefix}tree-elbow-plus,
        .#{$prefix}tree-elbow-end-plus,
        .#{$prefix}tree-elbow-empty,
        .#{$prefix}tree-elbow-line {
            height: $tree-elbow-height - 1;
            position: relative;
            top: -1px;
        }
    }

    .#{$prefix}tree-icon-leaf {
        width: $tree-elbow-width;
        background-image: theme-background-image($theme-name, 'tree/leaf.gif');
    }

    @if $include-rtl {
        .#{$prefix}rtl.#{$prefix}tree-icon-leaf {
            background-image: theme-background-image($theme-name, 'tree/leaf-rtl.gif');
        }
    }

    .#{$prefix}tree-icon-parent {
        width: $tree-elbow-width;
        background-image: theme-background-image($theme-name, 'tree/folder.gif');
    }

    @if $include-rtl {
        .#{$prefix}rtl.#{$prefix}tree-icon-parent {
            background-image: theme-background-image($theme-name, 'tree/folder-rtl.gif');
        }
    }

    .#{$prefix}grid-tree-node-expanded .#{$prefix}tree-icon-parent {
        background-image: theme-background-image($theme-name, 'tree/folder-open.gif');
    }

    @if $include-rtl {
        .#{$prefix}grid-tree-node-expanded .#{$prefix}rtl.#{$prefix}tree-icon-parent {
            background-image: theme-background-image($theme-name, 'tree/folder-open-rtl.gif');
        }
    }

    .#{$prefix}grid-with-row-lines .#{$prefix}grid-cell-treecolumn .#{$prefix}grid-cell-inner {
        line-height: $tree-elbow-height - 3;
    }

    .#{$prefix}tree-panel .#{$prefix}grid-cell-inner {
        cursor: pointer;
        img {
            display: inline-block;
            vertical-align: top;
        }
        // Tree cell inners use 1px less padding top and bottom to account for borders which are always 1px, but invisible unless focused.
        padding: $grid-cell-inner-padding-top - 1px $grid-cell-inner-padding-horizontal $grid-cell-inner-padding-bottom - 1px;
    }

    .#{$prefix}grid-cell-treecolumn {
        // Connector line images must flow between cells, overwriting borders
        overflow: visible;
    }

    .#{$prefix}grid-cell-treecolumn .#{$prefix}grid-cell-inner {
        padding: 0;
        height: $tree-elbow-height - 1px;
        line-height: $tree-elbow-height - 2px;
        // Connector line images must flow between cells, overwriting borders
        overflow: visible;
    }

    @if $include-ie {
        .#{$prefix}ie .#{$prefix}tree-panel {
            .#{$prefix}tree-elbow,
            .#{$prefix}tree-elbow-end,
            .#{$prefix}tree-elbow-plus,
            .#{$prefix}tree-elbow-end-plus,
            .#{$prefix}tree-elbow-empty,
            .#{$prefix}tree-elbow-line {
                // vertical alignment is necessary for IE to show the ellipsis in the right place.
                vertical-align: -6px;
            }
        }
    }

    .#{$prefix}grid-editor-on-text-node {
        .#{$prefix}form-text {
            // specify padding left and padding right individually since we don't want to override padding-bottom (which can vary)
            padding-left: $grid-cell-treecolumn-editor-field-padding-horizontal;
            padding-right: $grid-cell-treecolumn-editor-field-padding-horizontal;
        }
    }
    @if $include-ie {
        .#{$prefix}ie .#{$prefix}grid-editor-on-text-node .#{$prefix}form-text {
            padding-left: $grid-cell-treecolumn-editor-field-padding-horizontal + 1px;
            padding-right: $grid-cell-treecolumn-editor-field-padding-horizontal + 1px;
        }
    }
    @if $include-opera {
        .#{$prefix}opera .#{$prefix}grid-editor-on-text-node .#{$prefix}form-text {
            padding-left: $grid-cell-treecolumn-editor-field-padding-horizontal + 1px;
            padding-right: $grid-cell-treecolumn-editor-field-padding-horizontal + 1px;
        }
    }

    .#{$prefix}tree-checkbox {
        margin: $tree-checkbox-margin;
        display: inline-block;
        vertical-align: top;

        width: $form-checkbox-size;
        height: $form-checkbox-size;
        background: no-repeat;
        background-image: theme-background-image($theme-name, $form-checkbox-image);

        overflow: hidden;
        padding: 0;
        border: 0;
        &::-moz-focus-inner {
            padding: 0;
            border: 0;
        }
    }

    @if $include-rtl {
        .#{$prefix}rtl.#{$prefix}tree-checkbox {
            margin: rtl($tree-checkbox-margin);
        }
    }

    .#{$prefix}grid-with-row-lines .#{$prefix}tree-checkbox {
        margin-top: top($tree-checkbox-margin) - 1;
    }

    .#{$prefix}tree-checkbox-checked {
        background-position: 0 (0 - $form-checkbox-size);
    }

    .#{$prefix}tree-drop-ok-append .#{$prefix}dd-drop-icon {
        background-image: theme-background-image($theme-name, 'tree/drop-append.gif');
    }

    .#{$prefix}tree-drop-ok-above .#{$prefix}dd-drop-icon {
        background-image: theme-background-image($theme-name, 'tree/drop-above.gif');
    }

    .#{$prefix}tree-drop-ok-below .#{$prefix}dd-drop-icon {
        background-image: theme-background-image($theme-name, 'tree/drop-below.gif');
    }

    .#{$prefix}tree-drop-ok-between .#{$prefix}dd-drop-icon {
        background-image: theme-background-image($theme-name, 'tree/drop-between.gif');
    }

    .#{$prefix}grid-tree-loading .#{$prefix}tree-icon {
        background-image: theme-background-image($theme-name, 'tree/loading.gif');
    }

    @if $include-rtl {
        .#{$prefix}grid-tree-loading .#{$prefix}rtl.#{$prefix}tree-icon {
            background-image: theme-background-image($theme-name, 'tree/loading.gif');
        }
    }

    .#{$prefix}tree-ddindicator {
        height: 1px;
        border-width: 1px 0px 0px;
        border-style: dotted;
        border-color: green;
    }

    .#{$prefix}grid-tree-loading span {
    	 font-style: italic;
    	 color: #444444;
    }

    .#{$prefix}tree-animator-wrap {
        overflow: hidden;
    }
}