/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*
* @author Scott Violet
*/
/**
* Maps from a key that is passed to Style.get to the equivalent class
* specific key.
*/
/**
* Backing style properties that are used if the style does not
* defined the property.
*/
/**
* The font used for this particular style, as determined at
* construction time.
*/
/** Widget type used when looking up class specific values. */
private final int widgetType;
/** The x/y thickness values for this particular style. */
}
if (pangoFontName != null) {
}
} else {
this.font = DEFAULT_FONT;
}
}
super.installDefaults(context);
}
}
return GTK_GRAPHICS;
}
/**
* Returns a <code>SynthPainter</code> that will route the appropriate
* calls to a <code>GTKEngine</code>.
*
* @param state SynthContext indentifying requestor
* @return SynthPainter
*/
return GTKPainter.INSTANCE;
}
return BLACK_COLOR;
}
return WHITE_COLOR;
}
}
}
}
}
/**
* Returns color specific to the current style. This method is
* invoked when other variants don't fit.
*/
{
return new ColorUIResource(rgb);
}
}
}
/**
* Returns the color for the specified state.
*
* @param context SynthContext identifying requester
* @param state to get the color for
* @param type of the color
* @return Color to render with
*/
if (!id.isSubregion() &&
if (!(bg instanceof UIResource)) {
return bg;
}
}
if (!(fg instanceof UIResource)) {
return fg;
}
}
}
}
}
if (c.getName() == "Table.cellRenderer") {
return c.getBackground();
}
return c.getForeground();
}
}
}
// For the enabled state, prefer the widget's colors
return c.getBackground();
}
return c.getForeground();
}
// If getForeground returns a non-UIResource it means the
// developer has explicitly set the foreground, use it over
// that of TEXT_FOREGROUND as that is typically the expected
// behavior.
return color;
}
}
}
}
return font;
}
/**
* Returns the X thickness to use for this GTKStyle.
*
* @return x thickness.
*/
int getXThickness() {
return xThickness;
}
/**
* Returns the Y thickness to use for this GTKStyle.
*
* @return y thickness.
*/
int getYThickness() {
return yThickness;
}
/**
* Returns the Insets. If <code>insets</code> is non-null the resulting
* insets will be placed in it, otherwise a new Insets object will be
* created and returned.
*
* @param context SynthContext indentifying requestor
* @param insets Where to place Insets
* @return Insets.
*/
} else {
}
if ("Spinner.previousButton" == name ||
"Spinner.nextButton" == name) {
} else {
}
}
}
}
}
}
}
if ("TableHeader.renderer" == name) {
}
else if (component instanceof ListCellRenderer) {
}
else if ("Tree.cellRenderer" == name) {
}
}
}
}
}
}
}
}
if (name == "Tree.cellEditor") {
}
}
return insets;
}
// The following calculations are derived from gtkbutton.c
// (GTK+ version 2.8.20), gtk_button_size_allocate() method.
int CHILD_SPACING = 1;
int xThickness = getXThickness();
int yThickness = getYThickness();
{
// Include the default border insets, but only for JButtons
// that are default capable. Note that
// JButton.getDefaultCapable() returns true by default, but
// GtkToolButtons are never default capable, so we skip this
// step if the button is contained in a toolbar.
"default-border", BUTTON_DEFAULT_BORDER_INSETS);
}
return insets;
}
/*
* This is used for both RADIO_BUTTON and CHECK_BOX.
*/
// The following calculations are derived from gtkcheckbutton.c
// (GTK+ version 2.8.20), gtk_check_button_size_allocate() method.
int focusSize =
int focusPad =
// Note: GTKIconFactory.DelegateIcon will have already included the
// "indicator-spacing" value in the size of the indicator icon,
// which explains why we use zero as the left inset (or right inset
// in the RTL case); see 6489585 for more details.
} else {
}
return insets;
}
// The following calculations are derived from gtkmenubar.c
// (GTK+ version 2.8.20), gtk_menu_bar_size_allocate() method.
"internal-padding", 1);
int xThickness = getXThickness();
int yThickness = getYThickness();
return insets;
}
// The following calculations are derived from gtkmenuitem.c
// (GTK+ version 2.8.20), gtk_menu_item_size_allocate() method.
"horizontal-padding", 3);
int xThickness = getXThickness();
int yThickness = getYThickness();
return insets;
}
return insets;
}
int horizPadding = 0;
}
return insets;
}
return insets;
}
return insets;
}
int xThickness = getXThickness();
int yThickness = getYThickness();
int pad = 2;
return insets;
}
// NOTE: this is called for ComboBox, and FormattedTextField also
int xThickness = getXThickness();
int yThickness = getYThickness();
boolean interiorFocus =
int focusSize = 0;
if (!interiorFocus) {
}
return insets;
}
int troughBorder =
if (c.getParent() instanceof JScrollPane) {
// This scrollbar is part of a scrollpane; use only the
// "scrollbar-spacing" style property to determine the padding
// between the scrollbar and its parent scrollpane.
int spacing =
"scrollbar-spacing", 3);
} else {
if (c.getComponentOrientation().isLeftToRight()) {
} else {
}
}
} else {
// This is a standalone scrollbar; leave enough room for the
// focus line in addition to the trough border.
if (c.isFocusable()) {
int focusSize =
int focusPad =
}
}
return insets;
}
/**
* Returns the value for a class specific property for a particular
* WidgetType. This method is useful in those cases where we need to
* fetch a value for a Region that is not associated with the component
* currently in use (e.g. we need to figure out the insets for a
* SCROLL_BAR, but certain values can only be extracted from a
* SCROLL_PANE region).
*
* @param wt WidgetType for which to fetch the value
* @param key Key identifying class specific value
* @return Value, or null if one has not been defined
*/
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
/**
* Convenience method to get a class specific integer value for
* a particular WidgetType.
*
* @param wt WidgetType for which to fetch the value
* @param key Key identifying class specific value
* @param defaultValue Returned if there is no value for the specified
* type
* @return Value, or defaultValue if <code>key</code> is not defined
*/
int defaultValue)
{
}
return defaultValue;
}
/**
* Returns the value for a class specific property. A class specific value
* is a value that will be picked up based on class hierarchy.
*
* @param key Key identifying class specific value
* @return Value, or null if one has not been defined.
*/
}
}
/**
* Convenience method to get a class specific integer value.
*
* @param context SynthContext indentifying requestor
* @param key Key identifying class specific value
* @param defaultValue Returned if there is no value for the specified
* type
* @return Value, or defaultValue if <code>key</code> is not defined
*/
int defaultValue)
{
}
return defaultValue;
}
/**
* Convenience method to get a class specific Insets value.
*
* @param context SynthContext indentifying requestor
* @param key Key identifying class specific value
* @param defaultValue Returned if there is no value for the specified
* type
* @return Value, or defaultValue if <code>key</code> is not defined
*/
{
}
return defaultValue;
}
/**
* Convenience method to get a class specific Boolean value.
*
* @param context SynthContext indentifying requestor
* @param key Key identifying class specific value
* @param defaultValue Returned if there is no value for the specified
* type
* @return Value, or defaultValue if <code>key</code> is not defined
*/
boolean defaultValue)
{
}
return defaultValue;
}
/**
* Returns the value to initialize the opacity property of the Component
* to. A Style should NOT assume the opacity will remain this value, the
* developer may reset it or override it.
*
* @param context SynthContext indentifying requestor
* @return opaque Whether or not the JComponent is opaque.
*/
return true;
}
return true;
}
return false;
}
// See if this is a class specific value.
return value;
}
}
// Is it a specific value ?
if (key == "ScrollPane.viewportBorderInsets") {
}
else if (key == "Slider.tickColor") {
}
else if (key == "ScrollBar.minimumThumbSize") {
int len =
} else {
}
}
else if (key == "Separator.thickness") {
return getYThickness();
} else {
return getXThickness();
}
}
else if (key == "ToolBar.separatorSize") {
"space-size", 12);
}
else if (key == "ScrollBar.buttonSize") {
return horiz ?
}
else if (key == "ArrowButton.size") {
// Believe it or not, the size of a spinner arrow button is
// dependent upon the size of the spinner's font. These
// calculations come from gtkspinbutton.c (version 2.8.20),
// spin_button_get_arrow_size() method.
}
}
// For all other kinds of arrow buttons (e.g. combobox arrow
// buttons), we will simply fall back on the value of
// ArrowButton.size as defined in the UIDefaults for
// GTKLookAndFeel when we call UIManager.get() below...
}
{
// The iconTextGap value needs to include "indicator-spacing"
// and it also needs to leave enough space for the focus line,
// which falls between the indicator icon and the text.
// See getRadioInsets() and 6489585 for more details.
int indicatorSpacing =
int focusSize =
int focusPad =
}
// Is it a stock icon ?
synchronized (ICONS_MAP) {
}
return stockIcon;
}
// Is it another kind of value ?
if (key != "engine") {
// For backward compatability we'll fallback to the UIManager.
// We don't go to the UIManager for engine as the engine is GTK
// specific.
if (key == "Table.rowHeight") {
"focus-line-width", 0);
}
}
return value;
}
// Don't call super, we don't want to pick up defaults from
// SynthStyle.
return null;
}
}
}
// First try loading a theme-specific icon using the native
// GTK libraries (native GTK handles the resizing for us).
return icon;
}
// In a failure case where native GTK (unexpectedly) returns a
// null icon, we can try loading a default icon as a fallback.
}
// In an extreme failure situation, just return null (callers are
// already prepared to handle a null icon, so the worst that can
return null;
}
{
}
static class GTKStockIconInfo {
}
return iconSizes;
}
/**
* Return the size of a particular icon type (logical size)
*
* @param type icon type (GtkIconSize value)
* @return a Dimension object, or null if lsize is invalid
*/
}
/**
* Change icon size in a type to size mapping. This is called by code
* that parses the gtk-icon-sizes setting
*
* @param type icon type (GtkIconSize value)
* @param w the new icon width
* @param h the new icon height
*/
}
}
/**
* Return icon type (GtkIconSize value) given a symbolic name which can
* occur in a theme file.
*
* @param size symbolic name, e.g. gtk-button
* @return icon type. Valid types are 1 to 6
*/
return UNDEFINED;
}
if (ICON_TYPE_MAP == null) {
}
}
private static void initIconTypeMap() {
}
}
/**
* An Icon that is fetched using getStockIcon.
*/
private int size;
private boolean loadedLTR;
private boolean loadedRTL;
}
int y, int w, int h) {
}
else {
}
}
}
return icon.getIconWidth();
}
return 0;
}
return icon.getIconHeight();
}
return 0;
}
}
if (!loadedLTR) {
loadedLTR = true;
}
return ltrIcon;
}
else if (!loadedRTL) {
loadedRTL = true;
}
return rtlIcon;
}
return ltrIcon;
}
}
/**
* GTKLazyValue is a slimmed down version of <code>ProxyLaxyValue</code>.
* The code is duplicate so that it can get at the package private
* classes in gtk.
*/
/**
* Name of the class to create.
*/
}
this.methodName = methodName;
}
try {
if (methodName == null) {
return c.newInstance();
}
} catch (ClassNotFoundException cnfe) {
} catch (IllegalAccessException iae) {
} catch (InvocationTargetException ite) {
} catch (NoSuchMethodException nsme) {
} catch (InstantiationException ie) {
}
return null;
}
}
static {
}
}