/*
 * Copyright (c) 2011 by RibbonSoft, GmbH. All rights reserved.
 * 
 * This file is part of the QCAD project.
 *
 * Licensees holding valid QCAD Professional Edition licenses 
 * may use this file in accordance with the QCAD License
 * Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, 
 * INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS 
 * FOR A PARTICULAR PURPOSE.
 * 
 * See http://www.ribbonsoft.com for further details.
 */

/**
 * The options toolbar is created and initialized here.
 */
function OptionsToolBar() {
}

OptionsToolBar.postInit = function(basePath) {
    var optionsToolBar = EAction.getOptionsToolBar();
    var sh = EAction.getMainWindow().findChild("FileToolBar").sizeHint;
    var h = sh.height();
    if (RS.getSystemId()=="win") {
        h = 32;
    }
    optionsToolBar.setFixedHeight(h);
    var flags = new Qt.ToolBarAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea);
    optionsToolBar.setAllowedAreas(flags);

    var iconLabel = new QLabel(optionsToolBar);
    iconLabel.objectName = "Icon";
    iconLabel.alignment = Qt.AlignCenter;
    iconLabel.setContentsMargins(6, 0, 6, 0);
    iconLabel.styleSheet =
        "QLabel {"
        + "border-radius: 6px; "
        + "background-color: "
        + "    qlineargradient(spread:pad, "
        + "        x1: 0, y1: 0, "
        + "        x2: 0, y2: 1, "
        + "        stop: 0 rgba(255,255,255,0), "
        + "        stop: 0.5 rgba(255,255,255,192), "
        + "        stop: 1 rgba(255,255,255,0) "
        + "    ); "
        + "border: 2px solid #8f8f8f;"
        + "margin: 2px 2px 2px 2px;"
        + "}";

    // avoid empty label after startup, before initializing new document:
    iconLabel.pixmap =
            new QIcon("scripts/Reset/Reset.svg").pixmap(
                optionsToolBar.iconSize
            );
    optionsToolBar.addWidget(iconLabel);
    optionsToolBar.addSeparator();
};
