/*
* 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.
*/
public static final RecyclableSingleton<Dynamic> fDynamic = new RecyclableSingletonFromDefaultConstructor<Dynamic>(Dynamic.class);
}
private static final RecyclableSingleton<Toggle> fToggle = new RecyclableSingletonFromDefaultConstructor<Toggle>(Toggle.class);
}
public static final RecyclableSingleton<Toolbar> fToolBar = new RecyclableSingletonFromDefaultConstructor<Toolbar>(Toolbar.class);
}
protected Named getInstance() {
return new Named(Widget.BUTTON_BEVEL, new SizeDescriptor(new SizeVariant().alterMargins(2, 4, 2, 4)));
}
};
}
super(sizeDescriptor);
}
super(other);
}
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
// for now we don't paint a border. We let the button paint it since there
// needs to be a strict ordering for aqua components.
//paintButton(c, g, x, y, width, height);
}
final AbstractButton b = (AbstractButton)c;
painter.state.set((state != State.DISABLED && state != State.INACTIVE) && b.isFocusPainted() && isFocused(b) ? Focused.YES : Focused.NO);
// Full border size of the component.
// g.setColor(new Color(0, 255, 0, 70));
// g.drawRect(x, y, width - 1, height - 1);
// Where the native border should start to paint.
// g.setColor(new Color(255, 0, 255, 70));
// g.drawRect(x, y, width - 1, height - 1);
}
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
}
// The default button shouldn't draw its color when the window is inactive.
// Changed for <rdar://problem/3614421>: Aqua LAF Buttons are incorrectly drawn disabled
// all we need to do is make sure we aren't the default button any more and that
// we aren't active, but we still are enabled if the button is enabled.
// if we set dimmed we would appear disabled despite being enabled and click through
// works so this now matches the text drawing and most importantly the HIG
}
protected boolean isSelectionPressing() {
return true;
}
return (
);
}
/**
* Returns the insets of the border.
* @param c the component for which this border insets value applies
*/
return margin;
}
return null;
}
}
/**
* Returns whether or not the border is opaque. If the border
* is opaque, it is responsible for filling in it's own
* background when painting.
*/
public boolean isBorderOpaque() {
return false;
}
static class SizeConstants {
}
public Dynamic() {
return super.deriveSmall(v.alterMinSize(0, -2).alterMargins(0, -3, 0, -3).alterInsets(-3, -3, -4, -3));
}
return super.deriveMini(v.alterMinSize(0, -2).alterMargins(0, -3, 0, -3).alterInsets(-3, -3, -1, -3));
}
});
}
super(other);
}
return state;
}
return ALTERNATE_PUSH_INSETS;
}
return ALTERNATE_BEVEL_INSETS;
}
return ALTERNATE_SQUARE_INSETS;
}
return null;
}
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, int x, int y, int width, int height) {
// custom adjusting
}
}
protected Widget getStyleForSize(final AbstractButton b, final Size size, final int width, final int height) {
return Widget.BUTTON_PUSH;
}
if (height < SizeConstants.fSquareButtonHeightThreshold || width < SizeConstants.fSquareButtonWidthThreshold) {
return Widget.BUTTON_BEVEL;
}
if (height <= SizeConstants.fNormalButtonHeight + 3 && width < SizeConstants.fNormalMinButtonWidth) {
return Widget.BUTTON_BEVEL;
}
if ((height > SizeConstants.fNormalButtonHeight + 3) || (b.getIcon() != null) || hasSmallerInsets(b)){
return Widget.BUTTON_BEVEL_ROUND;
}
return Widget.BUTTON_PUSH;
}
}
public Toggle() {
}
super(other);
}
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
if (height < SizeConstants.fSquareButtonHeightThreshold || width < SizeConstants.fSquareButtonWidthThreshold) {
return;
}
}
}
super(sizeDescriptor);
}
// called by reflection
super(sizeDescriptor);
}
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
}
}
public Toolbar() {
}
super(other);
}
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int w, final int h) {
super.doButtonPaint(b, model, g, x, y, w, h);
}
}
}