Ignore:
Timestamp:
Oct 30, 1999, 8:40:49 PM (26 years ago)
Author:
cbratschi
Message:

button, static, scroll and dialog fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/button.cpp

    r1433 r1525  
    1 /* $Id: button.cpp,v 1.15 1999-10-24 22:56:00 sandervl Exp $ */
     1/* $Id: button.cpp,v 1.16 1999-10-30 18:40:43 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    626626}
    627627
     628static INT BUTTON_GetTextFormat(DWORD dwStyle,INT defHorz,INT defVert)
     629{
     630  INT format = 0;
     631
     632  if (dwStyle & BS_LEFT) format = DT_LEFT;
     633  else if (dwStyle & BS_CENTER) format = DT_CENTER;
     634  else if (dwStyle & BS_RIGHT) format = DT_RIGHT;
     635  else format = defHorz;
     636
     637  if (dwStyle & BS_TOP) format |= DT_TOP;
     638  else if (dwStyle & BS_VCENTER) format |= DT_VCENTER;
     639  else if (dwStyle & BS_BOTTOM) format |= DT_BOTTOM;
     640  else format |= defVert;
     641
     642  if (!(dwStyle & BS_MULTILINE)) format |= DT_SINGLELINE;
     643
     644  return format;
     645}
     646
    628647/**********************************************************************
    629648 * This method will actually do the drawing of the pushbutton
     
    692711    if (textLen > 0 && (!(dwStyle & (BS_ICON|BS_BITMAP))))
    693712    {
     713        INT format = BUTTON_GetTextFormat(dwStyle,DT_CENTER,DT_VCENTER);
     714
    694715        textLen++;
    695716        text = (char*)malloc(textLen);
    696717        GetWindowTextA(hwnd,text,textLen);
    697718
    698         if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,DT_SINGLELINE | DT_CENTER | DT_VCENTER); else
     719        if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,format); else
    699720        {
    700             SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
    701             DrawTextA( hDC, text, -1, &rc,
    702                          DT_SINGLELINE | DT_CENTER | DT_VCENTER );
     721            SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT));
     722            DrawTextA(hDC,text,-1,&rc,format);
    703723            /* do we have the focus?
    704724             * Win9x draws focus last with a size prop. to the button
     
    903923        if( text && action != ODA_SELECT )
    904924        {
    905 
    906           if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rtext,DT_SINGLELINE | DT_VCENTER);
    907           else DrawTextA(hDC,text,-1,&rtext,DT_SINGLELINE | DT_VCENTER);
     925          INT format = BUTTON_GetTextFormat(dwStyle,DT_TOP,DT_VCENTER);
     926
     927          if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rtext,format);
     928          else DrawTextA(hDC,text,-1,&rtext,format);
    908929        }
    909930    }
     
    916937        SetRectEmpty(&rbox);
    917938        if(textLen > 0)
    918           DrawTextA( hDC, text, -1, &rbox,
    919                      DT_SINGLELINE | DT_CALCRECT );
     939          DrawTextA(hDC,text,-1,&rbox,DT_SINGLELINE | DT_CALCRECT);
    920940        textLen = rbox.bottom - rbox.top;
    921941        delta = ((rtext.bottom - rtext.top) - textLen)/2;
     
    943963    parent = GetParent(hwnd);
    944964    /* assure that starting control is not disabled or invisible */
    945 //    start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
     965    start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
    946966    //@YD: bugfix
    947     start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE );
     967    //CB: doesn't work!
     968    //start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE );
    948969    do
    949970    {
     
    9871008    if (textLen > 0)
    9881009    {
    989         textLen++;
    990         text = (char*)malloc(textLen);
    991         GetWindowTextA(hwnd,text,textLen);
    992         if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
    993         rc.left += 10;
    994 
    995         if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,DT_SINGLELINE | DT_NOCLIP); else
    996         {
    997             SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
    998             DrawTextA( hDC, text, -1, &rc,
    999                          DT_SINGLELINE | DT_NOCLIP );
    1000         }
    1001 
    1002         free(text);
     1010      INT format = BUTTON_GetTextFormat(dwStyle,DT_LEFT,DT_TOP) | DT_NOCLIP | DT_SINGLELINE;
     1011
     1012      textLen++;
     1013      text = (char*)malloc(textLen);
     1014      GetWindowTextA(hwnd,text,textLen);
     1015      if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
     1016      rc.left += 10;
     1017
     1018      if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,format); else
     1019      {
     1020        SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT));
     1021        DrawTextA(hDC,text,-1,&rc,format);
     1022      }
     1023
     1024      free(text);
    10031025    }
    10041026}
Note: See TracChangeset for help on using the changeset viewer.