source: Dev/branches/rest-dojo-ui/client/dijit/DropDownMenu.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.4 KB
Line 
1define([
2        "dojo/_base/declare", // declare
3        "dojo/_base/event", // event.stop
4        "dojo/keys", // keys
5        "dojo/text!./templates/Menu.html",
6        "./_OnDijitClickMixin",
7        "./_MenuBase"
8], function(declare, event, keys, template, _OnDijitClickMixin, _MenuBase){
9
10/*=====
11        var _MenuBase = dijit._MenuBase;
12        var _OnDijitClickMixin = dijit._OnDijitClickMixin;
13=====*/
14
15        // module:
16        //              dijit/DropDownMenu
17        // summary:
18        //              dijit.DropDownMenu widget
19
20        return declare("dijit.DropDownMenu", [_MenuBase, _OnDijitClickMixin], {
21                // summary:
22                //              A menu, without features for context menu (Meaning, drop down menu)
23
24                templateString: template,
25
26                baseClass: "dijitMenu",
27
28                postCreate: function(){
29                        var l = this.isLeftToRight();
30                        this._openSubMenuKey = l ? keys.RIGHT_ARROW : keys.LEFT_ARROW;
31                        this._closeSubMenuKey = l ? keys.LEFT_ARROW : keys.RIGHT_ARROW;
32                        this.connectKeyNavHandlers([keys.UP_ARROW], [keys.DOWN_ARROW]);
33                },
34
35                _onKeyPress: function(/*Event*/ evt){
36                        // summary:
37                        //              Handle keyboard based menu navigation.
38                        // tags:
39                        //              protected
40
41                        if(evt.ctrlKey || evt.altKey){ return; }
42
43                        switch(evt.charOrCode){
44                                case this._openSubMenuKey:
45                                        this._moveToPopup(evt);
46                                        event.stop(evt);
47                                        break;
48                                case this._closeSubMenuKey:
49                                        if(this.parentMenu){
50                                                if(this.parentMenu._isMenuBar){
51                                                        this.parentMenu.focusPrev();
52                                                }else{
53                                                        this.onCancel(false);
54                                                }
55                                        }else{
56                                                event.stop(evt);
57                                        }
58                                        break;
59                        }
60                }
61        });
62});
Note: See TracBrowser for help on using the repository browser.