< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 175,186 **** /* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match * actual size * Fix: Set the Choice to its actual size in the component. */ ::GetClientRect(c->GetHWnd(), &rc); ! env->SetIntField(target, AwtComponent::widthID, (jint) rc.right); ! env->SetIntField(target, AwtComponent::heightID, (jint) rc.bottom); if (IS_WINXP) { ::SendMessage(c->GetHWnd(), CB_SETMINVISIBLE, (WPARAM) MINIMUM_NUMBER_OF_VISIBLE_ITEMS, 0); } --- 175,186 ---- /* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match * actual size * Fix: Set the Choice to its actual size in the component. */ ::GetClientRect(c->GetHWnd(), &rc); ! env->SetIntField(target, AwtComponent::widthID, c->ScaleDownX(rc.right)); ! env->SetIntField(target, AwtComponent::heightID, c->ScaleDownY(rc.bottom)); if (IS_WINXP) { ::SendMessage(c->GetHWnd(), CB_SETMINVISIBLE, (WPARAM) MINIMUM_NUMBER_OF_VISIBLE_ITEMS, 0); }
*** 226,252 **** // gets the total height of the combobox, including drop down int AwtChoice::GetTotalHeight() { int dropHeight = GetDropDownHeight(); int fieldHeight = GetFieldHeight(); - int totalHeight; // border on drop-down portion is always non-3d (so don't use SM_CYEDGE) ! int borderHeight = ::GetSystemMetrics(SM_CYBORDER); // total height = drop down height + field height + top+bottom drop down border lines ! totalHeight = dropHeight + fieldHeight +borderHeight*2; ! return totalHeight; } // Recalculate and set the drop-down height for the Choice. void AwtChoice::ResetDropDownHeight() { RECT rcWindow; ::GetWindowRect(GetHWnd(), &rcWindow); // resize the drop down to accommodate added/removed items ! int totalHeight = GetTotalHeight(); ::SetWindowPos(GetHWnd(), NULL, 0, 0, rcWindow.right - rcWindow.left, totalHeight, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); } --- 226,250 ---- // gets the total height of the combobox, including drop down int AwtChoice::GetTotalHeight() { int dropHeight = GetDropDownHeight(); int fieldHeight = GetFieldHeight(); // border on drop-down portion is always non-3d (so don't use SM_CYEDGE) ! int borderHeight = ScaleDownY(::GetSystemMetrics(SM_CYBORDER)); // total height = drop down height + field height + top+bottom drop down border lines ! return dropHeight + fieldHeight + borderHeight * 2; } // Recalculate and set the drop-down height for the Choice. void AwtChoice::ResetDropDownHeight() { RECT rcWindow; ::GetWindowRect(GetHWnd(), &rcWindow); // resize the drop down to accommodate added/removed items ! int totalHeight = ScaleUpY(GetTotalHeight()); ::SetWindowPos(GetHWnd(), NULL, 0, 0, rcWindow.right - rcWindow.left, totalHeight, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); }
*** 303,317 **** */ AwtComponent* awtParent = GetParent(); BOOL bReshape = true; if (awtParent != NULL) { ::GetWindowRect(GetHWnd(), &rc); ! int oldW = rc.right - rc.left; RECT parentRc; ::GetWindowRect(awtParent->GetHWnd(), &parentRc); ! int oldX = rc.left - parentRc.left; ! int oldY = rc.top - parentRc.top; bReshape = (x != oldX || y != oldY || w != oldW); } if (bReshape) { --- 301,315 ---- */ AwtComponent* awtParent = GetParent(); BOOL bReshape = true; if (awtParent != NULL) { ::GetWindowRect(GetHWnd(), &rc); ! int oldW = ScaleDownX(rc.right - rc.left); RECT parentRc; ::GetWindowRect(awtParent->GetHWnd(), &parentRc); ! int oldX = ScaleDownX(rc.left - parentRc.left); ! int oldY = ScaleDownY(rc.top - parentRc.top); bReshape = (x != oldX || y != oldY || w != oldW); } if (bReshape) {
< prev index next >