1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
| /**
| @name Edo.navigators.Menu
| @class
| @typeName menu
| @description 菜单
| @extend Edo.navigators.Navigator
| */
| Edo.navigators.Menu = function(){
| Edo.navigators.Menu.superclass.constructor.call(this);
|
| };
| Edo.navigators.Menu.extend(Edo.navigators.Navigator,{
| /**
| @name Edo.navigators.Menu#layout
| @property
| @default 'vertical'
| */
| layout: 'vertical',
| /**
| @name Edo.navigators.Menu#minWidth
| @property
| @default 40
| */
| minWidth: 40,
| minHeight: 20,
| defaultHeight: 20,
| /**
| @name Edo.navigators.Menu#defaultWidth
| @property
| @default 100
| */
| defaultWidth: 100,
| /**
| @name Edo.navigators.Menu#verticalGap
| @property
| @default 0
| */
| verticalGap: 0,
| /**
| @name Edo.navigators.Menu#padding
| @property
| @default [1,1,1,1]
| */
| padding: [1,1,1,1],
|
| startWidth: 8,
| startHeight: 8,
| endWidth: 8,
| endHeight: 8,
|
| /**
| @name Edo.navigators.Menu#autoHide
| @property
| @type Boolean
| @default false
| @description 控制当poup时,是否自动隐藏
| */
| autoHide: false,
|
| elCls: 'e-box e-menu ',//e-toolbar e-toolbar-over
|
| initEvents: function(){
| this.on('click', this._onClick, this);
|
| Edo.navigators.Menu.superclass.initEvents.c(this);
| },
| _onClick: function(e){
|
| if(this.autoHide){
| this.hideMenu();
| }
| },
| hideMenu: function(){
| Edo.managers.PopupManager.removePopup(this);
|
| if(this.owner && this.owner.type == 'button'){
| this.owner.hidePopup();
|
|
| if(this.owner.parent && this.owner.parent.type == "menu"){
| this.owner.parent.hideMenu();
| }
| }
| },
| _onChildOver: function(e){
| var btn = e.source;
| var oi = this.overItem;
| if(oi && oi.menu){
| oi.hidePopup();
| }
| this.overItem = btn;
| if(btn.menu) {
| var box = btn._getBox(true);
| if(this.layout == 'vertical'){
| btn.showPopup(box.x + box.width, box.y, false, null, -btn.realWidth, btn.realHeight);
| }else{
| btn.showPopup();
| }
| //btn.menu.hideMenu();
| }
| },
|
| addChildAt: function(){
| var o = arguments[1];
| if(this.layout == 'vertical'){
| o.width = '100%';
| o.icon = o.icon || ' ';
| if(o.menu) o.arrowMode = 'menu';
| else o.arrowMode = null;
| }
| o.showMenu = false;
|
| var c = Edo.navigators.Menu.superclass.addChildAt.apply(this, arguments);
| c.on('mouseover', this._onChildOver, this);
| return c;
| }
| });
| Edo.navigators.Menu.regType('menu');
|
|