<template>
    <div class="ui-grid c-h40 win-ctrl-wrapper">
        <!-- <div class="ui-col-1 c-w20" @click="minWin">
            <i class="c-icon c-min-icon"></i>
        </div> -->
        <div class="ui-col-1 c-w20" @click="maxWin">
            <i class="c-icon" :class="[isMax?'c-max-icon':'c-unmax-icon']"></i>
        </div>
        <div class="ui-col-1 c-w20" @click="closeWin">
            <i class="c-icon c-close-icon"></i>
        </div>
    </div>
</template>
<style rel="stylesheet/scss" lang="scss" scoped>
$iconPath: "../../assets/images/";
.c-pr {
    position: relative;
}

.c-h40 {
    height: 40px;
}

.c-lh40 {
    line-height: 40px;
}

.c-w20 {
    width: 20px;
}

.win-ctrl-wrapper {
    -webkit-app-region: no-drag;
    .ui-col-1:hover {
        background-color: #e3e3e3;
    }
    i.c-icon {
        display: block;
        width: 10px;
        height: 40px;
        margin: 0 auto;
        background-repeat: no-repeat;
        background-position: 50%;
        cursor: pointer;
    }
    .c-min-icon {
        background-image: url($iconPath+'zuixiaohua_icon.png');
    }
    .c-max-icon {
        background-image: url($iconPath+'zuidahua_icon.png');
    }
    .c-unmax-icon {
        background-image: url($iconPath+'huanyuan_icon.png');
    }
    .c-close-icon {
        background-image: url($iconPath+'guanbi_icon.png');
    }
}
</style>
<script>
export default {
    props: [],
    components: {},
    mounted() {

    },
    data: function () {
        return {
            isMax: false
        }
    },
    methods: {
        minWin() {
            // this.$electron.ipcRenderer.send('mainWindow:minimize')
            this.$emit("minimize");
        },
        maxWin() {
            this.isMax = !this.isMax
            // this.$electron.ipcRenderer.send('mainWindow:maximize')
            this.$emit("maximize", this.isMax)
        },
        closeWin() {
            // this.$electron.ipcRenderer.send('mainWindow:close')
            // this.$electron.ipcRenderer.send('mainWindow:toTray')
            this.$emit("close");
        }
    }
}
</script>
