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 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.widget.Menu2");
|
|
|
14 |
dojo.require("dojo.widget.PopupContainer");
|
|
|
15 |
dojo.declare("dojo.widget.MenuBase", null, function () {
|
|
|
16 |
this.eventNames = {open:""};
|
|
|
17 |
}, {isContainer:true, isMenu:true, eventNaming:"default", templateCssString:"\n.dojoPopupMenu2 {\n\tposition: absolute;\n\tborder: 1px solid #7298d0;\n\tbackground:#85aeec url(images/soriaMenuBg.gif) repeat-x bottom left !important;\n\tpadding: 1px;\n\tmargin-top: 1px;\n\tmargin-bottom: 1px;\n}\n\n.dojoMenuItem2{\n\twhite-space: nowrap;\n\tfont: menu;\n\tmargin: 0;\n}\n\n.dojoMenuItem2Hover {\n\tbackground-color: #D2E4FD;\n\tcursor:pointer;\n\tcursor:hand;\n}\n\n.dojoMenuItem2Icon {\n\tposition: relative;\n\tbackground-position: center center;\n\tbackground-repeat: no-repeat;\n\twidth: 16px;\n\theight: 16px;\n\tpadding-right: 3px;\n}\n\n.dojoMenuItem2Label {\n\tposition: relative;\n\tvertical-align: middle;\n}\n\n/* main label text */\n.dojoMenuItem2Label {\n\tposition: relative;\n\tvertical-align: middle;\n}\n\n.dojoMenuItem2Accel {\n\tposition: relative;\n\tvertical-align: middle;\n\tpadding-left: 3px;\n}\n\n.dojoMenuItem2Disabled .dojoMenuItem2Label,\n.dojoMenuItem2Disabled .dojoMenuItem2Accel {\n\tcolor: #607a9e;\n}\n\n.dojoMenuItem2Submenu {\n\tposition: relative;\n\tbackground-position: center center;\n\tbackground-repeat: no-repeat;\n\tbackground-image: url(images/submenu_off.gif);\n\twidth: 5px;\n\theight: 9px;\n\tpadding-left: 3px;\n}\n.dojoMenuItem2Hover .dojoMenuItem2Submenu {\n\tbackground-image: url(images/submenu_on.gif);\n}\n\n.dojoMenuItem2Disabled .dojoMenuItem2Submenu {\n\tbackground-image: url(images/submenu_disabled.gif);\n}\n\n.dojoMenuSeparator2 {\n\tfont-size: 1px;\n\tmargin: 0;\n}\n\n.dojoMenuSeparator2Top {\n\theight: 50%;\n\tborder-bottom: 1px solid #7a98c4;\n\tmargin: 0px 2px;\n\tfont-size: 1px;\n}\n\n.dojoMenuSeparator2Bottom {\n\theight: 50%;\n\tborder-top: 1px solid #c9deff;\n\tmargin: 0px 2px;\n\tfont-size: 1px;\n}\n\n.dojoMenuBar2 {\n\tbackground:#85aeec url(images/soriaBarBg.gif) repeat-x top left;\n\t/*border-bottom:1px solid #6b9fec;*/\n\tpadding: 1px;\n}\n\n.dojoMenuBar2 .dojoMenuItem2 {\n\twhite-space: nowrap;\n\tfont: menu;\n\tmargin: 0;\n\tposition: relative;\n\tvertical-align: middle;\n\tz-index: 1;\n\tpadding: 3px 8px;\n\tdisplay: inline;/* needed in khtml to display correctly */\n\tdisplay: -moz-inline-box;/* needed in firefox */\n\tcursor:pointer;\n\tcursor:hand;\n}\n\n.dojoMenuBar2 .dojoMenuItem2Hover {\n\tbackground-color:#d2e4fd;\n}\n\n.dojoMenuBar2 .dojoMenuItem2Disabled span {\n\tcolor: #4f6582;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/Menu2.css"), submenuDelay:500, initialize:function (args, frag) {
|
|
|
18 |
if (this.eventNaming == "default") {
|
|
|
19 |
for (var eventName in this.eventNames) {
|
|
|
20 |
this.eventNames[eventName] = this.widgetId + "/" + eventName;
|
|
|
21 |
}
|
|
|
22 |
}
|
|
|
23 |
}, _moveToNext:function (evt) {
|
|
|
24 |
this._highlightOption(1);
|
|
|
25 |
return true;
|
|
|
26 |
}, _moveToPrevious:function (evt) {
|
|
|
27 |
this._highlightOption(-1);
|
|
|
28 |
return true;
|
|
|
29 |
}, _moveToParentMenu:function (evt) {
|
|
|
30 |
if (this._highlighted_option && this.parentMenu) {
|
|
|
31 |
if (evt._menu2UpKeyProcessed) {
|
|
|
32 |
return true;
|
|
|
33 |
} else {
|
|
|
34 |
this._highlighted_option.onUnhover();
|
|
|
35 |
this.closeSubmenu();
|
|
|
36 |
evt._menu2UpKeyProcessed = true;
|
|
|
37 |
}
|
|
|
38 |
}
|
|
|
39 |
return false;
|
|
|
40 |
}, _moveToChildMenu:function (evt) {
|
|
|
41 |
if (this._highlighted_option && this._highlighted_option.submenuId) {
|
|
|
42 |
this._highlighted_option._onClick(true);
|
|
|
43 |
return true;
|
|
|
44 |
}
|
|
|
45 |
return false;
|
|
|
46 |
}, _selectCurrentItem:function (evt) {
|
|
|
47 |
if (this._highlighted_option) {
|
|
|
48 |
this._highlighted_option._onClick();
|
|
|
49 |
return true;
|
|
|
50 |
}
|
|
|
51 |
return false;
|
|
|
52 |
}, processKey:function (evt) {
|
|
|
53 |
if (evt.ctrlKey || evt.altKey || !evt.key) {
|
|
|
54 |
return false;
|
|
|
55 |
}
|
|
|
56 |
var rval = false;
|
|
|
57 |
switch (evt.key) {
|
|
|
58 |
case evt.KEY_DOWN_ARROW:
|
|
|
59 |
rval = this._moveToNext(evt);
|
|
|
60 |
break;
|
|
|
61 |
case evt.KEY_UP_ARROW:
|
|
|
62 |
rval = this._moveToPrevious(evt);
|
|
|
63 |
break;
|
|
|
64 |
case evt.KEY_RIGHT_ARROW:
|
|
|
65 |
rval = this._moveToChildMenu(evt);
|
|
|
66 |
break;
|
|
|
67 |
case evt.KEY_LEFT_ARROW:
|
|
|
68 |
rval = this._moveToParentMenu(evt);
|
|
|
69 |
break;
|
|
|
70 |
case " ":
|
|
|
71 |
case evt.KEY_ENTER:
|
|
|
72 |
if (rval = this._selectCurrentItem(evt)) {
|
|
|
73 |
break;
|
|
|
74 |
}
|
|
|
75 |
case evt.KEY_ESCAPE:
|
|
|
76 |
case evt.KEY_TAB:
|
|
|
77 |
this.close(true);
|
|
|
78 |
rval = true;
|
|
|
79 |
break;
|
|
|
80 |
}
|
|
|
81 |
return rval;
|
|
|
82 |
}, _findValidItem:function (dir, curItem) {
|
|
|
83 |
if (curItem) {
|
|
|
84 |
curItem = dir > 0 ? curItem.getNextSibling() : curItem.getPreviousSibling();
|
|
|
85 |
}
|
|
|
86 |
for (var i = 0; i < this.children.length; ++i) {
|
|
|
87 |
if (!curItem) {
|
|
|
88 |
curItem = dir > 0 ? this.children[0] : this.children[this.children.length - 1];
|
|
|
89 |
}
|
|
|
90 |
if (curItem.onHover && curItem.isShowing()) {
|
|
|
91 |
return curItem;
|
|
|
92 |
}
|
|
|
93 |
curItem = dir > 0 ? curItem.getNextSibling() : curItem.getPreviousSibling();
|
|
|
94 |
}
|
|
|
95 |
}, _highlightOption:function (dir) {
|
|
|
96 |
var item;
|
|
|
97 |
if ((!this._highlighted_option)) {
|
|
|
98 |
item = this._findValidItem(dir);
|
|
|
99 |
} else {
|
|
|
100 |
item = this._findValidItem(dir, this._highlighted_option);
|
|
|
101 |
}
|
|
|
102 |
if (item) {
|
|
|
103 |
if (this._highlighted_option) {
|
|
|
104 |
this._highlighted_option.onUnhover();
|
|
|
105 |
}
|
|
|
106 |
item.onHover();
|
|
|
107 |
dojo.html.scrollIntoView(item.domNode);
|
|
|
108 |
try {
|
|
|
109 |
var node = dojo.html.getElementsByClass("dojoMenuItem2Label", item.domNode)[0];
|
|
|
110 |
node.focus();
|
|
|
111 |
}
|
|
|
112 |
catch (e) {
|
|
|
113 |
}
|
|
|
114 |
}
|
|
|
115 |
}, onItemClick:function (item) {
|
|
|
116 |
}, closeSubmenu:function (force) {
|
|
|
117 |
if (this.currentSubmenu == null) {
|
|
|
118 |
return;
|
|
|
119 |
}
|
|
|
120 |
this.currentSubmenu.close(force);
|
|
|
121 |
this.currentSubmenu = null;
|
|
|
122 |
this.currentSubmenuTrigger.is_open = false;
|
|
|
123 |
this.currentSubmenuTrigger._closedSubmenu(force);
|
|
|
124 |
this.currentSubmenuTrigger = null;
|
|
|
125 |
}});
|
|
|
126 |
dojo.widget.defineWidget("dojo.widget.PopupMenu2", [dojo.widget.HtmlWidget, dojo.widget.PopupContainerBase, dojo.widget.MenuBase], function () {
|
|
|
127 |
this.targetNodeIds = [];
|
|
|
128 |
}, {templateString:"<table class=\"dojoPopupMenu2\" border=0 cellspacing=0 cellpadding=0 style=\"display: none; position: absolute;\">" + "<tbody dojoAttachPoint=\"containerNode\"></tbody>" + "</table>", submenuOverlap:5, contextMenuForWindow:false, parentMenu:null, postCreate:function () {
|
|
|
129 |
if (this.contextMenuForWindow) {
|
|
|
130 |
var doc = dojo.body();
|
|
|
131 |
this.bindDomNode(doc);
|
|
|
132 |
} else {
|
|
|
133 |
if (this.targetNodeIds.length > 0) {
|
|
|
134 |
dojo.lang.forEach(this.targetNodeIds, this.bindDomNode, this);
|
|
|
135 |
}
|
|
|
136 |
}
|
|
|
137 |
this._subscribeSubitemsOnOpen();
|
|
|
138 |
}, _subscribeSubitemsOnOpen:function () {
|
|
|
139 |
var subItems = this.getChildrenOfType(dojo.widget.MenuItem2);
|
|
|
140 |
for (var i = 0; i < subItems.length; i++) {
|
|
|
141 |
dojo.event.topic.subscribe(this.eventNames.open, subItems[i], "menuOpen");
|
|
|
142 |
}
|
|
|
143 |
}, getTopOpenEvent:function () {
|
|
|
144 |
var menu = this;
|
|
|
145 |
while (menu.parentMenu) {
|
|
|
146 |
menu = menu.parentMenu;
|
|
|
147 |
}
|
|
|
148 |
return menu.openEvent;
|
|
|
149 |
}, bindDomNode:function (node) {
|
|
|
150 |
node = dojo.byId(node);
|
|
|
151 |
var win = dojo.html.getElementWindow(node);
|
|
|
152 |
if (dojo.html.isTag(node, "iframe") == "iframe") {
|
|
|
153 |
win = dojo.html.iframeContentWindow(node);
|
|
|
154 |
node = dojo.withGlobal(win, dojo.body);
|
|
|
155 |
}
|
|
|
156 |
dojo.widget.Menu2.OperaAndKonqFixer.fixNode(node);
|
|
|
157 |
dojo.event.kwConnect({srcObj:node, srcFunc:"oncontextmenu", targetObj:this, targetFunc:"onOpen", once:true});
|
|
|
158 |
if (dojo.render.html.moz && win.document.designMode.toLowerCase() == "on") {
|
|
|
159 |
dojo.event.browser.addListener(node, "contextmenu", dojo.lang.hitch(this, "onOpen"));
|
|
|
160 |
}
|
|
|
161 |
dojo.widget.PopupManager.registerWin(win);
|
|
|
162 |
}, unBindDomNode:function (nodeName) {
|
|
|
163 |
var node = dojo.byId(nodeName);
|
|
|
164 |
dojo.event.kwDisconnect({srcObj:node, srcFunc:"oncontextmenu", targetObj:this, targetFunc:"onOpen", once:true});
|
|
|
165 |
dojo.widget.Menu2.OperaAndKonqFixer.cleanNode(node);
|
|
|
166 |
}, _openAsSubmenu:function (parent, explodeSrc, orient) {
|
|
|
167 |
if (this.isShowingNow) {
|
|
|
168 |
return;
|
|
|
169 |
}
|
|
|
170 |
this.parentMenu = parent;
|
|
|
171 |
this.open(explodeSrc, parent, explodeSrc, orient);
|
|
|
172 |
}, close:function (force) {
|
|
|
173 |
if (this.animationInProgress) {
|
|
|
174 |
dojo.widget.PopupContainerBase.prototype.close.call(this, force);
|
|
|
175 |
return;
|
|
|
176 |
}
|
|
|
177 |
if (this._highlighted_option) {
|
|
|
178 |
this._highlighted_option.onUnhover();
|
|
|
179 |
}
|
|
|
180 |
dojo.widget.PopupContainerBase.prototype.close.call(this, force);
|
|
|
181 |
this.parentMenu = null;
|
|
|
182 |
}, closeAll:function (force) {
|
|
|
183 |
if (this.parentMenu) {
|
|
|
184 |
this.parentMenu.closeAll(force);
|
|
|
185 |
} else {
|
|
|
186 |
this.close(force);
|
|
|
187 |
}
|
|
|
188 |
}, _openSubmenu:function (submenu, from_item) {
|
|
|
189 |
submenu._openAsSubmenu(this, from_item.arrow, {"TR":"TL", "TL":"TR"});
|
|
|
190 |
this.currentSubmenu = submenu;
|
|
|
191 |
this.currentSubmenuTrigger = from_item;
|
|
|
192 |
this.currentSubmenuTrigger.is_open = true;
|
|
|
193 |
}, focus:function () {
|
|
|
194 |
if (this.currentSubmenuTrigger) {
|
|
|
195 |
if (this.currentSubmenuTrigger.caption) {
|
|
|
196 |
try {
|
|
|
197 |
this.currentSubmenuTrigger.caption.focus();
|
|
|
198 |
}
|
|
|
199 |
catch (e) {
|
|
|
200 |
}
|
|
|
201 |
} else {
|
|
|
202 |
try {
|
|
|
203 |
this.currentSubmenuTrigger.domNode.focus();
|
|
|
204 |
}
|
|
|
205 |
catch (e) {
|
|
|
206 |
}
|
|
|
207 |
}
|
|
|
208 |
}
|
|
|
209 |
}, onOpen:function (e) {
|
|
|
210 |
this.openEvent = e;
|
|
|
211 |
if (e["target"]) {
|
|
|
212 |
this.openedForWindow = dojo.html.getElementWindow(e.target);
|
|
|
213 |
} else {
|
|
|
214 |
this.openedForWindow = null;
|
|
|
215 |
}
|
|
|
216 |
var x = e.pageX, y = e.pageY;
|
|
|
217 |
var win = dojo.html.getElementWindow(e.target);
|
|
|
218 |
var iframe = win._frameElement || win.frameElement;
|
|
|
219 |
if (iframe) {
|
|
|
220 |
var cood = dojo.html.abs(iframe, true);
|
|
|
221 |
x += cood.x - dojo.withGlobal(win, dojo.html.getScroll).left;
|
|
|
222 |
y += cood.y - dojo.withGlobal(win, dojo.html.getScroll).top;
|
|
|
223 |
}
|
|
|
224 |
this.open(x, y, null, [x, y]);
|
|
|
225 |
dojo.event.browser.stopEvent(e);
|
|
|
226 |
}});
|
|
|
227 |
dojo.widget.defineWidget("dojo.widget.MenuItem2", dojo.widget.HtmlWidget, function () {
|
|
|
228 |
this.eventNames = {engage:""};
|
|
|
229 |
}, {templateString:"<tr class=\"dojoMenuItem2\" dojoAttachEvent=\"onMouseOver: onHover; onMouseOut: onUnhover; onClick: _onClick; onKey:onKey;\">" + "<td><div class=\"${this.iconClass}\" style=\"${this.iconStyle}\"></div></td>" + "<td tabIndex=\"-1\" class=\"dojoMenuItem2Label\" dojoAttachPoint=\"caption\">${this.caption}</td>" + "<td class=\"dojoMenuItem2Accel\">${this.accelKey}</td>" + "<td><div class=\"dojoMenuItem2Submenu\" style=\"display:${this.arrowDisplay};\" dojoAttachPoint=\"arrow\"></div></td>" + "</tr>", is_hovering:false, hover_timer:null, is_open:false, topPosition:0, caption:"Untitled", accelKey:"", iconSrc:"", disabledClass:"dojoMenuItem2Disabled", iconClass:"dojoMenuItem2Icon", submenuId:"", eventNaming:"default", highlightClass:"dojoMenuItem2Hover", postMixInProperties:function () {
|
|
|
230 |
this.iconStyle = "";
|
|
|
231 |
if (this.iconSrc) {
|
|
|
232 |
if ((this.iconSrc.toLowerCase().substring(this.iconSrc.length - 4) == ".png") && (dojo.render.html.ie55 || dojo.render.html.ie60)) {
|
|
|
233 |
this.iconStyle = "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.iconSrc + "', sizingMethod='image')";
|
|
|
234 |
} else {
|
|
|
235 |
this.iconStyle = "background-image: url(" + this.iconSrc + ")";
|
|
|
236 |
}
|
|
|
237 |
}
|
|
|
238 |
this.arrowDisplay = this.submenuId ? "block" : "none";
|
|
|
239 |
dojo.widget.MenuItem2.superclass.postMixInProperties.apply(this, arguments);
|
|
|
240 |
}, fillInTemplate:function () {
|
|
|
241 |
dojo.html.disableSelection(this.domNode);
|
|
|
242 |
if (this.disabled) {
|
|
|
243 |
this.setDisabled(true);
|
|
|
244 |
}
|
|
|
245 |
if (this.eventNaming == "default") {
|
|
|
246 |
for (var eventName in this.eventNames) {
|
|
|
247 |
this.eventNames[eventName] = this.widgetId + "/" + eventName;
|
|
|
248 |
}
|
|
|
249 |
}
|
|
|
250 |
}, onHover:function () {
|
|
|
251 |
this.onUnhover();
|
|
|
252 |
if (this.is_hovering) {
|
|
|
253 |
return;
|
|
|
254 |
}
|
|
|
255 |
if (this.is_open) {
|
|
|
256 |
return;
|
|
|
257 |
}
|
|
|
258 |
if (this.parent._highlighted_option) {
|
|
|
259 |
this.parent._highlighted_option.onUnhover();
|
|
|
260 |
}
|
|
|
261 |
this.parent.closeSubmenu();
|
|
|
262 |
this.parent._highlighted_option = this;
|
|
|
263 |
dojo.widget.PopupManager.setFocusedMenu(this.parent);
|
|
|
264 |
this._highlightItem();
|
|
|
265 |
if (this.is_hovering) {
|
|
|
266 |
this._stopSubmenuTimer();
|
|
|
267 |
}
|
|
|
268 |
this.is_hovering = true;
|
|
|
269 |
this._startSubmenuTimer();
|
|
|
270 |
}, onUnhover:function () {
|
|
|
271 |
if (!this.is_open) {
|
|
|
272 |
this._unhighlightItem();
|
|
|
273 |
}
|
|
|
274 |
this.is_hovering = false;
|
|
|
275 |
this.parent._highlighted_option = null;
|
|
|
276 |
if (this.parent.parentMenu) {
|
|
|
277 |
dojo.widget.PopupManager.setFocusedMenu(this.parent.parentMenu);
|
|
|
278 |
}
|
|
|
279 |
this._stopSubmenuTimer();
|
|
|
280 |
}, _onClick:function (focus) {
|
|
|
281 |
var displayingSubMenu = false;
|
|
|
282 |
if (this.disabled) {
|
|
|
283 |
return false;
|
|
|
284 |
}
|
|
|
285 |
if (this.submenuId) {
|
|
|
286 |
if (!this.is_open) {
|
|
|
287 |
this._stopSubmenuTimer();
|
|
|
288 |
this._openSubmenu();
|
|
|
289 |
}
|
|
|
290 |
displayingSubMenu = true;
|
|
|
291 |
} else {
|
|
|
292 |
this.onUnhover();
|
|
|
293 |
this.parent.closeAll(true);
|
|
|
294 |
}
|
|
|
295 |
this.onClick();
|
|
|
296 |
dojo.event.topic.publish(this.eventNames.engage, this);
|
|
|
297 |
if (displayingSubMenu && focus) {
|
|
|
298 |
dojo.widget.getWidgetById(this.submenuId)._highlightOption(1);
|
|
|
299 |
}
|
|
|
300 |
return;
|
|
|
301 |
}, onClick:function () {
|
|
|
302 |
this.parent.onItemClick(this);
|
|
|
303 |
}, _highlightItem:function () {
|
|
|
304 |
dojo.html.addClass(this.domNode, this.highlightClass);
|
|
|
305 |
}, _unhighlightItem:function () {
|
|
|
306 |
dojo.html.removeClass(this.domNode, this.highlightClass);
|
|
|
307 |
}, _startSubmenuTimer:function () {
|
|
|
308 |
this._stopSubmenuTimer();
|
|
|
309 |
if (this.disabled) {
|
|
|
310 |
return;
|
|
|
311 |
}
|
|
|
312 |
var self = this;
|
|
|
313 |
var closure = function () {
|
|
|
314 |
return function () {
|
|
|
315 |
self._openSubmenu();
|
|
|
316 |
};
|
|
|
317 |
}();
|
|
|
318 |
this.hover_timer = dojo.lang.setTimeout(closure, this.parent.submenuDelay);
|
|
|
319 |
}, _stopSubmenuTimer:function () {
|
|
|
320 |
if (this.hover_timer) {
|
|
|
321 |
dojo.lang.clearTimeout(this.hover_timer);
|
|
|
322 |
this.hover_timer = null;
|
|
|
323 |
}
|
|
|
324 |
}, _openSubmenu:function () {
|
|
|
325 |
if (this.disabled) {
|
|
|
326 |
return;
|
|
|
327 |
}
|
|
|
328 |
this.parent.closeSubmenu();
|
|
|
329 |
var submenu = dojo.widget.getWidgetById(this.submenuId);
|
|
|
330 |
if (submenu) {
|
|
|
331 |
this.parent._openSubmenu(submenu, this);
|
|
|
332 |
}
|
|
|
333 |
}, _closedSubmenu:function () {
|
|
|
334 |
this.onUnhover();
|
|
|
335 |
}, setDisabled:function (value) {
|
|
|
336 |
this.disabled = value;
|
|
|
337 |
if (this.disabled) {
|
|
|
338 |
dojo.html.addClass(this.domNode, this.disabledClass);
|
|
|
339 |
} else {
|
|
|
340 |
dojo.html.removeClass(this.domNode, this.disabledClass);
|
|
|
341 |
}
|
|
|
342 |
}, enable:function () {
|
|
|
343 |
this.setDisabled(false);
|
|
|
344 |
}, disable:function () {
|
|
|
345 |
this.setDisabled(true);
|
|
|
346 |
}, menuOpen:function (message) {
|
|
|
347 |
}});
|
|
|
348 |
dojo.widget.defineWidget("dojo.widget.MenuSeparator2", dojo.widget.HtmlWidget, {templateString:"<tr class=\"dojoMenuSeparator2\"><td colspan=4>" + "<div class=\"dojoMenuSeparator2Top\"></div>" + "<div class=\"dojoMenuSeparator2Bottom\"></div>" + "</td></tr>", postCreate:function () {
|
|
|
349 |
dojo.html.disableSelection(this.domNode);
|
|
|
350 |
}});
|
|
|
351 |
dojo.widget.defineWidget("dojo.widget.MenuBar2", [dojo.widget.HtmlWidget, dojo.widget.MenuBase], {menuOverlap:2, templateString:"<div class=\"dojoMenuBar2\" dojoAttachPoint=\"containerNode\" tabIndex=\"0\"></div>", close:function (force) {
|
|
|
352 |
if (this._highlighted_option) {
|
|
|
353 |
this._highlighted_option.onUnhover();
|
|
|
354 |
}
|
|
|
355 |
this.closeSubmenu(force);
|
|
|
356 |
}, closeAll:function (force) {
|
|
|
357 |
this.close(force);
|
|
|
358 |
}, processKey:function (evt) {
|
|
|
359 |
if (evt.ctrlKey || evt.altKey) {
|
|
|
360 |
return false;
|
|
|
361 |
}
|
|
|
362 |
var rval = false;
|
|
|
363 |
switch (evt.key) {
|
|
|
364 |
case evt.KEY_DOWN_ARROW:
|
|
|
365 |
rval = this._moveToChildMenu(evt);
|
|
|
366 |
break;
|
|
|
367 |
case evt.KEY_UP_ARROW:
|
|
|
368 |
rval = this._moveToParentMenu(evt);
|
|
|
369 |
break;
|
|
|
370 |
case evt.KEY_RIGHT_ARROW:
|
|
|
371 |
rval = this._moveToNext(evt);
|
|
|
372 |
break;
|
|
|
373 |
case evt.KEY_LEFT_ARROW:
|
|
|
374 |
rval = this._moveToPrevious(evt);
|
|
|
375 |
break;
|
|
|
376 |
default:
|
|
|
377 |
rval = dojo.widget.MenuBar2.superclass.processKey.apply(this, arguments);
|
|
|
378 |
break;
|
|
|
379 |
}
|
|
|
380 |
return rval;
|
|
|
381 |
}, postCreate:function () {
|
|
|
382 |
dojo.widget.MenuBar2.superclass.postCreate.apply(this, arguments);
|
|
|
383 |
this.isShowingNow = true;
|
|
|
384 |
}, _openSubmenu:function (submenu, from_item) {
|
|
|
385 |
submenu._openAsSubmenu(this, from_item.domNode, {"BL":"TL", "TL":"BL"});
|
|
|
386 |
this.currentSubmenu = submenu;
|
|
|
387 |
this.currentSubmenuTrigger = from_item;
|
|
|
388 |
this.currentSubmenuTrigger.is_open = true;
|
|
|
389 |
}});
|
|
|
390 |
dojo.widget.defineWidget("dojo.widget.MenuBarItem2", dojo.widget.MenuItem2, {templateString:"<span class=\"dojoMenuItem2\" dojoAttachEvent=\"onMouseOver: onHover; onMouseOut: onUnhover; onClick: _onClick;\">${this.caption}</span>"});
|
|
|
391 |
dojo.widget.Menu2.OperaAndKonqFixer = new function () {
|
|
|
392 |
var implement = true;
|
|
|
393 |
var delfunc = false;
|
|
|
394 |
if (!dojo.lang.isFunction(dojo.doc().oncontextmenu)) {
|
|
|
395 |
dojo.doc().oncontextmenu = function () {
|
|
|
396 |
implement = false;
|
|
|
397 |
delfunc = true;
|
|
|
398 |
};
|
|
|
399 |
}
|
|
|
400 |
if (dojo.doc().createEvent) {
|
|
|
401 |
try {
|
|
|
402 |
var e = dojo.doc().createEvent("MouseEvents");
|
|
|
403 |
e.initMouseEvent("contextmenu", 1, 1, dojo.global(), 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, null);
|
|
|
404 |
dojo.doc().dispatchEvent(e);
|
|
|
405 |
}
|
|
|
406 |
catch (e) {
|
|
|
407 |
}
|
|
|
408 |
} else {
|
|
|
409 |
implement = false;
|
|
|
410 |
}
|
|
|
411 |
if (delfunc) {
|
|
|
412 |
delete dojo.doc().oncontextmenu;
|
|
|
413 |
}
|
|
|
414 |
this.fixNode = function (node) {
|
|
|
415 |
if (implement) {
|
|
|
416 |
if (!dojo.lang.isFunction(node.oncontextmenu)) {
|
|
|
417 |
node.oncontextmenu = function (e) {
|
|
|
418 |
};
|
|
|
419 |
}
|
|
|
420 |
if (dojo.render.html.opera) {
|
|
|
421 |
node._menufixer_opera = function (e) {
|
|
|
422 |
if (e.ctrlKey) {
|
|
|
423 |
this.oncontextmenu(e);
|
|
|
424 |
}
|
|
|
425 |
};
|
|
|
426 |
dojo.event.connect(node, "onclick", node, "_menufixer_opera");
|
|
|
427 |
} else {
|
|
|
428 |
node._menufixer_konq = function (e) {
|
|
|
429 |
if (e.button == 2) {
|
|
|
430 |
e.preventDefault();
|
|
|
431 |
this.oncontextmenu(e);
|
|
|
432 |
}
|
|
|
433 |
};
|
|
|
434 |
dojo.event.connect(node, "onmousedown", node, "_menufixer_konq");
|
|
|
435 |
}
|
|
|
436 |
}
|
|
|
437 |
};
|
|
|
438 |
this.cleanNode = function (node) {
|
|
|
439 |
if (implement) {
|
|
|
440 |
if (node._menufixer_opera) {
|
|
|
441 |
dojo.event.disconnect(node, "onclick", node, "_menufixer_opera");
|
|
|
442 |
delete node._menufixer_opera;
|
|
|
443 |
} else {
|
|
|
444 |
if (node._menufixer_konq) {
|
|
|
445 |
dojo.event.disconnect(node, "onmousedown", node, "_menufixer_konq");
|
|
|
446 |
delete node._menufixer_konq;
|
|
|
447 |
}
|
|
|
448 |
}
|
|
|
449 |
if (node.oncontextmenu) {
|
|
|
450 |
delete node.oncontextmenu;
|
|
|
451 |
}
|
|
|
452 |
}
|
|
|
453 |
};
|
|
|
454 |
};
|
|
|
455 |
|