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
| Ext.define('KitchenSink.view.slider.SliderField', {
| extend: 'Ext.form.Panel',
|
| requires: [
| 'Ext.slider.Single'
| ],
| xtype: 'slider-field',
|
| //<example>
| exampleTitle: 'Slider field example',
| exampleDescription: '<p>Shows how the Slider control can be used in a form and participate like a form field.</p>',
| themes: {
| classic: {
| height: 160
| },
| neptune: {
| height: 170
| }
| },
| //</example>
|
| width: 400,
| title: 'Sound Settings',
| bodyPadding: 10,
| defaults: {
| labelWidth: 110,
| anchor: '95%',
| tipText: function(thumb){
| return String(thumb.value) + '%';
| }
| },
|
| initComponent: function(){
| this.msgTpl = new Ext.Template(
| 'Sounds Effects: <b>{fx}%</b><br />',
| 'Ambient Sounds: <b>{ambient}%</b><br />',
| 'Interface Sounds: <b>{iface}%</b>'
| );
| Ext.apply(this, {
| height: this.themeInfo.height,
| defaultType: 'slider',
| items: [{
| fieldLabel: 'Sound Effects',
| value: 50,
| name: 'fx'
| },{
| fieldLabel: 'Ambient Sounds',
| value: 80,
| name: 'ambient'
| },{
| fieldLabel: 'Interface Sounds',
| value: 25,
| name: 'iface'
| }],
| bbar: [{
| text: 'Max All',
| scope: this,
| handler: this.onMaxAllClick
| }, '->', {
| text: 'Save',
| scope: this,
| handler: this.onSaveClick
| }, {
| text: 'Reset',
| scope: this,
| handler: this.onResetClick
| }]
| });
| this.callParent();
| },
|
| onMaxAllClick: function(){
| Ext.suspendLayouts();
| this.items.each(function(c){
| c.setValue(100);
| });
| Ext.resumeLayouts(true);
| },
|
| onSaveClick: function(){
| Ext.Msg.alert({
| title: 'Settings Saved',
| msg: this.msgTpl.apply(this.getForm().getValues()),
| icon: Ext.Msg.INFO,
| buttons: Ext.Msg.OK
| });
| },
|
| onResetClick: function(){
| this.getForm().reset();
| }
| });
|
|