2
* Copyright (c) 2002-2004 JGoodies Karsten Lentzsch. All Rights Reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
7
* o Redistributions of source code must retain the above copyright notice,
8
* this list of conditions and the following disclaimer.
10
* o Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
14
* o Neither the name of JGoodies Karsten Lentzsch nor the names of
15
* its contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
package com.jgoodies.forms.util;
33
import com.jgoodies.forms.layout.ConstantSize;
34
import com.jgoodies.forms.layout.Size;
35
import com.jgoodies.forms.layout.Sizes;
38
* A {@link LayoutStyle} that aims to provide layout constants as defined by
39
* Microsoft's <i>Design Specifications and Guidelines - Visual Design</i>.
41
* @author Karsten Lentzsch
42
* @version $Revision: 1.3 $
45
final class MacLayoutStyle extends LayoutStyle {
47
static final MacLayoutStyle INSTANCE = new MacLayoutStyle();
49
private MacLayoutStyle() {
50
// Suppresses default constructor, ensuring non-instantiability.
54
// Component Sizes ******************************************************
56
private static final Size BUTTON_WIDTH = Sizes.dluX(39);
57
private static final Size BUTTON_HEIGHT = Sizes.dluY(14);
60
// Gaps ******************************************************************
62
private static final ConstantSize DIALOG_MARGIN_X = Sizes.DLUX9;
63
private static final ConstantSize DIALOG_MARGIN_Y = Sizes.DLUY9;
65
private static final ConstantSize TABBED_DIALOG_MARGIN_X = Sizes.DLUX4;
66
private static final ConstantSize TABBED_DIALOG_MARGIN_Y = Sizes.DLUY4;
68
private static final ConstantSize LABEL_COMPONENT_PADX = Sizes.DLUX3;
69
private static final ConstantSize RELATED_COMPONENTS_PADX = Sizes.DLUX4;
70
private static final ConstantSize UNRELATED_COMPONENTS_PADX = Sizes.DLUX8;
72
private static final ConstantSize RELATED_COMPONENTS_PADY = Sizes.DLUY3;
73
private static final ConstantSize UNRELATED_COMPONENTS_PADY = Sizes.DLUY6;
74
private static final ConstantSize NARROW_LINE_PAD = Sizes.DLUY2;
75
private static final ConstantSize LINE_PAD = Sizes.DLUY3;
76
private static final ConstantSize PARAGRAPH_PAD = Sizes.DLUY9;
77
private static final ConstantSize BUTTON_BAR_PAD = Sizes.DLUY4;
80
// Layout Sizes *********************************************************
83
* Returns this style's default button width.
85
* @return the default button width
87
* @see #getDefaultButtonHeight()
89
public Size getDefaultButtonWidth() {
95
* Returns this style's default button height.
97
* @return the default button height
99
* @see #getDefaultButtonWidth()
101
public Size getDefaultButtonHeight() {
102
return BUTTON_HEIGHT;
107
* Returns this style's horizontal margin for general dialogs.
109
* @return the horizontal margin for general dialogs
111
* @see #getDialogMarginY()
112
* @see #getTabbedDialogMarginX()
114
public ConstantSize getDialogMarginX() {
115
return DIALOG_MARGIN_X;
120
* Returns this style's vertical margin for general dialogs.
122
* @return the vertical margin for general dialogs
124
* @see #getDialogMarginX()
125
* @see #getTabbedDialogMarginY()
127
public ConstantSize getDialogMarginY() {
128
return DIALOG_MARGIN_Y;
133
* Returns this style's horizontal margin for dialogs that consist of
136
* @return the horizontal margin for dialogs that consist of a tabbed pane
139
* @see #getTabbedDialogMarginY()
140
* @see #getDialogMarginX()
142
public ConstantSize getTabbedDialogMarginX() {
143
return TABBED_DIALOG_MARGIN_X;
148
* Returns this style's vertical margin for dialogs that consist of
151
* @return the vertical margin for dialogs that consist of a tabbed pane
154
* @see #getTabbedDialogMarginX()
155
* @see #getDialogMarginY()
157
public ConstantSize getTabbedDialogMarginY() {
158
return TABBED_DIALOG_MARGIN_Y;
163
* Returns a gap used to separate a label and associated control.
165
* @return a gap between label and associated control
167
* @see #getRelatedComponentsPadX()
168
* @see #getUnrelatedComponentsPadX()
170
public ConstantSize getLabelComponentPadX() {
171
return LABEL_COMPONENT_PADX;
176
* Returns a horizontal gap used to separate related controls.
178
* @return a horizontal gap between related controls
180
* @see #getLabelComponentPadX()
181
* @see #getRelatedComponentsPadY()
182
* @see #getUnrelatedComponentsPadX()
184
public ConstantSize getRelatedComponentsPadX() {
185
return RELATED_COMPONENTS_PADX;
190
* Returns a vertical gap used to separate related controls.
192
* @return a vertical gap between related controls
194
* @see #getRelatedComponentsPadX()
195
* @see #getUnrelatedComponentsPadY()
197
public ConstantSize getRelatedComponentsPadY() {
198
return RELATED_COMPONENTS_PADY;
203
* Returns a horizontal gap used to separate unrelated controls.
205
* @return a horizontal gap between unrelated controls
207
* @see #getLabelComponentPadX()
208
* @see #getUnrelatedComponentsPadY()
209
* @see #getRelatedComponentsPadX()
211
public ConstantSize getUnrelatedComponentsPadX() {
212
return UNRELATED_COMPONENTS_PADX;
217
* Returns a vertical gap used to separate unrelated controls.
219
* @return a vertical gap between unrelated controls
221
* @see #getUnrelatedComponentsPadX()
222
* @see #getRelatedComponentsPadY()
224
public ConstantSize getUnrelatedComponentsPadY() {
225
return UNRELATED_COMPONENTS_PADY;
230
* Returns a narrow vertical pad used to separate lines.
232
* @return a narrow vertical pad used to separate lines
235
* @see #getParagraphPad()
237
public ConstantSize getNarrowLinePad() {
238
return NARROW_LINE_PAD;
243
* Returns a narrow vertical pad used to separate lines.
245
* @return a vertical pad used to separate lines
247
* @see #getNarrowLinePad()
248
* @see #getParagraphPad()
250
public ConstantSize getLinePad() {
256
* Returns a pad used to separate paragraphs.
258
* @return a vertical pad used to separate paragraphs
260
* @see #getNarrowLinePad()
263
public ConstantSize getParagraphPad() {
264
return PARAGRAPH_PAD;
269
* Returns a pad used to separate a button bar from a component.
271
* @return a vertical pad used to separate paragraphs
274
* @see #getRelatedComponentsPadY()
275
* @see #getUnrelatedComponentsPadY()
277
public ConstantSize getButtonBarPad() {
278
return BUTTON_BAR_PAD;
283
* Checks and answers whether buttons are typically ordered from
284
* left to right or from right to left. Useful for building button bars
285
* that shall comply with the platform's layout style guide.<p>
287
* For example the Windows style guide recommends to layout out
288
* <em>OK, Cancel, Apply</em> from left to right, where the
289
* Mac Aqua style guide recommends to layout out these buttons
290
* from right to left.<p>
292
* Although most button sequences shall honor this order
293
* some buttons require a left to right order. For example
294
* <em>Back, Next</em> or <em>Move Left, Move Right</em>.<p>
296
* @return true if buttons are typically ordered from left to right
299
* @see com.jgoodies.forms.builder.ButtonBarBuilder
300
* @see com.jgoodies.forms.factories.ButtonBarFactory
302
public boolean isLeftToRightButtonOrder() {
b'\\ No newline at end of file'