package com.sun.glass.ui.mac;
import java.nio.ByteBuffer;
import com.sun.glass.ui.Application;
import com.sun.glass.ui.Menu;
import com.sun.glass.ui.MenuItem.Callback;
import com.sun.glass.ui.Pixels;
import com.sun.glass.ui.delegate.MenuBarDelegate;
import com.sun.glass.ui.delegate.MenuDelegate;
import com.sun.glass.ui.delegate.MenuItemDelegate;
import java.security.AccessController;
import java.security.PrivilegedAction;
class implements MenuDelegate, MenuItemDelegate {
private static native void ();
static {
_initIDs();
}
long ;
private Menu ;
public (final Menu menu) {
this.menu = menu;
}
public () {
}
private native long (String title, boolean enabled);
@Override public boolean (String title, boolean enabled) {
ptr = _createMenu(title, enabled);
return ptr != 0;
}
private native long (String title, char shortcut, int modifiers,
Pixels icon, boolean enabled, boolean checked,
Callback callback);
@Override public boolean (String title, Callback callback,
int shortcutKey, int shortcutModifiers, Pixels pixels,
boolean enabled, boolean checked) {
ptr = _createMenuItem(title, (char)shortcutKey, shortcutModifiers,
pixels, enabled, checked, callback);
return ptr != 0;
}
private native void (long menuPtr, long submenuPtr, int pos);
@Override public boolean (MenuDelegate menu, int pos) {
MacMenuDelegate macMenu = (MacMenuDelegate)menu;
_insert(ptr, macMenu.ptr, pos);
return true;
}
@Override public boolean (MenuItemDelegate item, int pos) {
MacMenuDelegate macMenu = (MacMenuDelegate)item;
_insert(ptr, macMenu != null ? macMenu.ptr : 0, pos);
return true;
}
private native void (long menuPtr, long submenuPtr, int pos);
@Override public boolean (MenuDelegate menu, int pos) {
MacMenuDelegate macMenu = (MacMenuDelegate)menu;
_remove(ptr, macMenu.ptr, pos);
return true;
}
@Override public boolean (MenuItemDelegate item, int pos) {
MacMenuDelegate macMenu = (MacMenuDelegate)item;
_remove(ptr, macMenu == null ? 0L : macMenu.ptr, pos);
return true;
}
private native void (long menuPtr, String title);
@Override public boolean (String title) {
_setTitle(ptr, title);
return true;
}
private native void (long menuPtr, char shortcut, int modifiers);
@Override public boolean (int shortcutKey, int shortcutModifiers) {
_setShortcut(ptr, (char)shortcutKey, shortcutModifiers);
return true;
}
private native void (long menuPtr, Pixels pixels);
@Override public boolean (Pixels pixels) {
_setPixels(ptr, pixels);
return true;
}
private native void (long menuPtr, boolean enabled);
@Override public boolean (boolean enabled) {
_setEnabled(ptr, enabled);
return true;
}
private native void (long menuPtr, boolean checked);
@Override public boolean (boolean checked) {
_setChecked(ptr, checked);
return true;
}
private native void (long menuPtr, Callback callback);
@Override public boolean (Callback callback) {
_setCallback(ptr, callback);
return true;
}
}