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.constants.IComboBoxConsts;
10 import org.sirius.server.win32lib.controls.Win32LibControlsClient;
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 ComboBox extends Common implements IComboBoxConsts {
23
24
25
26
27 Win32LibControlsClient win32lib;
28
29
30
31
32 public ComboBox() {
33 win32lib = new Win32LibControlsClient();
34 }
35
36
37
38
39
40
41
42
43 public final int findItemData(final long hwndCtl, final int indexStart,
44 final LPARAM data) {
45 HWND hWnd = longToHwnd(hwndCtl);
46 WPARAM wParam = new WPARAM(indexStart);
47 return getUser32().SendMessage(hWnd, CB_FINDSTRING, wParam, data);
48 }
49
50
51
52
53
54
55
56
57 public final int findString(final long hwndCtl, final int indexStart,
58 final String lpszFind) {
59 HWND hWnd = longToHwnd(hwndCtl);
60 WPARAM wParam = new WPARAM(indexStart);
61 Pointer pt = new Pointer(0);
62 pt.setString(0, lpszFind);
63 LPARAM lParam = new LPARAM(Pointer.nativeValue(pt));
64 return getUser32().SendMessage(hWnd, CB_FINDSTRING, wParam, lParam);
65 }
66
67
68
69
70
71
72
73
74 public final int findStringExact(final long hwndCtl, final int indexStart,
75 final String lpszFind) {
76 HWND hWnd = longToHwnd(hwndCtl);
77 WPARAM wParam = new WPARAM(indexStart);
78 Pointer pt = new Pointer(0);
79 pt.setString(0, lpszFind);
80 LPARAM lParam = new LPARAM(Pointer.nativeValue(pt));
81 return getUser32().SendMessage(
82 hWnd,
83 CB_FINDSTRINGEXACT,
84 wParam,
85 lParam);
86 }
87
88
89
90
91
92
93 public final int getCount(final long hwndCtl) {
94 HWND hWnd = longToHwnd(hwndCtl);
95 WPARAM wParam = new WPARAM(0);
96 LPARAM lParam = new LPARAM(0);
97 return getUser32().SendMessage(hWnd, CB_GETCOUNT, wParam, lParam);
98 }
99
100
101
102
103
104
105 public final int getCurSel(final long hwndCtl) {
106 HWND hWnd = longToHwnd(hwndCtl);
107 WPARAM wParam = new WPARAM(0);
108 LPARAM lParam = new LPARAM(0);
109 return getUser32().SendMessage(hWnd, CB_GETCURSEL, wParam, lParam);
110 }
111
112
113
114
115
116
117 public final int getDroppedState(final long hwndCtl) {
118 HWND hWnd = longToHwnd(hwndCtl);
119 WPARAM wParam = new WPARAM(0);
120 LPARAM lParam = new LPARAM(0);
121 return getUser32().SendMessage(
122 hWnd,
123 CB_GETDROPPEDSTATE,
124 wParam,
125 lParam);
126 }
127
128
129
130
131
132
133 public final int getEditSel(final long hwndCtl) {
134 HWND hWnd = longToHwnd(hwndCtl);
135 WPARAM wParam = new WPARAM(0);
136 LPARAM lParam = new LPARAM(0);
137 return getUser32().SendMessage(hWnd, CB_GETEDITSEL, wParam, lParam);
138 }
139
140
141
142
143
144
145 public final int getExtendedUI(final long hwndCtl) {
146 HWND hWnd = longToHwnd(hwndCtl);
147 WPARAM wParam = new WPARAM(0);
148 LPARAM lParam = new LPARAM(0);
149 return getUser32().SendMessage(hWnd, CB_GETEXTENDEDUI, wParam, lParam);
150 }
151
152
153
154
155
156
157
158 public final int getItemData(final long hwndCtl, final int index) {
159 HWND hWnd = longToHwnd(hwndCtl);
160 WPARAM wParam = new WPARAM(index);
161 LPARAM lParam = new LPARAM(0);
162 getUser32().SendMessage(hWnd, CB_GETITEMDATA, wParam, lParam);
163 return 0;
164 }
165
166
167
168
169
170
171 public final int getItemHeight(final long hwndCtl) {
172 HWND hWnd = longToHwnd(hwndCtl);
173 WPARAM wParam = new WPARAM(0);
174 LPARAM lParam = new LPARAM(0);
175 return getUser32().SendMessage(hWnd, CB_GETITEMHEIGHT, wParam, lParam);
176 }
177
178
179
180
181
182
183
184
185 public final int getLBText(final long hwndCtl, final int index,
186 final String lpszBuffer) {
187 HWND hWnd = longToHwnd(hwndCtl);
188 WPARAM wParam = new WPARAM(index);
189 Pointer pt = new Pointer(0);
190 pt.setString(0, lpszBuffer);
191 LPARAM lParam = new LPARAM(Pointer.nativeValue(pt));
192 return getUser32().SendMessage(hWnd, CB_GETLBTEXT, wParam, lParam);
193 }
194
195
196
197
198
199
200
201 public final int getLBTextLen(final long hwndCtl, final int index) {
202 HWND hWnd = longToHwnd(hwndCtl);
203 WPARAM wParam = new WPARAM(index);
204 LPARAM lParam = new LPARAM(0);
205 return getUser32().SendMessage(hWnd, CB_GETLBTEXTLEN, wParam, lParam);
206 }
207
208
209
210
211
212
213 public final String getText(final long hwndCtl) {
214 HWND hWnd = longToHwnd(hwndCtl);
215 int length = getTextLength(hwndCtl);
216 char[] buf = new char[length];
217 getUser32().GetWindowText(hWnd, buf, length);
218 return String.valueOf(buf);
219 }
220
221
222
223
224
225
226 public final int getTextLength(final long hwndCtl) {
227 HWND hWnd = longToHwnd(hwndCtl);
228 return getUser32().GetWindowTextLength(hWnd);
229 }
230
231
232
233
234
235
236 public final int resetContent(final long hwndCtl) {
237 HWND hWnd = longToHwnd(hwndCtl);
238 WPARAM wParam = new WPARAM(0);
239 LPARAM lParam = new LPARAM(0);
240 return getUser32().SendMessage(hWnd, CB_RESETCONTENT, wParam, lParam);
241 }
242
243
244
245
246
247
248
249
250 public final int selectString(final long hwndCtl, final int indexStart,
251 final String lpszSelect) {
252 HWND hWnd = longToHwnd(hwndCtl);
253 WPARAM wParam = new WPARAM(indexStart);
254 Pointer pt = new Pointer(0);
255 pt.setString(0, lpszSelect);
256 LPARAM lParam = new LPARAM(Pointer.nativeValue(pt));
257
258 return getUser32().SendMessage(hWnd, CB_SELECTSTRING, wParam, lParam);
259 }
260
261
262
263
264
265
266
267 public final int setCurSel(final long hwndCtl, final int index) {
268 HWND hWnd = longToHwnd(hwndCtl);
269 WPARAM wParam = new WPARAM(index);
270 LPARAM lParam = new LPARAM(0);
271 return getUser32().SendMessage(hWnd, CB_SETCURSEL, wParam, lParam);
272 }
273
274
275
276
277
278
279
280
281 public final int setEditSel(final long hwndCtl, final int ichStart,
282 final int ichEnd) {
283 HWND hWnd = longToHwnd(hwndCtl);
284 return getUser32().SendMessage(hWnd, CB_SETEDITSEL, new WPARAM(0L),
285 makeLParam(ichStart, ichEnd));
286 }
287
288
289
290
291
292
293
294
295 public final int setItemHeight(final long hwndCtl, final int index,
296 final int cyItem) {
297 HWND hWnd = longToHwnd(hwndCtl);
298 WPARAM wParam = new WPARAM(index);
299 LPARAM lParam = new LPARAM(cyItem);
300 return getUser32().SendMessage(hWnd, CB_SETITEMHEIGHT, wParam, lParam);
301 }
302
303
304
305
306
307
308 public final void setText(final long hwndCtl, final String lpsz) {
309 HWND hWnd = longToHwnd(hwndCtl);
310 getUser32().SetWindowText(hWnd, lpsz.toCharArray());
311 }
312
313
314
315
316
317
318
319 public final int showDropdown(final long hwndCtl, final boolean fShow) {
320 HWND hWnd = longToHwnd(hwndCtl);
321 WPARAM wParam = new WPARAM(fShow ? 1 : 0);
322 LPARAM lParam = new LPARAM(0);
323 return getUser32().SendMessage(hWnd, CB_SHOWDROPDOWN, wParam, lParam);
324 }
325 }