r21325: delete children in reverse order since the array is manipulated during the...
[samba.git] / webapps / qooxdoo-0.6.3-sdk / frontend / framework / source / class / qx / ui / form / InputCheckSymbol.js
1 /* ************************************************************************
2
3    qooxdoo - the new era of web development
4
5    http://qooxdoo.org
6
7    Copyright:
8      2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org
9
10    License:
11      LGPL 2.1: http://www.gnu.org/licenses/lgpl.html
12
13    Authors:
14      * Sebastian Werner (wpbasti)
15      * Andreas Ecker (ecker)
16
17 ************************************************************************ */
18
19 /* ************************************************************************
20
21 #module(ui_form)
22
23 ************************************************************************ */
24
25 qx.OO.defineClass("qx.ui.form.InputCheckSymbol", qx.ui.basic.Terminator,
26 function()
27 {
28   qx.ui.basic.Terminator.call(this);
29
30   this.setTagName("input");
31   this.setSelectable(false);
32
33   if (qx.sys.Client.getInstance().isMshtml())
34   {
35     // Take control over size of element (mshtml)
36     this.setWidth(13);
37     this.setHeight(13);
38   }
39   else if (qx.sys.Client.getInstance().isGecko())
40   {
41     // Remove gecko default margin
42     this.setMargin(0);
43   }
44
45   // we need to be sure that the dom protection of this is added
46   this.forceTabIndex(1);
47   this.setTabIndex(-1);
48   this.setChecked(false);
49 });
50
51 qx.OO.addProperty({ name : "name", type : "string", impl : "apply" });
52 qx.OO.addProperty({ name : "value", impl : "apply" });
53 qx.OO.addProperty({ name : "type", impl : "apply" });
54 qx.OO.addProperty({ name : "checked", type : "boolean", impl : "apply", getAlias : "isChecked" });
55
56 qx.Proto._modifyApply = function(propValue, propOldValue, propData) {
57   return this.setHtmlProperty(propData.name, propValue);
58 }
59
60 qx.Proto.getPreferredBoxWidth = function() {
61   return 13;
62 }
63
64 qx.Proto.getPreferredBoxHeight = function() {
65   return 13;
66 }
67
68 qx.Proto.getBoxWidth = qx.Proto.getPreferredBoxWidth;
69 qx.Proto.getBoxHeight = qx.Proto.getPreferredBoxHeight;
70
71 qx.Proto.getInnerWidth = qx.Proto.getPreferredBoxWidth;
72 qx.Proto.getInnerHeight = qx.Proto.getPreferredBoxHeight;
73
74 if (qx.sys.Client.getInstance().isMshtml())
75 {
76   qx.Proto._afterAppear = function()
77   {
78     qx.ui.basic.Terminator.prototype._afterAppear.call(this);
79
80     var vElement = this.getElement();
81     vElement.checked = this.getChecked();
82
83     if (!this.getEnabled()) {
84       vElement.disabled = true;
85     }
86   }
87 }
88
89 qx.Proto._modifyEnabled = function(propValue, propOldValue, propData)
90 {
91   propValue ? this.removeHtmlAttribute("disabled") : this.setHtmlAttribute("disabled", "disabled");
92   return qx.ui.basic.Terminator.prototype._modifyEnabled.call(this, propValue, propOldValue, propData);
93 }