~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to lib/ui/Theme.mhx

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* <license>
 
2
 * This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
 
3
 * For full copyright and license information please refer to doc/license.txt.
 
4
 * </license> 
 
5
 */
 
6
package ui;
 
7
 
 
8
import DrawBasicTypes;
 
9
 
 
10
/**
 
11
 * The Theme class coordinates all aspects of drawing standard elements.
 
12
 * For now it is mainly focused on implements rather than actual object
 
13
 * design.
 
14
 */
 
15
class Theme
 
16
{
 
17
        static public var current(getCurrent,null) : Theme;
 
18
        
 
19
        static public function getCurrent()
 
20
        {
 
21
                if( current == null )
 
22
                        current = standard();
 
23
                return current;
 
24
        }
 
25
        
 
26
        static public function standard()
 
27
        {
 
28
                var th = new Theme();
 
29
                th.dialogColor = Color.rgb(0.75,0.75,0.85);
 
30
                th.buttonColor = Color.rgb(0.65,0.65,0.75);
 
31
                th.menuColor = Color.rgb( 0.9, 0.9, 0.95 );
 
32
                th.borderColor = Color.rgb( 0, 0, 0.1 );
 
33
                th.textColor = Color.rgb( 0, 0, 0 );
 
34
                
 
35
                th.highTextColor = Color.rgb(1,1,1);
 
36
                th.highBackColor = Color.rgb(0.25, 0.5, 0.8 );
 
37
                
 
38
                th.selLineColor = Color.rgb(0,0,0);
 
39
                th.selFillColor = Color.rgb(1,1,1);
 
40
                
 
41
                th.borderXWidth = 0.1;
 
42
                
 
43
                th.chartPalette = [ 
 
44
                        Color.rgb( 1, 0.5, 0.5 ),
 
45
                        Color.rgb( 0.5, 1, 0.5 ),
 
46
                        Color.rgb( 0.5, 0.5, 1 ),
 
47
                        Color.rgb( 1, 1, 0.5 ),
 
48
                        Color.rgb( 0.5, 1, 1 ),
 
49
                        Color.rgb( 1, 0.5, 1 ),
 
50
                        Color.rgb( 1, 1, 1 ),
 
51
                        Color.rgb( 0.5, 0.5, 0.5 )
 
52
                        ];
 
53
                        
 
54
                th.textFont = FontManager.getDefault();
 
55
                return th;
 
56
        }
 
57
 
 
58
        /*protected*/ function new()
 
59
        {
 
60
        }
 
61
        
 
62
        public var dialogColor : Color;
 
63
        public var buttonColor : Color;
 
64
        public var menuColor : Color;
 
65
        public var borderColor : Color;
 
66
        public var textColor : Color;
 
67
        
 
68
        public var highTextColor : Color;
 
69
        public var highBackColor : Color;
 
70
        
 
71
        public var selLineColor : Color;
 
72
        public var selFillColor : Color;
 
73
        
 
74
        public var borderXWidth : Float;
 
75
        
 
76
        public var chartPalette : Array<Color>;
 
77
        
 
78
        public var textFont : FontManager;
 
79
        
 
80
        public function getBorderWidth() 
 
81
        {
 
82
                return Math.ceil( FontManager.getDefault().byXWidth( borderXWidth ) );
 
83
        }
 
84
        
 
85
        
 
86
        public function getChartColor( ndx : Int ) : Color
 
87
        {
 
88
                return chartPalette[ ndx % chartPalette.length ];
 
89
        }
 
90
}