/* This file is part of a free addon to MediaMonkey. In the absence of another license noted below, this source code is licensed for use and the creation of derivative works under the Ventis Limited Reciprocal License. See: https://www.mediamonkey.com/sw/mmw/5/Ventis_limited_reciprocal_license.txt */


LyricsWindow.prototype.override({
    initialize: function ($super, parentEl, params) {
        $super(parentEl, params);
        var UI = getAllUIElements(this.container);
        // Icon serves to undock on main window or to close on sub window
        var icon = window.isMainWindow ? 'mode_windowed' : 'close';
        var tooltip = window.isMainWindow ? 'Undock' : 'Close';
        var button = document.createElement('div');
        button.classList.add('noPadding', 'lvHeaderItem');
        button.innerHTML = '<div data-id="unDockBtn" data-icon="' + icon + '" data-tip="' + tooltip + '" style="" class="menuButton toolbutton" data-control-class="ToolButton"></div>';
        UI.header.appendChild(button);
        app.listen(button, 'click', () => {
            if (window.isMainWindow) {
                // Open the undocked control
                actions.undockLyrics.execute();
            }
            else {
                // Close the dialog
                closeWindow();
            }
        });
        initializeControl(qeid(button, 'unDockBtn'));
    }
});
