r20514: implement idl for DsGetNT4ChangeLog() which transferres the meta data
[ira/wip.git] / webapps / qooxdoo-0.6.3-sdk / frontend / framework / source / class / qx / ui / toolbar / RadioButton.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_toolbar)
22
23 ************************************************************************ */
24
25 qx.OO.defineClass("qx.ui.toolbar.RadioButton", qx.ui.toolbar.CheckBox,
26 function(vText, vIcon, vChecked) {
27   qx.ui.toolbar.CheckBox.call(this, vText, vIcon, vChecked);
28 });
29
30
31
32
33 /*
34 ---------------------------------------------------------------------------
35   PROPERTIES
36 ---------------------------------------------------------------------------
37 */
38
39 /*!
40   The assigned qx.manager.selection.RadioManager which handles the switching between registered buttons
41 */
42 qx.OO.addProperty({ name : "manager", type : "object", instance : "qx.manager.selection.RadioManager", allowNull : true });
43
44 /*!
45   The name of the radio group. All the radio elements in a group (registered by the same manager)
46   have the same name (and could have a different value).
47 */
48 qx.OO.addProperty({ name : "name", type : "string" });
49
50 /*!
51   Prohibit the deselction of the checked radio button when clicked on it.
52 */
53 qx.OO.addProperty({ name : "disableUncheck", type : "boolean", defaultValue : false });
54
55
56
57
58
59
60 /*
61 ---------------------------------------------------------------------------
62   MODIFIER
63 ---------------------------------------------------------------------------
64 */
65
66 qx.Proto._modifyChecked = function(propValue, propOldValue, propData)
67 {
68   qx.ui.toolbar.CheckBox.prototype._modifyChecked.call(this, propValue, propOldValue, propData);
69
70   var vManager = this.getManager();
71   if (vManager) {
72     vManager.handleItemChecked(this, propValue);
73   }
74
75   return true;
76 }
77
78 qx.Proto._modifyManager = function(propValue, propOldValue, propData)
79 {
80   if (propOldValue) {
81     propOldValue.remove(this);
82   }
83
84   if (propValue) {
85     propValue.add(this);
86   }
87
88   return true;
89 }
90
91
92
93
94
95 /*
96 ---------------------------------------------------------------------------
97   EVENTS
98 ---------------------------------------------------------------------------
99 */
100
101 qx.Proto._onmouseup = function(e)
102 {
103   this.setCapture(false);
104
105   if (!this.hasState("abandoned"))
106   {
107     this.addState("over");
108     this.setChecked(this.getDisableUncheck() || !this.getChecked());
109     this.execute();
110   }
111
112   this.removeState("abandoned");
113   this.removeState("pressed");
114
115   e.stopPropagation();
116 }