/// class PD.Web.UI.Controls.OptionsMenuGridWidget
/// using PD.Web.UI.Controls.GridWidget

PD.Web.UI.Controls.OptionsMenuGridWidget =
PD.Web.UI.Controls.GridWidget.extend({

    //===================================
    // FIELDS
    //===================================

    _contextMenu: null,

    //===================================
    // PRIVATE METHODS
    //===================================

    template: function () {
        return [
            "<div class='-pd-widget' style='width:26px;padding-top:7px;'>",
                "<img src='" + PD.Path.to16x16("gearwheel.png") + "' style='cursor:pointer;' />",
            "</div>"
        ];
    },

    onActivate: function () {

        var that = this;

        this._contextMenu = new PD.Web.UI.Controls.ContextMenu({
            target: "#" + this.get_id(),
            showOn: "click",
            alignToAnchor: true,
            segments: new PD.Web.UI.Controls.ViewGridOptionsMenuSegment(function () {
                return that.get_grid()
            })
        });

        this.get_grid().get_children().add(this._contextMenu);

    }

});