1 var HighlightColorPickerWidget
= require( './HighlightColorPickerWidget.js' ),
4 * A popup containing a color picker, for setting highlight colors.
6 * @class mw.rcfilters.ui.HighlightPopupWidget
7 * @extends OO.ui.PopupWidget
10 * @param {mw.rcfilters.Controller} controller RCFilters controller
11 * @param {Object} [config] Configuration object
13 HighlightPopupWidget
= function MwRcfiltersUiHighlightPopupWidget( controller
, config
) {
14 config
= config
|| {};
17 HighlightPopupWidget
.parent
.call( this, $.extend( {
22 horizontalPosition
: 'end',
26 this.colorPicker
= new HighlightColorPickerWidget( controller
);
28 this.colorPicker
.connect( this, { chooseColor
: 'onChooseColor' } );
30 this.$body
.append( this.colorPicker
.$element
);
35 OO
.inheritClass( HighlightPopupWidget
, OO
.ui
.PopupWidget
);
40 * Set the button (or other widget) that this popup should hang off.
42 * @param {OO.ui.Widget} widget Widget the popup should orient itself to
44 HighlightPopupWidget
.prototype.setAssociatedButton = function ( widget
) {
45 this.setFloatableContainer( widget
.$element
);
46 this.$autoCloseIgnore
= widget
.$element
;
50 * Set the filter item that this popup should control the highlight color for.
52 * @param {mw.rcfilters.dm.FilterItem} item
54 HighlightPopupWidget
.prototype.setFilterItem = function ( item
) {
55 this.colorPicker
.setFilterItem( item
);
59 * When the user chooses a color in the color picker, close the popup.
61 HighlightPopupWidget
.prototype.onChooseColor = function () {
65 module
.exports
= HighlightPopupWidget
;