summaryrefslogtreecommitdiff
path: root/NET/worlds/console/IEWebControlImp.java
blob: e06310af918bae7903fb83e869e55d1f6846a278 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package NET.worlds.console;

class IEWebControlImp extends WebControlImp {
   private int nativeIEInstance;
   private int m_hwnd;
   private boolean detached;

   private native boolean nativeInit(int var1, boolean var2);

   private native void nativeDestroy();

   private native void nativeSetURL(String var1, String var2);

   private native void nativeGoBack();

   private native void nativeGoForward();

   private native void nativeStop();

   private native void nativeRefresh();

   private native void nativeHome();

   private native void nativePrint(int var1, int var2);

   private native void nativeResize(int var1, int var2, int var3, int var4);

   private native void nativeAddToolbar();

   private native int nativeGetHWND();

   public IEWebControlImp(int hwnd, boolean toolbar, boolean isBanner) throws NoWebControlException {
      super(hwnd);
      this.m_hwnd = hwnd;
      this.nativeIEInstance = 0;
      this.detached = false;
      if (!this.nativeInit(hwnd, isBanner)) {
         this.detached = true;
         throw new NoWebControlException("Could not initialize IE control");
      } else {
         if (toolbar) {
            this.nativeAddToolbar();
         }
      }
   }

   @Override
   public void finalize() {
      this.detach();
   }

   @Override
   public void renderTo(int dc) {
      this.nativePrint(dc, this.m_hwnd);
   }

   @Override
   public boolean setURL(String pURL) {
      pURL = processURL(pURL);
      if (pURL == null) {
         return false;
      } else {
         this.nativeSetURL(pURL, null);
         return true;
      }
   }

   @Override
   public boolean setURL(String pURL, String pPostData) {
      pURL = processURL(pURL);
      if (pURL == null) {
         return false;
      } else {
         if (pPostData != null) {
            pPostData = processURL(pPostData);
            if (pPostData == null) {
               return false;
            }
         }

         this.nativeSetURL(pURL, pPostData);
         return true;
      }
   }

   @Override
   public void detach() {
      if (!this.detached) {
         this.nativeDestroy();
         super.detach();
         this.nativeIEInstance = 0;
         this.detached = true;
      }
   }

   @Override
   public void resize(int w, int h, int xPer, int yPer) {
      this.nativeResize(w, h, xPer, yPer);
   }

   @Override
   public void goBack() {
      this.nativeGoBack();
   }

   @Override
   public void goForward() {
      this.nativeGoForward();
   }

   @Override
   public void stop() {
      this.nativeStop();
   }

   @Override
   public void refresh() {
      this.nativeRefresh();
   }

   @Override
   public void home() {
      this.nativeHome();
   }

   @Override
   public int getHWND() {
      return this.nativeGetHWND();
   }
}