Changeset 5157


Ignore:
Timestamp:
Feb 17, 2001, 9:16:31 PM (24 years ago)
Author:
sandervl
Message:

CBCalcPlacement fix

File:
1 edited

Legend:

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

    r4515 r5157  
    1 /* $Id: combo.cpp,v 1.32 2000-10-22 16:07:45 sandervl Exp $ */
     1/* $Id: combo.cpp,v 1.33 2001-02-17 20:16:31 sandervl Exp $ */
    22/*
    33 * Combo controls
     
    267267  LPRECT      lprLB)
    268268{
     269#if 1
     270  /*
     271   * Again, start with the client rectangle.
     272   */
     273  GetClientRect(hwnd, lprEdit);
     274
     275  /*
     276   * Remove the borders
     277   */
     278  InflateRect(lprEdit, -COMBO_XBORDERSIZE(), -COMBO_YBORDERSIZE());
     279
     280  /*
     281   * Chop off the bottom part to fit with the height of the text area.
     282   */
     283  lprEdit->bottom = lprEdit->top + CBGetTextAreaHeight(hwnd, lphc);
     284
     285  /*
     286   * The button starts the same vertical position as the text area.
     287   */
     288  CopyRect(lprButton, lprEdit);
     289
     290  /*
     291   * If the combobox is "simple" there is no button.
     292   */
     293  if( CB_GETTYPE(lphc) == CBS_SIMPLE )
     294    lprButton->left = lprButton->right = lprButton->bottom = 0;
     295  else
     296  {
     297    /*
     298     * Let's assume the combobox button is the same width as the
     299     * scrollbar button.
     300     * size the button horizontally and cut-off the text area.
     301     */
     302    lprButton->left = lprButton->right - GetSystemMetrics(SM_CXVSCROLL);
     303    lprEdit->right  = lprButton->left;
     304  }
     305 
     306  /*
     307   * In the case of a dropdown, there is an additional spacing between the
     308   * text area and the button.
     309   */
     310  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
     311  {
     312    lprEdit->right -= COMBO_EDITBUTTONSPACE();
     313  }
     314
     315  /*
     316   * If we have an edit control, we space it away from the borders slightly.
     317   */
     318  if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
     319  {
     320    InflateRect(lprEdit, -EDIT_CONTROL_PADDING(), -EDIT_CONTROL_PADDING());
     321  }
     322 
     323  /*
     324   * Adjust the size of the listbox popup.
     325   */
     326  if( CB_GETTYPE(lphc) == CBS_SIMPLE )
     327  {
     328    /*
     329     * Use the client rectangle to initialize the listbox rectangle
     330     */
     331    GetClientRect(hwnd, lprLB);
     332
     333    /*
     334     * Then, chop-off the top part.
     335     */
     336    lprLB->top = lprEdit->bottom + COMBO_YBORDERSIZE();
     337  }
     338  else
     339  {
     340    /*
     341     * Make sure the dropped width is as large as the combobox itself.
     342     */
     343    if (lphc->droppedWidth < (lprButton->right + COMBO_XBORDERSIZE()))
     344    {
     345      lprLB->right  = lprLB->left + (lprButton->right + COMBO_XBORDERSIZE());
     346
     347      /*
     348       * In the case of a dropdown, the popup listbox is offset to the right.
     349       * so, we want to make sure it's flush with the right side of the
     350       * combobox
     351       */
     352      if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
     353        lprLB->right -= COMBO_EDITBUTTONSPACE();
     354    }
     355    else
     356       lprLB->right = lprLB->left + lphc->droppedWidth;
     357  }
     358#else
    269359  /*
    270360   * Again, start with the client rectangle.
     
    359449       lprLB->right = lprLB->left + lphc->droppedWidth;
    360450  }
    361 
     451#endif
    362452  //TRACE("\ttext\t= (%i,%i-%i,%i)\n",
    363453  //      lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
Note: See TracChangeset for help on using the changeset viewer.