forked from extnet/Ext.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuBase.cs
More file actions
509 lines (478 loc) · 16.6 KB
/
MenuBase.cs
File metadata and controls
509 lines (478 loc) · 16.6 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
/********
* @version : 1.6.0 - Ext.NET Pro License
* @author : Ext.NET, Inc. http://www.ext.net/
* @date : 2012-11-21
* @copyright : Copyright (c) 2007-2012, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
* @license : See license.txt and http://www.ext.net/license/.
********/
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net.Utilities;
namespace Ext.Net
{
/// <summary>
///
/// </summary>
[Meta]
[Description("")]
public abstract partial class MenuBase : ContainerBase
{
/// <summary>
///
/// </summary>
[Description("")]
protected override bool RemoveContainer
{
get
{
return this.Floating;
}
}
/// <summary>
///
/// </summary>
[Description("")]
public override bool IsDefault
{
get
{
return this.Items.Count == 0 && !this.RenderEmptyMenu;
}
}
/// <summary>
///
/// </summary>
protected internal bool RenderEmptyMenu
{
get;
set;
}
/// <summary>
///
/// </summary>
[Description("")]
protected override bool UseDefaultLayout
{
get
{
return false;
}
}
/// <summary>
/// The default type of content Container represented by this object as registered in Ext.ComponentMgr (defaults to 'panel').
/// </summary>
[Meta]
[Category("5. Container")]
[DefaultValue("MenuItem")]
[NotifyParentProperty(true)]
[Description("The default type of content Container represented by this object as registered in Ext.ComponentMgr (defaults to 'panel').")]
public override string DefaultType
{
get
{
return (string)this.ViewState["DefaultType"] ?? "MenuItem";
}
set
{
this.ViewState["DefaultType"] = value;
}
}
/// <summary>
///
/// </summary>
[ConfigOption("defaultType")]
[DefaultValue("menuitem")]
[Description("")]
protected override string DefaultTypeProxy
{
get
{
return base.DefaultTypeProxy;
}
}
/// <summary>
/// Whenever a menu gets so long that the items won't fit the viewable area, it provides the user with an easy UI to scroll the menu.
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(false)]
[NotifyParentProperty(true)]
[Description("Whenever a menu gets so long that the items won't fit the viewable area, it provides the user with an easy UI to scroll the menu.")]
public virtual bool EnableScrolling
{
get
{
object obj = this.ViewState["EnableScrolling"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["EnableScrolling"] = value;
}
}
/// <summary>
/// By default, a Menu configured as floating:true will be rendered as an Ext.Layer (an absolutely positioned, floating Component with zindex=15000). If configured as floating:false, the Menu may be used as child item of another Container instead of a free-floating Layer.
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(true)]
[NotifyParentProperty(true)]
[Description("By default, a Menu configured as floating:true will be rendered as an Ext.Layer (an absolutely positioned, floating Component with zindex=15000). If configured as floating:false, the Menu may be used as child item of another Container instead of a free-floating Layer.")]
public virtual bool Floating
{
get
{
object obj = this.ViewState["Floating"];
return (obj == null) ? true : (bool)obj;
}
set
{
this.ViewState["Floating"] = value;
}
}
/// <summary>
/// True to allow multiple menus to be displayed at the same time (defaults to false).
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(false)]
[NotifyParentProperty(true)]
[Description("True to allow multiple menus to be displayed at the same time (defaults to false).")]
public virtual bool AllowOtherMenus
{
get
{
object obj = this.ViewState["AllowOtherMenus"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["AllowOtherMenus"] = value;
}
}
/// <summary>
/// The default Ext.Element.alignTo anchor position value for this menu relative to its element of origin (defaults to \"tl-bl?\")
/// </summary>
[Meta]
[Category("6. Menu")]
[DefaultValue("")]
[NotifyParentProperty(true)]
[Description("The default Ext.Element.alignTo anchor position value for this menu relative to its element of origin (defaults to \"tl-bl?\")")]
public virtual string DefaultAlign
{
get
{
return (string)this.ViewState["DefaultAlign"] ?? "";
}
set
{
this.ViewState["DefaultAlign"] = value;
}
}
/// <summary>
/// X offset in pixels by which to change the default Menu popup position after aligning according to the defaultAlign configuration.
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(0)]
[NotifyParentProperty(true)]
[Description("X offset in pixels by which to change the default Menu popup position after aligning according to the defaultAlign configuration.")]
public virtual int OffsetX
{
get
{
object obj = this.ViewState["OffsetX"];
return (obj == null) ? 0 : (int)obj;
}
set
{
this.ViewState["OffsetX"] = value;
}
}
/// <summary>
/// Y offset in pixels by which to change the default Menu popup position after aligning according to the defaultAlign configuration.
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(0)]
[NotifyParentProperty(true)]
[Description("Y offset in pixels by which to change the default Menu popup position after aligning according to the defaultAlign configuration.")]
public virtual int OffsetY
{
get
{
object obj = this.ViewState["OffsetY"];
return (obj == null) ? 0 : (int)obj;
}
set
{
this.ViewState["OffsetY"] = value;
}
}
/// <summary>
///
/// </summary>
[ConfigOption(JsonMode.Raw)]
[DefaultValue("")]
[Description("")]
protected internal string DefaultOffsets
{
get
{
if (this.OffsetX == 0 && this.OffsetY == 0)
{
return "";
}
return "[".ConcatWith(this.OffsetX, ",", this.OffsetY, "]");
}
}
/// <summary>
/// True to ignore clicks on any item in this menu that is a parent item (displays a submenu) so that the submenu is not dismissed when clicking the parent item (defaults to false).
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(false)]
[NotifyParentProperty(true)]
[Description("True to ignore clicks on any item in this menu that is a parent item (displays a submenu) so that the submenu is not dismissed when clicking the parent item (defaults to false).")]
public virtual bool IgnoreParentClicks
{
get
{
object obj = this.ViewState["IgnoreParentClicks"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["IgnoreParentClicks"] = value;
}
}
/// <summary>
/// The minimum width of the menu in pixels (defaults to 120).
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(typeof(Unit), "120")]
[NotifyParentProperty(true)]
[Description("The minimum width of the menu in pixels (defaults to 120).")]
public override Unit MinWidth
{
get
{
return this.UnitPixelTypeCheck(ViewState["MinWidth"], Unit.Pixel(120), "MinWidth");
}
set
{
this.ViewState["MinWidth"] = value;
}
}
/// <summary>
/// The maximum height of the menu. Only applies when enableScrolling is set to True (defaults to null).
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(typeof(Unit), "")]
[NotifyParentProperty(true)]
[Description("The maximum height of the menu. Only applies when enableScrolling is set to True (defaults to null).")]
public override Unit MaxHeight
{
get
{
return this.UnitPixelTypeCheck(ViewState["MaxHeight"], Unit.Empty, "MaxHeight");
}
set
{
this.ViewState["MaxHeight"] = value;
}
}
/// <summary>
/// The amount to scroll the menu. Only applies when enableScrolling is set to True (defaults to 24).
/// </summary>
[Meta]
[ConfigOption(JsonMode.Raw)]
[Category("6. Menu")]
[DefaultValue(24)]
[NotifyParentProperty(true)]
[Description("The amount to scroll the menu. Only applies when enableScrolling is set to True (defaults to 24).")]
public virtual int ScrollIncrement
{
get
{
object obj = this.ViewState["ScrollIncrement"];
return (obj == null) ? 24 : (int)obj;
}
set
{
this.ViewState["ScrollIncrement"] = value;
}
}
/// <summary>
/// True to show the icon separator. (defaults to true).
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(true)]
[NotifyParentProperty(true)]
[Description("True to show the icon separator. (defaults to true).")]
public virtual bool ShowSeparator
{
get
{
object obj = this.ViewState["ShowSeparator"];
return (obj == null) ? true : (bool)obj;
}
set
{
this.ViewState["ShowSeparator"] = value;
}
}
/// <summary>
/// True or \"sides\" for the default effect, \"frame\" for 4-way shadow, and \"drop\" for bottom-right shadow (defaults to \"sides\")
/// </summary>
[Meta]
[ConfigOption(typeof(ShadowJsonConverter))]
[Category("6. Menu")]
[DefaultValue(ShadowMode.Sides)]
[NotifyParentProperty(true)]
[Description("True or \"sides\" for the default effect, \"frame\" for 4-way shadow, and \"drop\" for bottom-right shadow (defaults to \"sides\")")]
public virtual ShadowMode Shadow
{
get
{
object obj = this.ViewState["Shadow"];
return (obj == null) ? ShadowMode.Sides : (ShadowMode)obj;
}
set
{
this.ViewState["Shadow"] = value;
}
}
/// <summary>
/// The Ext.Element.alignTo anchor position value to use for submenus of this menu (defaults to \"tl-tr?\")
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue("")]
[NotifyParentProperty(true)]
[Description("The Ext.Element.alignTo anchor position value to use for submenus of this menu (defaults to \"tl-tr?\")")]
public virtual string SubMenuAlign
{
get
{
return (string)this.ViewState["SubMenuAlign"] ?? "";
}
set
{
this.ViewState["SubMenuAlign"] = value;
}
}
/// <summary>
///
/// </summary>
[Meta]
[Category("6. Menu")]
[DefaultValue(false)]
[NotifyParentProperty(true)]
[Description("")]
public virtual bool DisableMenuNavigation
{
get
{
object obj = this.ViewState["DisableMenuNavigation"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["DisableMenuNavigation"] = value;
}
}
/// <summary>
///
/// </summary>
[Meta]
[ConfigOption]
[Category("6. Menu")]
[DefaultValue(false)]
[NotifyParentProperty(true)]
[Description("")]
public virtual bool RenderToForm
{
get
{
object obj = this.ViewState["RenderToForm"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["RenderToForm"] = value;
}
}
/// <summary>
///
/// </summary>
[ConfigOption("keyNav", JsonMode.Raw)]
[DefaultValue("")]
[Description("")]
protected virtual string DisableMenuNavigationProxy
{
get
{
return this.DisableMenuNavigation ? "{disable:Ext.emptyFn}" : "";
}
}
/* Public Methods
-----------------------------------------------------------------------------------------------*/
/// <summary>
/// Hides this menu and optionally all parent menus
/// </summary>
/// <param name="deep">True to hide all parent menus recursively, if any</param>
[Meta]
[Description("Hides this menu and optionally all parent menus")]
public virtual void Hide(bool deep)
{
this.Call("hide", deep);
}
/// <summary>
/// Displays this menu relative to another element
/// </summary>
/// <param name="element">The element to align to</param>
/// <param name="position">The Ext.Element.alignTo anchor position to use in aligning to the element</param>
[Meta]
[Description("Displays this menu relative to another element")]
public virtual void Show(string element, string position)
{
this.Call("show", new JRawValue(element), position);
}
/// <summary>
/// Displays this menu relative to another element
/// </summary>
/// <param name="element">The element to align to</param>
[Meta]
[Description("Displays this menu relative to another element")]
public virtual void Show(string element)
{
this.Call("show", new JRawValue(element));
}
/// <summary>
/// Displays this menu at a specific xy position
/// </summary>
/// <param name="x">Contains [x] value for the position at which to show the menu (coordinates are page-based)</param>
/// <param name="y">Contains [y] value for the position at which to show the menu (coordinates are page-based)</param>
[Meta]
[Description("Displays this menu at a specific xy position")]
public virtual void ShowAt(int x, int y)
{
this.Call("showAt", new int[] { x, y });
}
}
}