/*
* 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.
*/
// TODO: no screen menu bar for now
public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.Client/*, ScreenMenuItemUI*/ {
static final String sPropertyPrefixes[] = { "MenuItem", "CheckBoxMenuItem", "RadioButtonMenuItem" };
boolean fIsScreenMenuItem = false;
boolean fIsIndeterminate = false;
int fType;
super();
}
return new AquaMenuItemUI(type);
}
// The only real difference between the three is which property prefix it returns
// and therefore which icons!
return sPropertyPrefixes[fType];
}
protected void installListeners() {
super.installListeners();
}
protected void uninstallListeners() {
super.uninstallListeners();
}
public void updateListenersForScreenMenuItem() {
setIsScreenMenu(true);
}
// Users can dynamically change the kind of menu we're on by calling JPopupMenu.setInvoker
// so we need to be prepared to put the listeners back on
if (fIsScreenMenuItem != isScreenMenuItem) {
if (fIsScreenMenuItem) removeListeners();
else addListeners();
}
}
protected void removeListeners() {
}
protected void addListeners() {
}
protected void paintMenuItem(final Graphics g, final JComponent c, final Icon localCheckIcon, final Icon localArrowIcon, final Color background, final Color foreground, final int localDefaultTextIconGap) {
AquaMenuPainter.instance().paintMenuItem(this, g, c, localCheckIcon, localArrowIcon, background, foreground, disabledForeground, selectionForeground, localDefaultTextIconGap, acceleratorFont);
}
protected Dimension getPreferredMenuItemSize(final JComponent c, final Icon localCheckIcon, final Icon localArrowIcon, final int localDefaultTextIconGap) {
return AquaMenuPainter.instance().getPreferredMenuItemSize(c, localCheckIcon, localArrowIcon, localDefaultTextIconGap, acceleratorFont);
}
if (c.isOpaque()) {
// sja fix ((PenGraphics)g).alphaClearRect(0,0,c.getWidth(),c.getHeight());
g.setColor(c.getBackground());
}
paint(g, c);
}
public void paintBackground(final Graphics g, final JComponent c, final int menuWidth, final int menuHeight) {
g.setColor(c.getBackground());
if (((JMenuItem)c).isBorderPainted()) {
}
//getTheme().drawMenuItem(c, g, 0, 0, menuWidth, menuHeight);
} else {
// If selected, use black (see AquaLookAndFeel "Menu.selectionBackground")
} else {
//super.paintBackground(g,c,menuWidth, menuHeight); //getTheme().drawMenuBackground((Component)c, g, (short)1, 0, 0, menuWidth, menuHeight);
}
}
}
public void paintSelected(final boolean selected) {
}
});
}
}
}
}
if (!(ui instanceof AquaMenuItemUI)) return;
} else {
}
}
}
}
}