1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2010 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* JSampler is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with JSampler; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.jsampler.view.fantasia; |
24 |
|
25 |
import java.awt.Component; |
26 |
import java.awt.Graphics; |
27 |
import java.awt.Shape; |
28 |
|
29 |
import org.pushingpixels.substance.api.SubstanceColorScheme; |
30 |
import org.pushingpixels.substance.api.SubstanceLookAndFeel; |
31 |
import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; |
32 |
import org.pushingpixels.substance.api.painter.fill.SubstanceFillPainter; |
33 |
import org.pushingpixels.substance.api.skin.GraphiteSkin; |
34 |
|
35 |
/** |
36 |
* |
37 |
* @author Grigor Iliev |
38 |
*/ |
39 |
public class SubstanceFantasiaLookAndFeel extends SubstanceLookAndFeel { |
40 |
public |
41 |
SubstanceFantasiaLookAndFeel() { |
42 |
super(new SubstanceFantasiaSkin()); |
43 |
} |
44 |
} |
45 |
|
46 |
class SubstanceFantasiaSkin extends GraphiteSkin { |
47 |
protected SubstanceBorderPainter baseBorderPainter; |
48 |
protected SubstanceFillPainter basefillPainter; |
49 |
|
50 |
public |
51 |
SubstanceFantasiaSkin() { |
52 |
baseBorderPainter = borderPainter; |
53 |
borderPainter = new FantasiaBorderPainter(baseBorderPainter); |
54 |
|
55 |
basefillPainter = fillPainter; |
56 |
fillPainter = new FantasiaFillPainter(fillPainter); |
57 |
} |
58 |
} |
59 |
|
60 |
class FantasiaBorderPainter implements SubstanceBorderPainter { |
61 |
private SubstanceBorderPainter baseBorderPainter; |
62 |
|
63 |
public |
64 |
FantasiaBorderPainter(SubstanceBorderPainter baseBorderPainter) |
65 |
{ this.baseBorderPainter = baseBorderPainter; } |
66 |
|
67 |
@Override |
68 |
public boolean isPaintingInnerContour() |
69 |
{ return baseBorderPainter.isPaintingInnerContour(); } |
70 |
|
71 |
@Override |
72 |
public void paintBorder ( |
73 |
Graphics g, Component c, int width, int height, |
74 |
Shape contour, Shape innerContour, SubstanceColorScheme borderScheme |
75 |
) { |
76 |
//if(c instanceof FantasiaComboBox) return; |
77 |
|
78 |
baseBorderPainter.paintBorder(g, c, width, height, contour, innerContour, borderScheme); |
79 |
} |
80 |
|
81 |
@Override |
82 |
public String |
83 |
getDisplayName() |
84 |
{ return baseBorderPainter.getDisplayName(); } |
85 |
} |
86 |
|
87 |
class FantasiaFillPainter implements SubstanceFillPainter { |
88 |
private SubstanceFillPainter basefillPainter; |
89 |
|
90 |
public |
91 |
FantasiaFillPainter(SubstanceFillPainter basefillPainter) |
92 |
{ this.basefillPainter = basefillPainter; } |
93 |
|
94 |
@Override |
95 |
public void |
96 |
paintContourBackground ( |
97 |
Graphics g, Component comp, int width, |
98 |
int height, Shape contour, boolean isFocused, |
99 |
SubstanceColorScheme fillScheme, boolean hasShine |
100 |
) { |
101 |
//if(comp instanceof FantasiaComboBox) return; |
102 |
|
103 |
basefillPainter.paintContourBackground ( |
104 |
g, comp, width, height, contour, isFocused, fillScheme, hasShine |
105 |
); |
106 |
} |
107 |
|
108 |
@Override |
109 |
public String |
110 |
getDisplayName() |
111 |
{ return basefillPainter.getDisplayName(); } |
112 |
} |