Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
27 jpm 1
// vim: ts=4:sw=4:nu:fdc=4:nospell
2
/**
3
 * Ext.ux.ThemeCombo - Combo pre-configured for themes selection
4
 *
5
 * @author    Ing. Jozef Sakáloš <jsakalos@aariadne.com>
6
 * @copyright (c) 2008, by Ing. Jozef Sakáloš
7
 * @date      30. January 2008
8
 * @version   $Id: Ext.ux.ThemeCombo.js 116 2008-03-30 01:09:45Z jozo $
9
 *
10
 * @license Ext.ux.ThemeCombo is licensed under the terms of
11
 * the Open Source LGPL 3.0 license.  Commercial use is permitted to the extent
12
 * that the code/component(s) do NOT become part of another Open Source or Commercially
13
 * licensed development library or toolkit without explicit permission.
14
 *
15
 * License details: http://www.gnu.org/licenses/lgpl.html
16
 */
17
 
18
/*global Ext */
19
 
20
Ext.ux.ThemeCombo = Ext.extend(Ext.form.ComboBox, {
21
	// configurables
22
	 themeBlueText: 'Ext Blue Theme'
23
	,themeGrayText: 'Gray Theme'
24
	,themeBlackText: 'Black Theme'
25
	,themeOliveText: 'Olive Theme'
26
	,themePurpleText: 'Purple Theme'
27
	,themeDarkGrayText: 'Dark Gray Theme'
28
	,themeSlateText: 'Slate Theme'
29
	,themeVistaText: 'Vista Theme'
30
	,themePeppermintText: 'Peppermint Theme'
31
	,themeChocolateText: 'Chocolate Theme'
32
	,themeGreenText: 'Green Theme'
33
	,themeIndigoText: 'Indigo Theme'
34
	,themeMidnightText: 'Midnight Theme'
35
	,themeSilverCherryText: 'Silver Cherry Theme'
36
	,themeSlicknessText: 'Slickness Theme'
37
	,themeVar:'theme'
38
	,selectThemeText: 'Select Theme'
39
	,themeGrayExtndText:'Gray-Extended Theme'
40
	,lazyRender:true
41
	,lazyInit:true
42
	,cssPath:'../ext/resources/css/' // mind the trailing slash
43
 
44
	// {{{
45
	,initComponent:function() {
46
 
47
		Ext.apply(this, {
48
			store: new Ext.data.SimpleStore({
49
				fields: ['themeFile', {name:'themeName', type:'string'}]
50
				,data: [
51
					 ['xtheme-default.css', this.themeBlueText]
52
					,['xtheme-gray.css', this.themeGrayText]
53
					,['xtheme-darkgray.css', this.themeDarkGrayText]
54
					,['xtheme-black.css', this.themeBlackText]
55
					,['xtheme-olive.css', this.themeOliveText]
56
					,['xtheme-purple.css', this.themePurpleText]
57
					,['xtheme-slate.css', this.themeSlateText]
58
					,['xtheme-peppermint.css', this.themePeppermintText]
59
					,['xtheme-chocolate.css', this.themeChocolateText]
60
					,['xtheme-green.css', this.themeGreenText]
61
					,['xtheme-indigo.css', this.themeIndigoText]
62
					,['xtheme-midnight.css', this.themeMidnightText]
63
					,['xtheme-silverCherry.css', this.themeSilverCherryText]
64
					,['xtheme-slickness.css', this.themeSlicknessText]
65
					,['xtheme-gray-extend.css', this.themeGrayExtndText]
66
				]
67
			})
68
			,valueField: 'themeFile'
69
			,displayField: 'themeName'
70
			,triggerAction:'all'
71
			,mode: 'local'
72
			,forceSelection:true
73
			,editable:false
74
			,fieldLabel: this.selectThemeText
75
		}); // end of apply
76
 
77
		this.store.sort('themeName');
78
 
79
		// call parent
80
		Ext.ux.ThemeCombo.superclass.initComponent.apply(this, arguments);
81
 
82
		this.setValue(Ext.state.Manager.get(this.themeVar) || 'xtheme-default.css');
83
 
84
	} // end of function initComponent
85
	// }}}
86
	// {{{
87
	,setValue:function(val) {
88
		Ext.ux.ThemeCombo.superclass.setValue.apply(this, arguments);
89
 
90
		// set theme
91
		Ext.util.CSS.swapStyleSheet(this.themeVar, this.cssPath + val);
92
 
93
		if(Ext.state.Manager.getProvider()) {
94
			Ext.state.Manager.set(this.themeVar, val);
95
		}
96
	} // eo function setValue
97
	// }}}
98
 
99
}); // end of extend
100
 
101
// register xtype
102
Ext.reg('themecombo', Ext.ux.ThemeCombo);
103
 
104
// end of file