2013-10-17 17:21:03 +00:00
|
|
|
/*!
|
2013-10-09 20:09:59 +00:00
|
|
|
* ObjectOriented UserInterface PopuppableElement class.
|
2013-10-17 17:21:03 +00:00
|
|
|
*
|
2013-10-09 20:09:59 +00:00
|
|
|
* @copyright 2011-2013 OOJS Team and others; see AUTHORS.txt
|
2013-10-17 17:21:03 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Popuppable element.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
* @cfg {number} [popupWidth=320] Width of popup
|
|
|
|
* @cfg {number} [popupHeight] Height of popup
|
|
|
|
* @cfg {Object} [popup] Configuration to pass to popup
|
|
|
|
*/
|
2013-10-09 20:09:59 +00:00
|
|
|
OO.ui.PopuppableElement = function OoUiPopuppableElement( config ) {
|
2013-10-17 17:21:03 +00:00
|
|
|
// Configuration initialization
|
2013-10-09 20:09:59 +00:00
|
|
|
config = OO.ui.extendObject( { 'popupWidth': 320 }, config );
|
2013-10-17 17:21:03 +00:00
|
|
|
|
|
|
|
// Properties
|
2013-10-09 20:09:59 +00:00
|
|
|
this.popup = new OO.ui.PopupWidget( OO.ui.extendObject(
|
2013-10-17 17:21:03 +00:00
|
|
|
{ 'align': 'center', 'autoClose': true },
|
|
|
|
config.popup,
|
|
|
|
{ '$$': this.$$, '$autoCloseIgnore': this.$ }
|
|
|
|
) );
|
|
|
|
this.popupWidth = config.popupWidth;
|
|
|
|
this.popupHeight = config.popupHeight;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get popup.
|
|
|
|
*
|
|
|
|
* @method
|
2013-10-09 20:09:59 +00:00
|
|
|
* @returns {OO.ui.PopupWidget} Popup widget
|
2013-10-17 17:21:03 +00:00
|
|
|
*/
|
2013-10-09 20:09:59 +00:00
|
|
|
OO.ui.PopuppableElement.prototype.getPopup = function () {
|
2013-10-17 17:21:03 +00:00
|
|
|
return this.popup;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show popup.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
2013-10-09 20:09:59 +00:00
|
|
|
OO.ui.PopuppableElement.prototype.showPopup = function () {
|
2013-10-17 17:21:03 +00:00
|
|
|
this.popup.show().display( this.popupWidth, this.popupHeight );
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide popup.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
2013-10-09 20:09:59 +00:00
|
|
|
OO.ui.PopuppableElement.prototype.hidePopup = function () {
|
2013-10-17 17:21:03 +00:00
|
|
|
this.popup.hide();
|
|
|
|
};
|