1 /*
2 * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
271
272 /* Save old list box's attributes */
273 RECT rect;
274 GetWindowRect(GetListHandle(), &rect);
275 MapWindowPoints(0, parentHWnd, (LPPOINT)&rect, 2);
276
277 HANDLE font = (HANDLE)SendListMessage(WM_GETFONT);
278 LRESULT itemHeight = SendListMessage(LB_GETITEMHEIGHT, 0);
279 DWORD style = ::GetWindowLong(GetListHandle(), GWL_STYLE) | WS_VSCROLL | WS_HSCROLL;
280 if (isMultiSelect) {
281 style |= LBS_MULTIPLESEL;
282 } else {
283 style &= ~LBS_MULTIPLESEL;
284 }
285 DWORD exStyle = ::GetWindowLong(GetListHandle(), GWL_EXSTYLE);
286
287 jobject peer = GetPeer(env);
288
289 UnsubclassHWND();
290 AwtToolkit::DestroyComponentHWND(m_hwnd);
291 CreateHWnd(env, L"", style, exStyle,
292 rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
293 parentHWnd,
294 NULL,
295 ::GetSysColor(COLOR_WINDOWTEXT),
296 ::GetSysColor(COLOR_WINDOW),
297 peer);
298
299 SendListMessage(WM_SETFONT, (WPARAM)font, (LPARAM)FALSE);
300 SendListMessage(LB_SETITEMHEIGHT, 0, MAKELPARAM(itemHeight, 0));
301 SendListMessage(LB_RESETCONTENT);
302 for (i = 0; i < nCount; i++) {
303 InsertString(i, strings[i]);
304 delete [] strings[i];
305 }
306 delete[] strings;
307 if (toSelect != -1) {
308 Select(toSelect);
309 }
310
311 AdjustHorizontalScrollbar();
312 }
313
314 /*
315 * There currently is no good place to cache java.awt.Dimension field
316 * ids. If this method gets called a lot, one such place should be found.
317 * -- br 07/18/97.
|
1 /*
2 * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
271
272 /* Save old list box's attributes */
273 RECT rect;
274 GetWindowRect(GetListHandle(), &rect);
275 MapWindowPoints(0, parentHWnd, (LPPOINT)&rect, 2);
276
277 HANDLE font = (HANDLE)SendListMessage(WM_GETFONT);
278 LRESULT itemHeight = SendListMessage(LB_GETITEMHEIGHT, 0);
279 DWORD style = ::GetWindowLong(GetListHandle(), GWL_STYLE) | WS_VSCROLL | WS_HSCROLL;
280 if (isMultiSelect) {
281 style |= LBS_MULTIPLESEL;
282 } else {
283 style &= ~LBS_MULTIPLESEL;
284 }
285 DWORD exStyle = ::GetWindowLong(GetListHandle(), GWL_EXSTYLE);
286
287 jobject peer = GetPeer(env);
288
289 UnsubclassHWND();
290 AwtToolkit::DestroyComponentHWND(m_hwnd);
291 CreateHWnd(env, L"", style, exStyle, 0, 0, 0, 0,
292 parentHWnd,
293 NULL,
294 ::GetSysColor(COLOR_WINDOWTEXT),
295 ::GetSysColor(COLOR_WINDOW),
296 peer);
297
298 SetWindowPos(GetHWnd(), 0,
299 rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
300 SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOACTIVATE);
301
302 SendListMessage(WM_SETFONT, (WPARAM)font, (LPARAM)FALSE);
303 SendListMessage(LB_SETITEMHEIGHT, 0, MAKELPARAM(itemHeight, 0));
304 SendListMessage(LB_RESETCONTENT);
305 for (i = 0; i < nCount; i++) {
306 InsertString(i, strings[i]);
307 delete [] strings[i];
308 }
309 delete[] strings;
310 if (toSelect != -1) {
311 Select(toSelect);
312 }
313
314 AdjustHorizontalScrollbar();
315 }
316
317 /*
318 * There currently is no good place to cache java.awt.Dimension field
319 * ids. If this method gets called a lot, one such place should be found.
320 * -- br 07/18/97.
|