Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
1422 alexandre_ 11
 
12
 
1318 alexandre_ 13
dojo.provide("dojo.widget.HtmlWidget");
14
dojo.require("dojo.widget.DomWidget");
15
dojo.require("dojo.html.util");
16
dojo.require("dojo.html.display");
17
dojo.require("dojo.html.layout");
18
dojo.require("dojo.lang.extras");
19
dojo.require("dojo.lang.func");
20
dojo.require("dojo.lfx.toggle");
21
dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, {templateCssPath:null, templatePath:null, lang:"", toggle:"plain", toggleDuration:150, initialize:function (args, frag) {
22
}, postMixInProperties:function (args, frag) {
23
	if (this.lang === "") {
24
		this.lang = null;
25
	}
26
	this.toggleObj = dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain;
27
}, createNodesFromText:function (txt, wrap) {
28
	return dojo.html.createNodesFromText(txt, wrap);
29
}, destroyRendering:function (finalize) {
30
	try {
31
		if (this.bgIframe) {
32
			this.bgIframe.remove();
33
			delete this.bgIframe;
34
		}
35
		if (!finalize && this.domNode) {
36
			dojo.event.browser.clean(this.domNode);
37
		}
38
		dojo.widget.HtmlWidget.superclass.destroyRendering.call(this);
39
	}
40
	catch (e) {
41
	}
42
}, isShowing:function () {
43
	return dojo.html.isShowing(this.domNode);
44
}, toggleShowing:function () {
45
	if (this.isShowing()) {
46
		this.hide();
47
	} else {
48
		this.show();
49
	}
50
}, show:function () {
51
	if (this.isShowing()) {
52
		return;
53
	}
54
	this.animationInProgress = true;
55
	this.toggleObj.show(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onShow), this.explodeSrc);
56
}, onShow:function () {
57
	this.animationInProgress = false;
58
	this.checkSize();
59
}, hide:function () {
60
	if (!this.isShowing()) {
61
		return;
62
	}
63
	this.animationInProgress = true;
64
	this.toggleObj.hide(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onHide), this.explodeSrc);
65
}, onHide:function () {
66
	this.animationInProgress = false;
67
}, _isResized:function (w, h) {
68
	if (!this.isShowing()) {
69
		return false;
70
	}
71
	var wh = dojo.html.getMarginBox(this.domNode);
72
	var width = w || wh.width;
73
	var height = h || wh.height;
74
	if (this.width == width && this.height == height) {
75
		return false;
76
	}
77
	this.width = width;
78
	this.height = height;
79
	return true;
80
}, checkSize:function () {
81
	if (!this._isResized()) {
82
		return;
83
	}
84
	this.onResized();
85
}, resizeTo:function (w, h) {
86
	dojo.html.setMarginBox(this.domNode, {width:w, height:h});
87
	if (this.isShowing()) {
88
		this.onResized();
89
	}
90
}, resizeSoon:function () {
91
	if (this.isShowing()) {
92
		dojo.lang.setTimeout(this, this.onResized, 0);
93
	}
94
}, onResized:function () {
95
	dojo.lang.forEach(this.children, function (child) {
96
		if (child.checkSize) {
97
			child.checkSize();
98
		}
99
	});
100
}});
101