[qooxdoo-commit] SF.net SVN: qooxdoo:[14744] trunk/qooxdoo/frontend/framework/source/class/ qx/ui/m
Brought to you by:
ecker,
martinwittemann
From: <wp...@us...> - 2008-07-23 12:05:59
|
Revision: 14744 http://qooxdoo.svn.sourceforge.net/qooxdoo/?rev=14744&view=rev Author: wpbasti Date: 2008-07-23 12:05:55 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Added support for mouseup events. Added two new Widgets a menu radiobutton and a menu checkbox. Modified Paths: -------------- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/AbstractButton.js trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Button.js trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Menu.js Added Paths: ----------- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/CheckBox.js trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/RadioButton.js Modified: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/AbstractButton.js =================================================================== --- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/AbstractButton.js 2008-07-23 12:00:55 UTC (rev 14743) +++ trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/AbstractButton.js 2008-07-23 12:05:55 UTC (rev 14744) @@ -41,6 +41,9 @@ // Use hard coded layout this._setLayout(new qx.ui.layout.MenuButton); + + // Add mouse listeners + this.addListener("mouseup", this._onMouseUp); }, @@ -186,8 +189,24 @@ + /* + --------------------------------------------------------------------------- + EVENT LISTENERS + --------------------------------------------------------------------------- + */ + /** + * Event listener for mouseup event + * + * @param e {qx.event.type.Mouse} Mouse event + */ + _onMouseUp : function(e) { + // pass + }, + + + /* --------------------------------------------------------------------------- PROPERTY APPLY ROUTINES Modified: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Button.js =================================================================== --- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Button.js 2008-07-23 12:00:55 UTC (rev 14743) +++ trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Button.js 2008-07-23 12:05:55 UTC (rev 14744) @@ -104,6 +104,12 @@ */ _onChangeCommand : function(e) { this._getChildControl("shortcut").setContent(e.getData().toString()); + }, + + + // overridden + _onMouseUp : function(e) { + this.execute(); } } }); Added: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/CheckBox.js =================================================================== --- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/CheckBox.js (rev 0) +++ trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/CheckBox.js 2008-07-23 12:05:55 UTC (rev 14744) @@ -0,0 +1,116 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2008 1&1 Internet AG, Germany, http://www.1und1.de + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Fabian Jakobs (fjakobs) + +************************************************************************ */ + +qx.Class.define("qx.ui.menu.CheckBox", +{ + extend : qx.ui.menu.AbstractButton, + + + + /* + ***************************************************************************** + CONSTRUCTOR + ***************************************************************************** + */ + + construct : function(label, menu) + { + this.base(arguments); + + // Initialize with incoming arguments + if (label != null) { + this.setLabel(label); + } + + if (menu != null) { + this.setMenu(menu); + } + }, + + + + + /* + ***************************************************************************** + PROPERTIES + ***************************************************************************** + */ + + properties : + { + // overridden + appearance : + { + refine : true, + init : "menu-checkbox" + }, + + /** The value of the widget. Mainly used for serialization proposes. */ + value : + { + check : "String", + nullable : true, + event : "changeValue" + }, + + /** The name of the widget. Mainly used for serialization proposes. */ + name : + { + check : "String", + nullable : true, + event : "changeName" + }, + + /** Whether the button is checked */ + checked : + { + check : "Boolean", + init : false, + apply : "_applyChecked" + } + }, + + + + + + /* + ***************************************************************************** + MEMBERS + ***************************************************************************** + */ + + members : + { + // property apply + _applyChecked : function(value, old) + { + value ? + this.addState("checked") : + this.removeState("checked"); + }, + + + // overridden + _onMouseUp : function(e) { + this.toggleChecked(); + } + } +}); Property changes on: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/CheckBox.js ___________________________________________________________________ Added: svn:executable + * Modified: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Menu.js =================================================================== --- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Menu.js 2008-07-23 12:00:55 UTC (rev 14743) +++ trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/Menu.js 2008-07-23 12:05:55 UTC (rev 14744) @@ -416,7 +416,7 @@ // Change selection var target = e.getTarget(); - if (target instanceof qx.ui.menu.Button) + if (target instanceof qx.ui.menu.AbstractButton) { // Select button directly this.setSelectedButton(target); Added: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/RadioButton.js =================================================================== --- trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/RadioButton.js (rev 0) +++ trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/RadioButton.js 2008-07-23 12:05:55 UTC (rev 14744) @@ -0,0 +1,139 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2008 1&1 Internet AG, Germany, http://www.1und1.de + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Fabian Jakobs (fjakobs) + +************************************************************************ */ + +qx.Class.define("qx.ui.menu.RadioButton", +{ + extend : qx.ui.menu.AbstractButton, + implement : qx.ui.form.IRadioItem, + + + + /* + ***************************************************************************** + CONSTRUCTOR + ***************************************************************************** + */ + + construct : function(label, menu) + { + this.base(arguments); + + // Initialize with incoming arguments + if (label != null) { + this.setLabel(label); + } + + if (menu != null) { + this.setMenu(menu); + } + }, + + + + + /* + ***************************************************************************** + PROPERTIES + ***************************************************************************** + */ + + properties : + { + // overridden + appearance : + { + refine : true, + init : "menu-radiobutton" + }, + + /** The value of the widget. Mainly used for serialization proposes. */ + value : + { + check : "String", + nullable : true, + event : "changeValue" + }, + + /** The name of the widget. Mainly used for serialization proposes. */ + name : + { + check : "String", + nullable : true, + event : "changeName" + }, + + /** The assigned qx.ui.form.RadioGroup which handles the switching between registered buttons */ + group : + { + check : "qx.ui.form.RadioGroup", + nullable : true, + apply : "_applyGroup" + }, + + /** Boolean value signals if the button is checked */ + checked: + { + check: "Boolean", + init: false, + apply: "_applyChecked", + event: "changeChecked" + } + }, + + + + + + /* + ***************************************************************************** + MEMBERS + ***************************************************************************** + */ + + members : + { + // property apply + _applyChecked : function(value, old) + { + value ? + this.addState("checked") : + this.removeState("checked"); + }, + + + // property apply + _applyGroup : function(value, old) + { + if (old) { + old.remove(this); + } + + if (value) { + value.add(this); + } + }, + + + // overridden + _onMouseUp : function(e) { + this.setChecked(true); + } + } +}); Property changes on: trunk/qooxdoo/frontend/framework/source/class/qx/ui/menu/RadioButton.js ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |