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
 
11
dojo.provide("dojo.widget.HtmlWidget");
12
dojo.require("dojo.widget.DomWidget");
13
dojo.require("dojo.html.util");
14
dojo.require("dojo.html.display");
15
dojo.require("dojo.html.layout");
16
dojo.require("dojo.lang.extras");
17
dojo.require("dojo.lang.func");
18
dojo.require("dojo.lfx.toggle");
19
dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, {templateCssPath:null, templatePath:null, lang:"", toggle:"plain", toggleDuration:150, initialize:function (args, frag) {
20
}, postMixInProperties:function (args, frag) {
21
	if (this.lang === "") {
22
		this.lang = null;
23
	}
24
	this.toggleObj = dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain;
25
}, createNodesFromText:function (txt, wrap) {
26
	return dojo.html.createNodesFromText(txt, wrap);
27
}, destroyRendering:function (finalize) {
28
	try {
29
		if (this.bgIframe) {
30
			this.bgIframe.remove();
31
			delete this.bgIframe;
32
		}
33
		if (!finalize && this.domNode) {
34
			dojo.event.browser.clean(this.domNode);
35
		}
36
		dojo.widget.HtmlWidget.superclass.destroyRendering.call(this);
37
	}
38
	catch (e) {
39
	}
40
}, isShowing:function () {
41
	return dojo.html.isShowing(this.domNode);
42
}, toggleShowing:function () {
43
	if (this.isShowing()) {
44
		this.hide();
45
	} else {
46
		this.show();
47
	}
48
}, show:function () {
49
	if (this.isShowing()) {
50
		return;
51
	}
52
	this.animationInProgress = true;
53
	this.toggleObj.show(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onShow), this.explodeSrc);
54
}, onShow:function () {
55
	this.animationInProgress = false;
56
	this.checkSize();
57
}, hide:function () {
58
	if (!this.isShowing()) {
59
		return;
60
	}
61
	this.animationInProgress = true;
62
	this.toggleObj.hide(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onHide), this.explodeSrc);
63
}, onHide:function () {
64
	this.animationInProgress = false;
65
}, _isResized:function (w, h) {
66
	if (!this.isShowing()) {
67
		return false;
68
	}
69
	var wh = dojo.html.getMarginBox(this.domNode);
70
	var width = w || wh.width;
71
	var height = h || wh.height;
72
	if (this.width == width && this.height == height) {
73
		return false;
74
	}
75
	this.width = width;
76
	this.height = height;
77
	return true;
78
}, checkSize:function () {
79
	if (!this._isResized()) {
80
		return;
81
	}
82
	this.onResized();
83
}, resizeTo:function (w, h) {
84
	dojo.html.setMarginBox(this.domNode, {width:w, height:h});
85
	if (this.isShowing()) {
86
		this.onResized();
87
	}
88
}, resizeSoon:function () {
89
	if (this.isShowing()) {
90
		dojo.lang.setTimeout(this, this.onResized, 0);
91
	}
92
}, onResized:function () {
93
	dojo.lang.forEach(this.children, function (child) {
94
		if (child.checkSize) {
95
			child.checkSize();
96
		}
97
	});
98
}});
99