home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
AIMP2
/
aimp_2.61.583.exe
/
$TEMP
/
YandexPackSetup.msi
/
fil8049A1C41F24F9814B6309E2B851A81F
< prev
next >
Wrap
Text File
|
2010-07-12
|
2KB
|
62 lines
XB.UI.Behaviour.Button = XB.UI.Behaviour.IWithAction.extend({
nodeName: "toolbarbutton",
appendDropDownMenu: function XBUIButton_appendDropDownMenu(menuBehaviour) {
this._dropDownMenu = menuBehaviour;
this._updateButtonType();
},
removeDropDownMenu: function XBUIButton_appendDropDownMenu(menuBehaviour) {
if (this._dropDownMenu == menuBehaviour) {
delete this._dropDownMenu;
this._updateButtonType();
}
},
addAction: function (action) {
this.base(action);
this._updateButtonType();
},
removeAction: function (action) {
this.base(action);
this._updateButtonType();
},
addURL: function (url) {
this.base(url);
this._updateButtonType();
},
removeURL: function (url) {
this.base(url);
this._updateButtonType();
},
onAction: function(event) {
this.base(event);
if (event.type != "command")
return;
if (!this._action && !this._url && this._dropDownMenu) {
let btnBox = this.node.boxObject;
if (btnBox) {
let btnX = btnBox.x;
let btnY = btnBox.y;
this._dropDownMenu.node.openPopup(null, "", btnX, btnY + btnBox.height, false, false);
}
else
this._dropDownMenu.node.openPopup(this.node, "after_start", 0, 0, false, false);
}
},
_updateButtonType: function () {
if ((this._action || this._url) && this._dropDownMenu)
this.node.setAttribute("type", "menu-button");
else
this.node.removeAttribute("type");
}
});