/**@license setplus: a lightweight HTML editor
 * @author  Levente Hunyadi
 * @version 0.2.0
 * @remarks Copyright (C) 2010-2011 Levente Hunyadi
 * @remarks Licensed under GNU/GPLv3, see http://www.gnu.org/licenses/gpl-3.0.html
 * @see     http://hunyadi.info.hu/projects/setplus
 **/

/*
* setplus: a lightweight HTML editor
* Copyright 2010-2011 Levente Hunyadi
*
* setplus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* setplus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with setplus.  If not, see <http://www.gnu.org/licenses/>.
*/

setplus.PlainTextDialog = new Class({
	'Extends': setplus.EditorDialog,

	'initialize': function () {
		var self = this;
		self.parent();

		self._title.adopt(
			new Element('span', {
				'class': 'setplus-plaintext-title'
			})
		);

		self._content.adopt(
			self._text = new Element('textarea', {
				'rows': 15,
				'cols': 80,
				'class': 'setplus-plaintext-area'
			}),
			new Element('button', {
				'type': 'button',
				'html': 'OK',
				'events': {
					'click': self.invoke.bind(self, function (editor) {
						// insert plain text
						editor.pasteplain(self._text.get('value'));

						// close pop-up window
						self.hide();
					})
				}
			})
		)
	},

	'assign': function () {
		this._text.set('value', '');
	}
});