Ext.ux.form.ThemeCombo_wev8.js
4.5 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
// vim: ts=4:sw=4:nu:fdc=4:nospell
/*global Ext */
/**
* @class Ext.ux.form.ThemeCombo
* @extends Ext.form.ComboBox
*
* Combo pre-configured for themes selection. Keeps state if a provider is present.
*
* @author Ing. Jozef Sak谩lo拧
* @copyright (c) 2008, by Ing. Jozef Sak谩lo拧
* @version 1.1
* @date 30. January 2008
* @revision $Id: Ext.ux.form.ThemeCombo_wev8.js 589 2009-02-21 23:30:18Z jozo $
*
* @license Ext.ux.form.ThemeCombo is licensed under the terms of
* the Open Source LGPL 3.0 license. Commercial use is permitted to the extent
* that the code/component(s) do NOT become part of another Open Source or Commercially
* licensed development library or toolkit without explicit permission.
*
* <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
* target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
*
* @demo http://extjs.eu
* @forum 25564
*
* @donate
* <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
* <input type="hidden" name="cmd" value="_s-xclick">
* <input type="hidden" name="hosted_button_id" value="3430419">
* <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate_wev8.gif"
* border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
* <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel_wev8.gif" width="1" height="1">
* </form>
*/
Ext.ns('Ext.ux.form');
/**
* Creates new ThemeCombo
* @constructor
* @param {Object} config A config object
*/
Ext.ux.form.ThemeCombo = Ext.extend(Ext.form.ComboBox, {
// configurables
themeBlueText: 'Ext Blue Theme'
,themeGrayText: 'Gray Theme'
,themeBlackText: 'Black Theme'
,themeOliveText: 'Olive Theme'
,themePurpleText: 'Purple Theme'
,themeDarkGrayText: 'Dark Gray Theme'
,themeSlateText: 'Slate Theme'
,themeVistaText: 'Vista Theme'
,themePeppermintText: 'Peppermint Theme'
,themePinkText: 'Pink Theme'
,themeChocolateText: 'Chocolate Theme'
,themeGreenText: 'Green Theme'
,themeIndigoText: 'Indigo Theme'
,themeMidnightText: 'Midnight Theme'
,themeSilverCherryText: 'Silver Cherry Theme'
,themeSlicknessText: 'Slickness Theme'
,themeVar:'theme'
,selectThemeText: 'Select Theme'
,themeGrayExtndText:'Gray-Extended Theme'
,lazyRender:true
,lazyInit:true
,cssPath:'../ext/resources/css/' // mind the trailing slash
// {{{
,initComponent:function() {
var config = {
store: new Ext.data.SimpleStore({
fields: ['themeFile', {name:'themeName', type:'string'}]
,data: [
['xtheme-default_wev8.css', this.themeBlueText]
,['xtheme-gray_wev8.css', this.themeGrayText]
,['xtheme-darkgray_wev8.css', this.themeDarkGrayText]
,['xtheme-black_wev8.css', this.themeBlackText]
,['xtheme-olive_wev8.css', this.themeOliveText]
,['xtheme-purple_wev8.css', this.themePurpleText]
,['xtheme-slate_wev8.css', this.themeSlateText]
,['xtheme-peppermint_wev8.css', this.themePeppermintText]
,['xtheme-chocolate_wev8.css', this.themeChocolateText]
,['xtheme-green_wev8.css', this.themeGreenText]
,['xtheme-indigo_wev8.css', this.themeIndigoText]
,['xtheme-midnight_wev8.css', this.themeMidnightText]
,['xtheme-silverCherry_wev8.css', this.themeSilverCherryText]
,['xtheme-slickness_wev8.css', this.themeSlicknessText]
,['xtheme-gray-extend_wev8.css', this.themeGrayExtndText]
// ,['xtheme-pink_wev8.css', this.themePinkText]
]
})
,valueField: 'themeFile'
,displayField: 'themeName'
,triggerAction:'all'
,mode: 'local'
,forceSelection:true
,editable:false
,fieldLabel: this.selectThemeText
}; // eo config object
// apply config
Ext.apply(this, Ext.apply(this.initialConfig, config));
this.store.sort('themeName');
// call parent
Ext.ux.form.ThemeCombo.superclass.initComponent.apply(this, arguments);
if(false !== this.stateful && Ext.state.Manager.getProvider()) {
this.setValue(Ext.state.Manager.get(this.themeVar) || 'xtheme-default_wev8.css');
}
else {
this.setValue('xtheme-default_wev8.css');
}
} // end of function initComponent
// }}}
// {{{
,setValue:function(val) {
Ext.ux.form.ThemeCombo.superclass.setValue.apply(this, arguments);
// set theme
Ext.util.CSS.swapStyleSheet(this.themeVar, this.cssPath + val);
if(false !== this.stateful && Ext.state.Manager.getProvider()) {
Ext.state.Manager.set(this.themeVar, val);
}
} // eo function setValue
// }}}
}); // end of extend
// register xtype
Ext.reg('themecombo', Ext.ux.form.ThemeCombo);
// eof