Ignore:
Timestamp:
Aug 15, 1999, 9:11:02 PM (26 years ago)
Author:
cbratschi
Message:

wine-990731 update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/combo.cpp

    r387 r500  
    1 /* $Id: combo.cpp,v 1.2 1999-07-24 17:10:24 cbratschi Exp $ */
     1/* $Id: combo.cpp,v 1.3 1999-08-15 19:11:00 cbratschi Exp $ */
    22/*
    33 * Combo controls
     
    3939 * Look and feel dependant "constants"
    4040 */
     41#define COMBO_YBORDERGAP         5
    4142#define COMBO_XBORDERSIZE()      ( 2 )
    4243#define COMBO_YBORDERSIZE()      ( 2 )
     
    484485  if( lphc->owner || !(lpcs->style & WS_VISIBLE) )
    485486  {
    486       UINT      lbeStyle;
     487      UINT lbeStyle   = 0;
     488      UINT lbeExStyle = 0;
    487489
    488490      /*
     
    530532        lbeStyle |= LBS_DISABLENOSCROLL;
    531533
    532       if( CB_GETTYPE(lphc) == CBS_SIMPLE )      /* child listbox */
    533         lbeStyle |= WS_CHILD | WS_VISIBLE;
    534       else                                      /* popup listbox */
    535         lbeStyle |= WS_POPUP;
     534      if( CB_GETTYPE(lphc) == CBS_SIMPLE )      /* child listbox */
     535      {
     536        lbeStyle |= WS_CHILD | WS_VISIBLE;
     537
     538        /*
     539         * In win 95 look n feel, the listbox in the simple combobox has
     540         * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
     541         */
     542        lbeStyle   &= ~WS_BORDER;
     543        lbeExStyle |= WS_EX_CLIENTEDGE;
     544      }
     545      else                                      /* popup listbox */
     546        lbeStyle |= WS_POPUP;
    536547
    537548     /* Dropdown ComboLBox is not a child window and we cannot pass
    538549      * ID_CB_LISTBOX directly because it will be treated as a menu handle.
    539550      */
    540       lphc->hWndLBox = CreateWindowExA(0,
     551      lphc->hWndLBox = CreateWindowExA(lbeExStyle,
    541552                                       clbName,
    542553                                       NULL,
     
    10631074{
    10641075   RECT rect;
     1076   int nItems = 0;
     1077   int i;
     1078   int nHeight;
     1079   int nDroppedHeight;
    10651080
    10661081   //TRACE("[%04x]: drop down\n", CB_HWND(lphc));
     
    10911106   /* now set popup position */
    10921107   GetWindowRect( lphc->hwndself, &rect );
    1093 
    10941108
    10951109   /*
     
    10991113     rect.left += COMBO_EDITBUTTONSPACE();
    11001114
     1115   /* if the dropped height is greater than the total height of the dropped
     1116     items list, then force the drop down list height to be the total height
     1117     of the items in the dropped list */
     1118
     1119   nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
     1120   nItems = (int)SendMessageA (lphc->hWndLBox, LB_GETCOUNT, 0, 0);
     1121   nHeight = COMBO_YBORDERGAP;
     1122   for (i = 0; i < nItems; i++)
     1123   {
     1124     nHeight += (int)SendMessageA (lphc->hWndLBox, LB_GETITEMHEIGHT, i, 0);
     1125
     1126     if (nHeight >= nDroppedHeight)
     1127       break;
     1128   }
     1129
     1130   if (nHeight < nDroppedHeight)
     1131      nDroppedHeight = nHeight;
     1132
    11011133   SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom,
    1102                  lphc->droppedRect.right - lphc->droppedRect.left,
    1103                  lphc->droppedRect.bottom - lphc->droppedRect.top,
    1104                  SWP_NOACTIVATE | SWP_NOREDRAW);
     1134                 lphc->droppedRect.right - lphc->droppedRect.left,
     1135                 nDroppedHeight,
     1136                 SWP_NOACTIVATE | SWP_NOREDRAW);
     1137
    11051138
    11061139   if( !(lphc->wState & CBF_NOREDRAW) )
     
    11271160       //TRACE("[%04x]: roll up [%i]\n", CB_HWND(lphc), (INT)ok );
    11281161
    1129        /*
    1130         * It seems useful to send the WM_LBUTTONUP with (-1,-1) when cancelling
    1131         * and with (0,0) (anywhere in the listbox) when Oking.
    1132         */
    1133        SendMessageA( lphc->hWndLBox, WM_LBUTTONUP, 0, ok ? (LPARAM)0 : (LPARAM)(-1) );
    1134 
    11351162       if( lphc->wState & CBF_DROPPED )
    11361163       {
    11371164           RECT rect;
     1165
     1166           /*
     1167            * It seems useful to send the WM_LBUTTONUP with (-1,-1) when cancelling
     1168            * and with (0,0) (anywhere in the listbox) when Oking.
     1169            */
     1170           SendMessageA( lphc->hWndLBox, WM_LBUTTONUP, 0, ok ? (LPARAM)0 : (LPARAM)(-1) );
    11381171
    11391172           lphc->wState &= ~CBF_DROPPED;
Note: See TracChangeset for help on using the changeset viewer.