

function textwidget(){	
	
	var twidget = new Widget({
		style: 'margin: 4px; float: left; width: 80px; height: 80px; position: relative; z-index: 1000000;', 
		className: 'draggable cloneable unselectable',
		set: 'text',
		id: 'Default-Widget-13',
		init: function(){
			if (!activepanel){
			
				this.hoverin = function(){
					if (!activepanel) this.element.style.backgroundColor = 'rgba(128, 128, 128, 0.2)';
				};
				
				this.hoverout = function(){
					if (!activepanel) this.element.style.backgroundColor = 'rgba(0, 0, 0, 0.0)';
				};
				
				this.doubleclick = function(){
					if (this.panel){
						if (pb.project.textEditing == this.parts[0]) return;
						
						$(this.parts[0].element).attr('contenteditable', 'true');
						$(this.parts[0].element).removeClass('item_child');
						
						if (!this.core.dirty) this.parts[0].element.innerHTML = '';
						this.core.dirty = true;
						
						CKEDITOR.inline(this.parts[0].element);   	
						$(this.parts[0].element).focus();
						pb.project.textEditing = this.parts[0];
						pb.unselectAll();
						
						$(this.parts[0].element).addClass('selectable');
					}
				};
				
			}
			else {
				var self = this;
				this.setText = function(text){
					self.parts[0].element.innerHTML = text;
				}
				this.getText = function(){
					if (self.parts[0].element.innerHTML === '<div class="item_child selectable" style="cursor: default; position: absolute; left: 23px; top: 27px; font-family: Time; color: black; font-size: 23px;">Text</div>') return 'Text';
					else return self.parts[0].element.innerHTML;
				}
				this.setTextStyle = function(style){
					$(self.parts[0].element).css(style);;
				}
			}
		}
	});

	var tpart = new WidgetPart({
		widget: twidget, 
		style: 'position: absolute; left: 0%; top: 0%; z-index: 100000; width: 100%; height: 100%;', 
		className: 'item_child unselectable',
		elementHTML: '<div class="item_child selectable" style="cursor: default; position: absolute; left: 23px; top: 27px; font-family: Time; color: black; font-size: 23px;">Text</div>'
	});
	twidget.addPart(tpart);
	
	return twidget;
	
}