1
2
3
4 package org.sirius.server.win32.classes.controls;
5
6 import javax.jws.WebService;
7
8 import org.sirius.server.win32.classes.Common;
9 import org.sirius.server.win32.classes.Window;
10 import org.sirius.server.win32.constants.IEditConsts;
11
12 import com.sun.jna.Pointer;
13 import com.sun.jna.platform.win32.WinDef.HWND;
14 import com.sun.jna.platform.win32.WinDef.LPARAM;
15 import com.sun.jna.platform.win32.WinDef.WPARAM;
16
17
18
19
20
21 @WebService
22 public class Edit extends Common implements IEditConsts {
23
24
25
26
27 public Edit() {
28
29 }
30
31
32
33
34
35
36 public final int canUndo(final long hwndCtl) {
37 HWND hWnd = longToHwnd(hwndCtl);
38 WPARAM wParam = new WPARAM(0);
39 LPARAM lParam = new LPARAM(0);
40 return getUser32().SendMessage(hWnd, EM_CANUNDO, wParam, lParam);
41 }
42
43
44
45
46
47
48 public final int emptyUndoBuffer(final long hwndCtl) {
49 HWND hWnd = longToHwnd(hwndCtl);
50 WPARAM wParam = new WPARAM(0);
51 LPARAM lParam = new LPARAM(0);
52 return getUser32().SendMessage(
53 hWnd,
54 EM_EMPTYUNDOBUFFER,
55 wParam,
56 lParam);
57 }
58
59
60
61
62
63
64 public final int getFirstVisibleLine(final long hwndCtl) {
65 HWND hWnd = longToHwnd(hwndCtl);
66 WPARAM wParam = new WPARAM(0);
67 LPARAM lParam = new LPARAM(0);
68 return getUser32().SendMessage(
69 hWnd,
70 EM_GETFIRSTVISIBLELINE,
71 wParam,
72 lParam);
73 }
74
75
76
77
78
79
80 public final int getLineCount(final long hwndCtl) {
81 HWND hWnd = longToHwnd(hwndCtl);
82 WPARAM wParam = new WPARAM(0);
83 LPARAM lParam = new LPARAM(0);
84 return getUser32().SendMessage(hWnd, EM_GETLINECOUNT, wParam, lParam);
85 }
86
87
88
89
90
91
92 public final int getModify(final long hwndCtl) {
93 HWND hWnd = longToHwnd(hwndCtl);
94 WPARAM wParam = new WPARAM(0);
95 LPARAM lParam = new LPARAM(0);
96 return getUser32().SendMessage(hWnd, EM_GETMODIFY, wParam, lParam);
97 }
98
99
100
101
102
103
104 public final int getPasswordChar(final long hwndCtl) {
105 HWND hWnd = longToHwnd(hwndCtl);
106 WPARAM wParam = new WPARAM(0);
107 LPARAM lParam = new LPARAM(0);
108 return getUser32().SendMessage(
109 hWnd,
110 EM_GETPASSWORDCHAR,
111 wParam,
112 lParam);
113 }
114
115
116
117
118
119
120 public final int getSel(final long hwndCtl) {
121 HWND hWnd = longToHwnd(hwndCtl);
122 WPARAM wParam = new WPARAM(0);
123 LPARAM lParam = new LPARAM(0);
124 return getUser32().SendMessage(hWnd, EM_GETSEL, wParam, lParam);
125 }
126
127 public final String getText(final long hwndCtl){
128 Window win = new Window();
129 return win.getText(hwndCtl);
130 }
131
132
133
134
135
136
137
138 public final int lineFromChar(final long hwndCtl, final int ich) {
139 HWND hWnd = longToHwnd(hwndCtl);
140 WPARAM wParam = new WPARAM(ich);
141 LPARAM lParam = new LPARAM(0);
142 return getUser32().SendMessage(hWnd, EM_LINEFROMCHAR, wParam, lParam);
143 }
144
145
146
147
148
149
150
151 public final int lineIndex(final long hwndCtl, final int line) {
152 HWND hWnd = longToHwnd(hwndCtl);
153 WPARAM wParam = new WPARAM(line);
154 LPARAM lParam = new LPARAM(0);
155 return getUser32().SendMessage(hWnd, EM_LINEINDEX, wParam, lParam);
156 }
157
158
159
160
161
162
163
164 public final int lineLength(final long hwndCtl, final int line) {
165 HWND hWnd = longToHwnd(hwndCtl);
166 WPARAM wParam = new WPARAM(line);
167 LPARAM lParam = new LPARAM(0);
168 return getUser32().SendMessage(hWnd, EM_LINELENGTH, wParam, lParam);
169 }
170
171
172
173
174
175
176
177 public final int replaceSel(final long hwndCtl, final String lpszReplace) {
178 HWND hWnd = longToHwnd(hwndCtl);
179 WPARAM wParam = new WPARAM(0);
180 Pointer pt = new Pointer(0);
181 pt.setString(0, lpszReplace);
182 LPARAM lParam = new LPARAM(Pointer.nativeValue(pt));
183 return getUser32().SendMessage(hWnd, EM_REPLACESEL, wParam, lParam);
184 }
185
186
187
188
189
190
191
192
193 public final int scroll(final long hwndCtl, final int dv, final int dh) {
194 HWND hWnd = longToHwnd(hwndCtl);
195 WPARAM wParam = new WPARAM(dh);
196 LPARAM lParam = new LPARAM(dv);
197 return getUser32().SendMessage(hWnd, EM_LINESCROLL, wParam, lParam);
198 }
199
200
201
202
203
204
205 public final boolean scrollCaret(final long hwndCtl) {
206 HWND hWnd = longToHwnd(hwndCtl);
207 WPARAM wParam = new WPARAM(0);
208 LPARAM lParam = new LPARAM(0);
209 return (getUser32()
210 .SendMessage(
211 hWnd,
212 EM_SCROLLCARET,
213 wParam,
214 lParam) != 0)
215 ? true
216 : false;
217 }
218
219
220
221
222
223
224
225 public final int setPasswordChar(final long hwndCtl, final int ch) {
226 HWND hWnd = longToHwnd(hwndCtl);
227 WPARAM wParam = new WPARAM(ch);
228 LPARAM lParam = new LPARAM(0);
229 return getUser32().SendMessage(
230 hWnd,
231 EM_SETPASSWORDCHAR,
232 wParam,
233 lParam);
234 }
235
236
237
238
239
240
241
242
243 public final int setSel(
244 final long hwndCtl,
245 final int ichStart,
246 final int ichEnd) {
247 HWND hWnd = longToHwnd(hwndCtl);
248 WPARAM wParam = new WPARAM(ichStart);
249 LPARAM lParam = new LPARAM(ichEnd);
250 return getUser32().SendMessage(hWnd, EM_SETSEL, wParam, lParam);
251 }
252
253
254
255
256
257
258
259 public final boolean setText(final long hwndCtl, final String lpsz) {
260 HWND hWnd = longToHwnd(hwndCtl);
261 return getUser32().SetWindowText(hWnd, lpsz.toCharArray());
262 }
263
264
265
266
267
268
269 public final int undo(final long hwndCtl) {
270 HWND hWnd = longToHwnd(hwndCtl);
271 WPARAM wParam = new WPARAM(0);
272 LPARAM lParam = new LPARAM(0);
273 return getUser32().SendMessage(hWnd, EM_UNDO, wParam, lParam);
274 }
275 }