Source: widgets/player/miniepg.js

define('application/widgets/player/miniepg', [
    'rofl/widgets/container',
    'rofl/widgets/label',
    'rofl/lib/l10n',
    'application/widgets/player/miniepg/carousel'
], function (
    Container,
    Label,
    L10N,
    MiniEpgCarousel
) {
    'use strict';

    var l10n = L10N.getInstance();

    return Container.extend({

        /**
         * Initialises the widget.
         */
        init: function init () {
            init.base.call(this, 'mini-epg');

            this._title = this.appendChildWidget(new Label({
                text: l10n.get('miniepg.title'),
                classNames: 'title'
            }));

            this._subtitle = this.appendChildWidget(new Label({
                text: l10n.get('miniepg.subtitle'),
                classNames: 'subtitle'
            }));

            this._carousel = this.appendChildWidget(new MiniEpgCarousel());
        },

        /**
         * Sets the current channel index.
         *
         * @param {number} index - The channel index.
         */
        setChannel: function (index) {
            this._carousel.setChannel(index);
        },

        /**
         * Focuses the carousel.
         */
        focus: function () {
            this._carousel.focus();
        },

        /**
         * Set miniEPG as focusable or not.
         *
         * @param {boolean} focusable - True to set miniEPG focusable, false not focusable.
         */
        setFocusable: function (focusable) {
            this._carousel.setFocusable(focusable);
        },

        /**
         * Determines if the widget is focusable.
         *
         * @returns {boolean} - True if the widget is focusable.
         */
        isFocusable: function isFocusable () {
            return this._carousel.isFocusable();
        },

        /**
         * Checks if miniEPG is expanded.
         *
         * @returns {boolean} - True if miniEPG is expanded.
         */
        isExpanded: function () {
            return this.hasClass('expand');
        }
    });
});