Changeset 1828 for trunk/src


Ignore:
Timestamp:
Nov 24, 1999, 7:21:37 PM (26 years ago)
Author:
cbratschi
Message:

added button styles and messages, bug fixes

Location:
trunk/src/user32
Files:
4 edited

Legend:

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

    r1794 r1828  
    1 /* $Id: button.cpp,v 1.19 1999-11-21 14:04:10 achimha Exp $ */
     1/* $Id: button.cpp,v 1.20 1999-11-24 18:21:34 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    88 *
    99 * WINE version: 991031
     10 *
     11 * Status: complete
     12 * Version: 5.00
    1013 */
    1114
     
    8588static WORD checkBoxWidth = 0, checkBoxHeight = 0;
    8689
     90static LRESULT BUTTON_SendNotify(HWND hwnd,DWORD code)
     91{
     92  return SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID),code),hwnd);
     93}
    8794
    8895static LRESULT BUTTON_GetDlgCode(HWND hwnd,WPARAM wParam,LPARAM lParam)
     
    117124{
    118125  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     126
     127  if (dwStyle & BS_NOTIFY && !wParam) BUTTON_SendNotify(hwnd,BN_DISABLE);
    119128
    120129  //PAINT_BUTTON(hwnd,dwStyle & 0x0f,ODA_DRAWENTIRE);
     
    175184static LRESULT BUTTON_Paint(HWND hwnd,WPARAM wParam,LPARAM lParam)
    176185{
    177   DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f;
     186  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     187  DWORD style = dwStyle & 0x0f;
     188
     189  if (dwStyle & BS_NOTIFY) BUTTON_SendNotify(hwnd,BN_PAINT);
    178190
    179191  if (btnPaintFunc[style])
     
    185197    (btnPaintFunc[style])(hwnd,hdc,ODA_DRAWENTIRE);
    186198    if(!wParam) EndPaint(hwnd,&ps);
    187   }
     199  } else return DefWindowProcA(hwnd,WM_PAINT,wParam,lParam);
    188200
    189201  return 0;
     
    197209  if(dwStyle & BS_NOTIFY || style == BS_RADIOBUTTON ||
    198210     style == BS_USERBUTTON || style == BS_OWNERDRAW)
    199     SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID),BN_DOUBLECLICKED),hwnd);
     211    BUTTON_SendNotify(hwnd,BN_DOUBLECLICKED);
    200212  else BUTTON_LButtonDown(hwnd,wParam,lParam);
    201213
     
    206218{
    207219  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
     220  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    208221
    209222  SetCapture(hwnd);
     
    212225  infoPtr->state |= BUTTON_BTNPRESSED;
    213226
     227  if (dwStyle & BS_NOTIFY) BUTTON_SendNotify(hwnd,BN_HILITE);
     228
    214229  return 0;
    215230}
     
    218233{
    219234  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
     235  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    220236  RECT rect;
    221237  POINT pt;
     
    236252  if (PtInRect(&rect,pt))
    237253  {
    238     DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    239     DWORD id = GetWindowLongA(hwnd,GWL_ID);
    240 
    241254    switch(dwStyle & 0x0f)
    242255    {
     
    253266        break;
    254267    }
    255     SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(id,BN_CLICKED),hwnd);
    256   }
     268    BUTTON_SendNotify(hwnd,BN_CLICKED);
     269  }
     270
     271  if (dwStyle & BS_NOTIFY) BUTTON_SendNotify(hwnd,BN_UNHILITE);
    257272
    258273  return 0;
     
    262277{
    263278  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
     279  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    264280
    265281  if (infoPtr->state & BUTTON_BTNPRESSED)
     
    270286  }
    271287
     288  if (dwStyle & BS_NOTIFY) BUTTON_SendNotify(hwnd,BN_UNHILITE);
     289
    272290  return 0;
    273291}
     
    345363    BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
    346364    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    347     DWORD id = GetWindowLongA(hwnd,GWL_ID);
    348365
    349366    ReleaseCapture();
     
    365382        break;
    366383    }
    367     SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(id,BN_CLICKED),hwnd);
     384    BUTTON_SendNotify(hwnd,BN_CLICKED);
    368385  } else if (wParam != VK_TAB) ReleaseCapture();
    369386
     
    381398{
    382399  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
    383   DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f;
     400  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     401  DWORD style = dwStyle & 0x0f;
     402
     403  if (dwStyle & BS_NOTIFY) BUTTON_SendNotify(hwnd,BN_SETFOCUS);
    384404
    385405  if ((style == BS_AUTORADIOBUTTON || style == BS_RADIOBUTTON) &&
     
    389409       is unckecked and the focus was not given by a mouse click. */
    390410    if (style == BS_AUTORADIOBUTTON) SendMessageA(hwnd,BM_SETCHECK,TRUE,0);
    391     SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID),BN_CLICKED),hwnd);
     411    BUTTON_SendNotify(hwnd,BN_CLICKED);
    392412  }
    393413
     
    401421{
    402422  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
    403   DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f;
     423  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     424  DWORD style = dwStyle & 0x0f;
     425
     426  if (dwStyle & BS_NOTIFY) BUTTON_SendNotify(hwnd,BN_KILLFOCUS);
    404427
    405428  if (infoPtr->state & BUTTON_HASFOCUS)
     
    407430    infoPtr->state &= ~BUTTON_HASFOCUS;
    408431    PAINT_BUTTON(hwnd,style,ODA_FOCUS);
    409     InvalidateRect(hwnd,NULL,TRUE);
    410432  }
    411433
     
    721743        uState |= DFCS_PUSHED;
    722744    }
     745
     746    if (dwStyle & BS_FLAT) uState |= DFCS_FLAT;
    723747
    724748    DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
     
    844868    SelectObject( hDC, hOldBrush );
    845869
    846     if (infoPtr->state & BUTTON_HASFOCUS)
     870    if (infoPtr->state & BUTTON_HASFOCUS && IsWindowEnabled(hwnd))
    847871    {
    848872        InflateRect( &focus_rect, -1, -1 );
     
    951975        if (dwStyle & WS_DISABLED) state |= DFCS_INACTIVE;
    952976
     977        if (dwStyle & BS_FLAT) state |= DFCS_FLAT;
     978
    953979        DrawFrameControl( hDC, &rbox, DFC_BUTTON, state );
    954980
     
    963989
    964990    if ((action == ODA_FOCUS) ||
    965         ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
     991        ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS) && IsWindowEnabled(hwnd)))
    966992    {
    967993        /* again, this is what CTL3D expects */
     
    10761102    hBrush = GetSysColorBrush(COLOR_BTNFACE);
    10771103
     1104    if ((action == ODA_FOCUS) ||
     1105        ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS) && IsWindowEnabled(hwnd)))
     1106    {
     1107      DrawFocusRect( hDC, &rc );
     1108      InflateRect(&rc,-1,-1);
     1109    }
    10781110    FillRect( hDC, &rc, hBrush );
    1079     if ((action == ODA_FOCUS) ||
    1080         ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
    1081         DrawFocusRect( hDC, &rc );
    10821111}
    10831112
  • trunk/src/user32/combo.cpp

    r1802 r1828  
    1 /* $Id: combo.cpp,v 1.18 1999-11-21 17:34:10 achimha Exp $ */
     1/* $Id: combo.cpp,v 1.19 1999-11-24 18:21:35 cbratschi Exp $ */
    22/*
    33 * Combo controls
     
    99 *
    1010 * WINE version: 991031
     11 *
     12 * Status:  in progress
     13 * Version: ?.??
    1114 */
    1215
  • trunk/src/user32/edit.cpp

    r1794 r1828  
    1 /* $Id: edit.cpp,v 1.16 1999-11-21 14:04:11 achimha Exp $ */
     1/* $Id: edit.cpp,v 1.17 1999-11-24 18:21:36 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    1010 *
    1111 * WINE version: 991031
     12 *
     13 * Status:  in progress
     14 * Version: ?.??
    1215 */
    1316
     
    2225  - still problems with caret
    2326  - WS_BORDER -> bug in Win32BaseWindow::SetWindowLong
     27  - clipping bug(s)
     28  - many messages, styles, notifications
    2429*/
    2530
  • trunk/src/user32/scroll.cpp

    r1781 r1828  
    1 /* $Id: scroll.cpp,v 1.24 1999-11-19 17:59:34 cbratschi Exp $ */
     1/* $Id: scroll.cpp,v 1.25 1999-11-24 18:21:37 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
     
    266266        if (pt.y < rect.top + arrowSize) return (infoPtr->flags & ESB_DISABLE_LTUP) ? SCROLL_NOWHERE:SCROLL_TOP_ARROW;
    267267        if (pt.y >= rect.bottom - arrowSize) return (infoPtr->flags & ESB_DISABLE_RTDN) ? SCROLL_NOWHERE:SCROLL_BOTTOM_ARROW;
    268         if (!thumbPos) return SCROLL_TOP_RECT;
     268        if (!thumbPos) return ((infoPtr->flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH) ? SCROLL_NOWHERE:SCROLL_TOP_RECT;
    269269        pt.y -= rect.top;
    270270        if (pt.y < thumbPos) return SCROLL_TOP_RECT;
     
    275275        if (pt.x < rect.left + arrowSize) return (infoPtr->flags & ESB_DISABLE_LTUP) ? SCROLL_NOWHERE:SCROLL_TOP_ARROW;
    276276        if (pt.x >= rect.right - arrowSize) return (infoPtr->flags & ESB_DISABLE_RTDN) ? SCROLL_NOWHERE:SCROLL_BOTTOM_ARROW;
    277         if (!thumbPos) return SCROLL_TOP_RECT;
     277        if (!thumbPos) return ((infoPtr->flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH) ? SCROLL_NOWHERE:SCROLL_TOP_RECT;
    278278        pt.x -= rect.left;
    279279        if (pt.x < thumbPos) return SCROLL_TOP_RECT;
     
    795795        SCROLL_trackVertical = vertical;
    796796        SCROLL_trackHitTest = hittest = SCROLL_HitTest( hwnd, nBar, pt, FALSE );
    797         if (SCROLL_trackHitTest == SCROLL_NOWHERE) return res;
     797        if (SCROLL_trackHitTest == SCROLL_NOWHERE)
     798        {
     799          MessageBeep(MB_ICONEXCLAMATION);
     800
     801          return res;
     802        }
    798803        SCROLL_Scrolling = TRUE;
    799804        timerRunning = FALSE;
Note: See TracChangeset for help on using the changeset viewer.