/* */ package NET.worlds.console; /* */ /* */ /* */ public abstract class RenderCanvasOverlay /* */ { /* */ private RenderCanvas canvas; /* */ /* */ private int xPercent; /* */ /* */ private int yPercent; /* */ /* */ private int xFixed; /* */ /* */ private int yFixed; /* */ /* */ private boolean isFixed; /* */ private boolean fullscreen; /* */ private int hwnd; /* */ private boolean allowFocus; /* */ /* */ public RenderCanvasOverlay(RenderCanvas pCanvas, int pX, int pY, boolean pIsFixed, boolean pAllowFocus) /* */ throws NoWebControlException /* */ { /* 24 */ assert ((pX > 0) || (pY > 0)); /* */ /* 26 */ if ((pCanvas == null) || (pCanvas.getWindow() == null)) { /* 27 */ throw new NoWebControlException("RenderCanvas does not exist"); /* */ } /* 29 */ this.canvas = pCanvas; /* 30 */ this.isFixed = pIsFixed; /* 31 */ this.allowFocus = pAllowFocus; /* */ /* 33 */ if (this.isFixed) { /* 34 */ this.xFixed = pX; /* 35 */ this.yFixed = pY; /* 36 */ this.xPercent = (this.yPercent = 1); /* */ } else { /* 38 */ this.xPercent = pX; /* 39 */ this.yPercent = pY; /* */ } /* */ /* */ /* 43 */ this.fullscreen = false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public RenderCanvasOverlay(RenderCanvas pCanvas) /* */ { /* 53 */ assert (pCanvas != null); /* */ /* 55 */ this.canvas = pCanvas; /* 56 */ this.xPercent = (this.yPercent = 100); /* 57 */ this.isFixed = false; /* 58 */ this.allowFocus = true; /* */ /* 60 */ this.fullscreen = true; /* */ /* */ /* 63 */ this.hwnd = this.canvas.getWindow().getHwnd(); /* */ } /* */ /* */ public void activate() { /* 67 */ this.canvas.addOverlay(this); /* */ } /* */ /* */ int getNativeWindowHandle() { /* 71 */ assert (this.canvas.getWindow() != null); /* */ /* 73 */ if (this.hwnd == 0) { /* 74 */ if (this.fullscreen) { /* 75 */ this.hwnd = this.canvas.getWindow().getHwnd(); /* */ } else { /* 77 */ this.hwnd = nativeMakeChild(this.canvas.getWindow().getHwnd(), this.xPercent, /* 78 */ this.yPercent, this.allowFocus); /* */ } /* */ } /* 81 */ return this.hwnd; /* */ } /* */ /* */ int getXPercent() { /* 85 */ return this.xPercent; /* */ } /* */ /* */ int getYPercent() { /* 89 */ return this.yPercent; /* */ } /* */ /* */ int getFixedWidth() { /* 93 */ return this.xFixed; /* */ } /* */ /* */ int getFixedHeight() { /* 97 */ return this.yFixed; /* */ } /* */ /* */ /* 101 */ boolean getIsFixedSize() { return this.isFixed; } /* */ /* */ void canvasResized(int parentX, int parentY) { /* */ int w; /* */ int h; /* 106 */ if (this.isFixed) { /* 107 */ int w = this.xFixed; /* 108 */ int h = this.yFixed; /* 109 */ if (w > parentX) /* 110 */ w = parentX; /* 111 */ if (h > parentY) /* 112 */ h = parentY; /* 113 */ this.xPercent = /* 114 */ ((int)Math.ceil(w / parentX * 100.0D)); /* 115 */ this.yPercent = /* 116 */ ((int)Math.ceil(h / parentY * 100.0D)); /* */ } else { /* 118 */ w = (int)(parentX * this.xPercent * 0.01D); /* 119 */ h = (int)(parentY * this.yPercent * 0.01D); /* */ } /* */ /* 122 */ if (this.hwnd != 0) { /* 123 */ nativeResizeChild(this.hwnd, w, h); /* */ } /* */ } /* */ /* */ boolean isFullscreen() { /* 128 */ return (this.fullscreen) || ((!this.isFixed) && (this.xPercent == 100) && (this.yPercent == 100)); /* */ } /* */ /* */ /* */ /* */ protected abstract void handleCommand(int paramInt); /* */ /* */ /* */ void detach() /* */ { /* 138 */ this.canvas.removeOverlay(this); /* 139 */ if ((!this.fullscreen) && (this.hwnd != 0)) { /* 140 */ nativeKillChild(this.hwnd); /* */ } /* */ } /* */ /* */ private native int nativeMakeChild(long paramLong, int paramInt1, int paramInt2, boolean paramBoolean); /* */ /* */ private native void nativeKillChild(long paramLong); /* */ /* */ private native void nativeResizeChild(int paramInt1, int paramInt2, int paramInt3); /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\RenderCanvasOverlay.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */