Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorderMetrics.java
41154 views
1
/*
2
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package com.apple.laf;
27
28
import java.awt.Font;
29
30
import apple.laf.JRSUIUtils;
31
import com.apple.laf.AquaUtils.RecyclableSingleton;
32
33
public abstract class AquaInternalFrameBorderMetrics {
34
private static final boolean useLegacyBorderMetrics = JRSUIUtils.InternalFrame.shouldUseLegacyBorderMetrics();
35
36
public Font font;
37
public int titleBarHeight;
38
public int leftSidePadding;
39
public int buttonHeight;
40
public int buttonWidth;
41
public int buttonPadding;
42
public int downShift;
43
44
private AquaInternalFrameBorderMetrics() {
45
initialize();
46
}
47
48
protected abstract void initialize();
49
50
public static AquaInternalFrameBorderMetrics getMetrics(boolean isUtility) {
51
if (useLegacyBorderMetrics) {
52
return isUtility ? legacyUtilityMetrics.get() : legacyStandardMetrics.get();
53
} else {
54
return isUtility ? utilityMetrics.get() : standardMetrics.get();
55
}
56
}
57
58
private static final RecyclableSingleton<AquaInternalFrameBorderMetrics> standardMetrics = new RecyclableSingleton<AquaInternalFrameBorderMetrics>() {
59
@Override
60
protected AquaInternalFrameBorderMetrics getInstance() {
61
return new AquaInternalFrameBorderMetrics() {
62
protected void initialize() {
63
font = new Font("Lucida Grande", Font.PLAIN, 13);
64
titleBarHeight = 22;
65
leftSidePadding = 7;
66
buttonHeight = 15;
67
buttonWidth = 15;
68
buttonPadding = 5;
69
downShift = 0;
70
}
71
};
72
}
73
};
74
75
private static final RecyclableSingleton<AquaInternalFrameBorderMetrics> utilityMetrics = new RecyclableSingleton<AquaInternalFrameBorderMetrics>() {
76
@Override
77
protected AquaInternalFrameBorderMetrics getInstance() {
78
return new AquaInternalFrameBorderMetrics() {
79
protected void initialize() {
80
font = new Font("Lucida Grande", Font.PLAIN, 11);
81
titleBarHeight = 16;
82
leftSidePadding = 6;
83
buttonHeight = 12;
84
buttonWidth = 12;
85
buttonPadding = 6;
86
downShift = 0;
87
}
88
};
89
}
90
};
91
92
private static final RecyclableSingleton<AquaInternalFrameBorderMetrics> legacyStandardMetrics = new RecyclableSingleton<AquaInternalFrameBorderMetrics>() {
93
@Override
94
protected AquaInternalFrameBorderMetrics getInstance() {
95
return new AquaInternalFrameBorderMetrics() {
96
protected void initialize() {
97
font = new Font("Lucida Grande", Font.PLAIN, 13);
98
titleBarHeight = 22;
99
leftSidePadding = 8;
100
buttonHeight = 15;
101
buttonWidth = 15;
102
buttonPadding = 6;
103
downShift = 1;
104
}
105
};
106
}
107
};
108
109
private static final RecyclableSingleton<AquaInternalFrameBorderMetrics> legacyUtilityMetrics = new RecyclableSingleton<AquaInternalFrameBorderMetrics>() {
110
@Override
111
protected AquaInternalFrameBorderMetrics getInstance() {
112
return new AquaInternalFrameBorderMetrics() {
113
protected void initialize() {
114
font = new Font("Lucida Grande", Font.PLAIN, 11);
115
titleBarHeight = 16;
116
leftSidePadding = 5;
117
buttonHeight = 13;
118
buttonWidth = 13;
119
buttonPadding = 5;
120
downShift = 0;
121
}
122
};
123
}
124
};
125
}
126
127