summaryrefslogtreecommitdiff
path: root/NET/worlds/console/RightMenu.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/RightMenu.java')
-rw-r--r--NET/worlds/console/RightMenu.java160
1 files changed, 160 insertions, 0 deletions
diff --git a/NET/worlds/console/RightMenu.java b/NET/worlds/console/RightMenu.java
new file mode 100644
index 0000000..536c5d2
--- /dev/null
+++ b/NET/worlds/console/RightMenu.java
@@ -0,0 +1,160 @@
+/* */ package NET.worlds.console;
+/* */
+/* */ import NET.worlds.scape.Action;
+/* */ import NET.worlds.scape.EditTile;
+/* */ import NET.worlds.scape.RunningActionHandler;
+/* */ import NET.worlds.scape.WObject;
+/* */ import java.util.Enumeration;
+/* */ import java.util.Hashtable;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class RightMenu
+/* */ implements MainCallback
+/* */ {
+/* 26 */ private static RightMenu _current = null;
+/* */
+/* */
+/* */
+/* */ private WObject _obj;
+/* */
+/* */
+/* */ private Enumeration<Action> _acts;
+/* */
+/* */
+/* 36 */ private Hashtable<Integer, Action> _inttobuttons = new Hashtable();
+/* */
+/* 38 */ private int _edit = 0;
+/* */
+/* */
+/* 41 */ private int _pm = 0;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public RightMenu(WObject obj, Enumeration<Action> acts)
+/* */ {
+/* 51 */ this._obj = obj;
+/* 52 */ this._acts = acts;
+/* 53 */ Main.register(this);
+/* */ }
+/* */
+/* 56 */ private int _lastID = 0;
+/* */
+/* */ private int add(String label) {
+/* 59 */ if (this._lastID == 0) {
+/* 60 */ this._lastID = 100;
+/* */ }
+/* 62 */ int id = this._lastID++;
+/* 63 */ assert (this._lastID < 200);
+/* */
+/* 65 */ nativeAdd(label, id, this._pm);
+/* 66 */ return id;
+/* */ }
+/* */
+/* */
+/* */
+/* */ private static native int create();
+/* */
+/* */
+/* */ private static native void nativeAdd(String paramString, int paramInt1, int paramInt2);
+/* */
+/* */
+/* */ private static native void addSeparator(int paramInt);
+/* */
+/* */
+/* */ private static native void show(int paramInt1, int paramInt2);
+/* */
+/* */
+/* */ private static native void discard(int paramInt);
+/* */
+/* */
+/* */ private static native int checkPressed();
+/* */
+/* */
+/* */ private void build(Enumeration<Action> acts)
+/* */ {
+/* 91 */ if (_current != null) {
+/* 92 */ _current.close();
+/* */ }
+/* 94 */ _current = this;
+/* 95 */ int rows = 0;
+/* 96 */ Hashtable<String, Action> buttons = new Hashtable();
+/* 97 */ while (acts.hasMoreElements()) {
+/* 98 */ Action act = (Action)acts.nextElement();
+/* 99 */ String label = act.rightMenuLabel;
+/* 100 */ if ((label != null) && (label != "")) {
+/* 101 */ buttons.put(label, act);
+/* 102 */ rows++;
+/* */ }
+/* */ }
+/* 105 */ if ((rows > 0) || (Gamma.getShaper() != null)) {
+/* 106 */ this._pm = create();
+/* 107 */ if (Gamma.getShaper() != null)
+/* */ {
+/* 109 */ this._edit = add("Edit Properties...");
+/* 110 */ if (rows > 0)
+/* 111 */ addSeparator(this._pm);
+/* */ }
+/* 113 */ for (Enumeration<String> en = buttons.keys(); en.hasMoreElements();) {
+/* 114 */ String label = (String)en.nextElement();
+/* 115 */ this._inttobuttons.put(new Integer(add(label)), (Action)buttons.get(label));
+/* */ }
+/* 117 */ show(Window.getHWnd(), this._pm);
+/* */ } else {
+/* 119 */ close();
+/* */ }
+/* */ }
+/* */
+/* 123 */ private void close() { discard(this._pm);
+/* 124 */ this._pm = 0;
+/* 125 */ Main.unregister(this);
+/* 126 */ _current = null;
+/* */ }
+/* */
+/* */ private void checkButton() {
+/* 130 */ int pressed = checkPressed();
+/* 131 */ if (pressed == 0)
+/* 132 */ return;
+/* 133 */ if (pressed == this._edit) {
+/* 134 */ Console.getFrame().getEditTile().viewProperties(this._obj);
+/* */ } else {
+/* 136 */ Action action = (Action)this._inttobuttons.get(new Integer(pressed));
+/* 137 */ RunningActionHandler.trigger(action, this._obj.getWorld(), null);
+/* */ }
+/* 139 */ close();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void mainCallback()
+/* */ {
+/* 147 */ if (this._acts != null) {
+/* 148 */ build(this._acts);
+/* 149 */ this._acts = null;
+/* */ } else {
+/* 151 */ checkButton();
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\RightMenu.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file