Changeset 2185


Ignore:
Timestamp:
Dec 21, 1999, 6:03:46 PM (25 years ago)
Author:
cbratschi
Message:

WINE 991212, WM_SETREDRAW fix, MDI work

Location:
trunk/src/user32
Files:
7 edited

Legend:

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

    r2160 r2185  
    1 /* $Id: button.cpp,v 1.23 1999-12-20 16:45:16 cbratschi Exp $ */
     1/* $Id: button.cpp,v 1.24 1999-12-21 17:03:42 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    77 * Copyright (c) 1999 Christoph Bratschi
    88 *
    9  * WINE version: 991031
     9 * WINE version: 991212
    1010 *
    1111 * Status: complete
     
    156156  infoPtr->state = BUTTON_UNCHECKED;
    157157  infoPtr->hFont = 0;
    158   infoPtr->hImage = NULL;
     158  infoPtr->hImage = 0;
    159159  SetInfoPtr(hwnd,(DWORD)infoPtr);
    160160
     
    349349  if (wParam == VK_SPACE)
    350350  {
     351    BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
     352
    351353    SendMessageA(hwnd,BM_SETSTATE,TRUE,0);
    352     SetFocus(hwnd);
    353     SetCapture(hwnd);
     354    infoPtr->state |= BUTTON_BTNPRESSED;
    354355  }
    355356
     
    364365    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    365366
    366     ReleaseCapture();
     367    if (!(infoPtr->state & BUTTON_BTNPRESSED)) return 0;
     368    infoPtr->state &= BUTTON_NSTATES;
    367369    if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) return 0;
    368370    SendMessageA(hwnd,BM_SETSTATE,FALSE,0);
     
    383385    }
    384386    BUTTON_SendNotify(hwnd,BN_CLICKED);
    385   } else if (wParam != VK_TAB) ReleaseCapture();
     387  }
    386388
    387389  return 0;
     
    490492      return (HICON)infoPtr->hImage;
    491493    default:
    492       return NULL;
     494      return (HICON)0;
    493495  }
    494496}
     
    784786    }
    785787    if ( ((dwStyle & BS_ICON) || (dwStyle & BS_BITMAP) ) &&
    786          (infoPtr->hImage != NULL) )
     788         (infoPtr->hImage != 0) )
    787789    {
    788790        int yOffset, xOffset;
     
    831833        if(xOffset < 0 || yOffset < 0)
    832834        {
    833             HRGN hBitmapRgn = NULL;
     835            HRGN hBitmapRgn = 0;
    834836            hBitmapRgn = CreateRectRgn(
    835837                rc.left + xBorderOffset, rc.top +yBorderOffset,
     
    868870        if(xOffset < 0 || yOffset < 0)
    869871        {
    870             SelectClipRgn(hDC, NULL);
     872            SelectClipRgn(hDC, 0);
    871873        }
    872874    }
     
    916918     * instead of a radion button.
    917919     */
    918     if (infoPtr->hImage!=NULL)
     920    if (infoPtr->hImage != 0)
    919921    {
    920922        BOOL bHighLighted = ((infoPtr->state & BUTTON_HIGHLIGHTED) ||
  • TabularUnified trunk/src/user32/combo.cpp

    r1828 r2185  
    1 /* $Id: combo.cpp,v 1.19 1999-11-24 18:21:35 cbratschi Exp $ */
     1/* $Id: combo.cpp,v 1.20 1999-12-21 17:03:43 cbratschi Exp $ */
    22/*
    33 * Combo controls
     
    88 * FIXME: roll up in Netscape 3.01.
    99 *
    10  * WINE version: 991031
     10 * WINE version: 991212
    1111 *
    1212 * Status:  in progress
     
    115115
    116116   return DefWindowProcA(hwnd,WM_NCDESTROY,wParam,lParam);
    117 }
    118 
    119 /***********************************************************************
    120  *           CBForceDummyResize
    121  *
    122  * The dummy resize is used for listboxes that have a popup to trigger
    123  * a re-arranging of the contents of the combobox and the recalculation
    124  * of the size of the "real" control window.
    125  */
    126 static void CBForceDummyResize(
    127   LPHEADCOMBO lphc)
    128 {
    129   RECT windowRect;
    130 
    131   GetWindowRect(CB_HWND(lphc), &windowRect);
    132 
    133   /*
    134    * We have to be careful, resizing a combobox also has the meaning that the
    135    * dropped rect will be resized. In this case, we want to trigger a resize
    136    * to recalculate layout but we don't want to change the dropped rectangle
    137    * So, we add the size of the dropped rectangle to the size of the control.
    138    * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
    139    * message.
    140    */
    141   SetWindowPos( CB_HWND(lphc),
    142                 (HWND)NULL,
    143                 0, 0,
    144                 windowRect.right  - windowRect.left,
    145                 windowRect.bottom - windowRect.top +
    146                 lphc->droppedRect.bottom - lphc->droppedRect.top,
    147                 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
    148117}
    149118
     
    255224}
    256225
     226/***********************************************************************
     227 *           CBForceDummyResize
     228 *
     229 * The dummy resize is used for listboxes that have a popup to trigger
     230 * a re-arranging of the contents of the combobox and the recalculation
     231 * of the size of the "real" control window.
     232 */
     233static void CBForceDummyResize(
     234  LPHEADCOMBO lphc)
     235{
     236  RECT windowRect;
     237  int newComboHeight;
     238
     239  newComboHeight = CBGetTextAreaHeight(CB_HWND(lphc),lphc) + 2*COMBO_YBORDERSIZE();
     240
     241  GetWindowRect(CB_HWND(lphc), &windowRect);
     242
     243  /*
     244   * We have to be careful, resizing a combobox also has the meaning that the
     245   * dropped rect will be resized. In this case, we want to trigger a resize
     246   * to recalculate layout but we don't want to change the dropped rectangle
     247   * So, we pass the height of text area of control as the height.
     248   * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
     249   * message.
     250   */
     251  SetWindowPos( CB_HWND(lphc),
     252                (HWND)0,
     253                0, 0,
     254                windowRect.right  - windowRect.left,
     255                newComboHeight,
     256                SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
     257}
    257258
    258259/***********************************************************************
     
    958959static INT CBUpdateLBox( LPHEADCOMBO lphc )
    959960{
    960    INT  length, idx, ret;
     961   INT  length, idx;
    961962   LPSTR        pText = NULL;
    962963
    963    idx = ret = LB_ERR;
     964   idx = LB_ERR;
    964965   length = CB_GETEDITTEXTLENGTH( lphc );
    965966
     
    975976       idx = SendMessageA( lphc->hWndLBox, LB_FINDSTRING,
    976977                             (WPARAM)(-1), (LPARAM)pText );
    977        if( idx == LB_ERR ) idx = 0;     /* select first item */
    978        else ret = idx;
    979978       HeapFree( GetProcessHeap(), 0, pText );
    980979   }
    981 
    982    /* select entry */
    983 
    984    SendMessageA( lphc->hWndLBox, LB_SETCURSEL, (WPARAM)idx, 0 );
    985980
    986981   if( idx >= 0 )
     
    990985       SendMessageA( lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)idx, 0 );
    991986   }
    992    return ret;
     987   return idx;
    993988}
    994989
     
    1004999
    10051000   //TRACE("\t %i\n", index );
    1006 
    1007    if( index == -1 )
    1008    {
    1009        length = CB_GETEDITTEXTLENGTH( lphc );
    1010        if( length )
    1011        {
    1012            pText = (LPSTR) HeapAlloc( GetProcessHeap(), 0, length + 1);
    1013            if(pText)
    1014            {
    1015                 GetWindowTextA( lphc->hWndEdit, pText, length + 1 );
    1016                 index = SendMessageA( lphc->hWndLBox, LB_FINDSTRING,
    1017                                         (WPARAM)(-1), (LPARAM)pText );
    1018                 HeapFree( GetProcessHeap(), 0, pText );
    1019            }
    1020        }
    1021    }
    10221001
    10231002   if( index >= 0 ) /* got an entry */
     
    10311010                SendMessageA( lphc->hWndLBox, LB_GETTEXT,
    10321011                                (WPARAM)index, (LPARAM)pText );
    1033 
    1034                 lphc->wState |= CBF_NOEDITNOTIFY;
    1035 
    1036                 SendMessageA( lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)pText );
    1037                 SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) );
    1038                 HeapFree( GetProcessHeap(), 0, pText );
    10391012           }
    10401013       }
    10411014   }
     1015   lphc->wState |= CBF_NOEDITNOTIFY;
     1016
     1017   SendMessageA( lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)"" );
     1018
     1019   if( pText )
     1020       HeapFree( GetProcessHeap(), 0, pText );
    10421021}
    10431022
     
    11451124           RECT rect;
    11461125
    1147            /*
    1148             * It seems useful to send the WM_LBUTTONUP with (-1,-1) when cancelling
    1149             * and with (0,0) (anywhere in the listbox) when Oking.
    1150             */
    1151            SendMessageA( lphc->hWndLBox, WM_LBUTTONUP, 0, ok ? (LPARAM)0 : (LPARAM)(-1) );
    1152 
    11531126           lphc->wState &= ~CBF_DROPPED;
    11541127           ShowWindow( lphc->hWndLBox, SW_HIDE );
     
    11571130               ReleaseCapture();
    11581131           }
    1159 
    11601132
    11611133           if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
     
    12331205      SendMessageA( lphc->hWndLBox, LB_CARETON, 0, 0 );
    12341206
    1235     if( lphc->wState & CBF_EDIT )
    1236       SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) );
    12371207    lphc->wState |= CBF_FOCUSED;
     1208
    12381209    if( !(lphc->wState & CBF_EDIT) )
    1239     {
    12401210      InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
    1241     }
    12421211
    12431212    CB_NOTIFY( lphc, CBN_SETFOCUS );
     
    12641233  if( lphc->wState & CBF_FOCUSED )
    12651234  {
    1266     SendMessageA( lphc->hwndself, WM_LBUTTONUP, 0, (LPARAM)(-1) );
    1267 
    12681235    CBRollUp( lphc, FALSE, TRUE );
    12691236    if( IsWindow( lphc->hwndself ) )
     
    12751242
    12761243      /* redraw text */
    1277       if( lphc->wState & CBF_EDIT )
    1278         SendMessageA( lphc->hWndEdit, EM_SETSEL, (WPARAM)(-1), 0 );
    1279       else
    1280       {
     1244      if( !(lphc->wState & CBF_EDIT) )
    12811245        InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
    1282       }
    12831246
    12841247      CB_NOTIFY( lphc, CBN_KILLFOCUS );
     
    13201283                //             CB_HWND(lphc), lphc->hWndEdit );
    13211284
    1322                 if( !(lphc->wState & CBF_FOCUSED) ) COMBO_EditSetFocus(lphc);
     1285                COMBO_EditSetFocus(lphc);
    13231286                break;
    13241287
     
    13911354                else lphc->wState &= ~CBF_NOROLLUP;
    13921355
     1356                if( lphc->wState & CBF_EDIT )
     1357                {
     1358                    INT index = SendMessageA(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
     1359                    CBUpdateEdit( lphc, index );
     1360                    /* select text in edit, as Windows does */
     1361                    SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) );
     1362                }
     1363                else
     1364                    InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
     1365
    13931366                CB_NOTIFY( lphc, CBN_SELCHANGE );
    1394                 InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
    13951367                /* fall through */
    13961368
     
    20532025  {
    20542026    /* no LBN_SELCHANGE in this case, update manually */
    2055     InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
     2027    if( lphc->wState & CBF_EDIT )
     2028        CBUpdateEdit( lphc, (INT)wParam );
     2029    else
     2030        InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
     2031
    20562032    lphc->wState &= ~CBF_SELCHANGE;
    20572033  }
  • TabularUnified trunk/src/user32/edit.cpp

    r2093 r2185  
    1 /* $Id: edit.cpp,v 1.23 1999-12-16 16:53:56 cbratschi Exp $ */
     1/* $Id: edit.cpp,v 1.24 1999-12-21 17:03:43 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    99 *      Copyright  1999 Christoph Bratschi
    1010 *
    11  * WINE version: 991031
     11 * WINE version: 991212
    1212 *
    1313 * Status:  complete
     
    23952395        EDIT_EM_ScrollCaret(hwnd, es);
    23962396
     2397        EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
    23972398        /* FIXME: really inefficient */
    23982399        EDIT_Refresh(hwnd,es);
     
    36433644  BOOL rev = es->bEnableState && ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL));
    36443645
    3645   if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(hwnd, EN_UPDATE);
    3646 
    36473646  HideCaret(hwnd);
    36483647
     
    38923891        EDIT_EM_ScrollCaret(hwnd, es);
    38933892        EDIT_UpdateScrollBars(hwnd,es,TRUE,TRUE);
     3893        if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
    38943894}
    38953895
  • TabularUnified trunk/src/user32/listbox.cpp

    r2165 r2185  
    1 /* $Id: listbox.cpp,v 1.14 1999-12-20 19:10:54 cbratschi Exp $ */
     1/* $Id: listbox.cpp,v 1.15 1999-12-21 17:03:44 cbratschi Exp $ */
    22/*
    33 * Listbox controls
     
    66 * Copyright 1999 Christoph Bratschi (ported from WINE)
    77 *
    8  * WINE version: 991031
     8 * WINE version: 991212
    99 */
    1010
     
    2323 * - Unicode
    2424 * - Locale handling
    25  * - real WM_SETREDRAW support + for all other controls
    26      bug: LISTBOX_InvalidateItems -> always redraw!
    2725 */
    2826
     
    959957    RECT rect;
    960958
     959    if (descr->style & LBS_NOREDRAW) return;
     960
    961961    if (LISTBOX_GetItemRect( hwnd, descr, index, &rect ) == 1)
    962962    {
     
    12321232        if (index != -1) descr->items[index].selected = TRUE;
    12331233        descr->selected_item = index;
    1234         if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT);
     1234        if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, 0);
    12351235        if (index != -1) LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT );
    12361236        if (send_notify && descr->nb_items) SEND_NOTIFICATION( hwnd, descr,
     
    17501750                LISTBOX_SetCaretIndex( hwnd, descr, index, FALSE );
    17511751                LISTBOX_SetSelection( hwnd, descr, index,
    1752                                       !descr->items[index].selected, FALSE );
     1752                                      !descr->items[index].selected,
     1753                                      (descr->style & LBS_NOTIFY) != 0 );
    17531754            }
    17541755            else LISTBOX_MoveCaret( hwnd, descr, index, FALSE );
     
    17591760            LISTBOX_SetSelection( hwnd, descr, index,
    17601761                                  (!(descr->style & LBS_MULTIPLESEL) ||
    1761                                    !descr->items[index].selected), FALSE );
     1762                                   !descr->items[index].selected),
     1763                                   (descr->style & LBS_NOTIFY) != 0 );
    17621764        }
    17631765    }
  • TabularUnified trunk/src/user32/win32wmdichild.cpp

    r2114 r2185  
    1 /* $Id: win32wmdichild.cpp,v 1.15 1999-12-18 16:31:51 cbratschi Exp $ */
     1/* $Id: win32wmdichild.cpp,v 1.16 1999-12-21 17:03:45 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Child Window Class for OS/2
     
    197197            client->setActiveChild(this);
    198198
    199 #if 0
    200             MDI_AugmentFrameMenu( ci, clientWnd->parent, hwnd);
    201 #endif
     199            client->augmentFrameMenu(this);
     200
    202201            client->updateFrameText(MDI_REPAINTFRAME, NULL );
    203202        }
     
    402401                {
    403402                    client->setMaximizedChild(newchild);
    404 #if 0
    405                     MDI_AugmentFrameMenu( ci, w->parent, newchild->getWindowHandle() );
    406 #endif
     403
     404                    client->augmentFrameMenu(newchild);
     405
    407406                    client->updateFrameText(MDI_REPAINTFRAME, NULL );
    408407                }
  • TabularUnified trunk/src/user32/win32wmdiclient.cpp

    r2114 r2185  
    1 /* $Id: win32wmdiclient.cpp,v 1.16 1999-12-18 16:31:51 cbratschi Exp $ */
     1/* $Id: win32wmdiclient.cpp,v 1.17 1999-12-21 17:03:45 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    573573    {
    574574        ::SetMenu(hwndFrame, hmenuFrame);
    575 #if 0
    576         if( ci->hwndChildMaximized )
    577             MDI_AugmentFrameMenu(ci, w->parent, ci->hwndChildMaximized );
    578 #endif
     575
     576        if (maximizedChild)
     577          augmentFrameMenu(maximizedChild);
     578
    579579        return oldFrameMenu;
    580580    }
     
    824824  return TRUE;
    825825}
    826 #if 0
     826
    827827/* ----------------------- Frame window ---------------------------- */
    828828
     
    830830 *                  MDI_AugmentFrameMenu
    831831 */
    832 BOOL Win32MDIClientWindow::augmentFrameMenu(HWND hChild )
    833 {
     832BOOL Win32MDIClientWindow::augmentFrameMenu(Win32MDIChildWindow *child)
     833{
     834/*
    834835    WND*    child = WIN_FindWndPtr(hChild);
    835836    HMENU   hSysPopup = 0;
     
    843844    WIN_ReleaseWndPtr(child);
    844845
    845     /* create a copy of sysmenu popup and insert it into frame menu bar */
     846    // create a copy of sysmenu popup and insert it into frame menu bar
    846847
    847848    if (!(hSysPopup = LoadMenuA(GetModuleHandleA("USER32"), "SYSMENU")))
    848849    return 0;
    849850
    850     TRACE("\tgot popup %04x in sysmenu %04x\n",
    851         hSysPopup, child->hSysMenu);
     851    //TRACE("\tgot popup %04x in sysmenu %04x\n",
     852    //    hSysPopup, child->hSysMenu);
    852853
    853854    AppendMenuA(frame->wIDmenu,MF_HELP | MF_BITMAP,
     
    856857                   SC_RESTORE, (LPSTR)(DWORD)HBMMENU_MBAR_RESTORE );
    857858
    858   /* In Win 95 look, the system menu is replaced by the child icon */
     859  // In Win 95 look, the system menu is replaced by the child icon
    859860
    860861  if(TWEAK_WineLook > WIN31_LOOK)
     
    900901    }
    901902
    902     /* The close button is only present in Win 95 look */
     903    // The close button is only present in Win 95 look
    903904    if(TWEAK_WineLook > WIN31_LOOK)
    904905    {
     
    912913    SetMenuDefaultItem(hSysPopup, SC_CLOSE, FALSE);
    913914
    914     /* redraw menu */
     915    // redraw menu
    915916    DrawMenuBar(frame->hwndSelf);
    916 
     917*/
    917918    return 1;
    918919}
     
    921922 *                  MDI_RestoreFrameMenu
    922923 */
    923 static BOOL MDI_RestoreFrameMenu( WND *frameWnd, HWND hChild )
    924 {
     924BOOL Win32MDIClientWindow::restoreFrameMenu(Win32MDIChildWindow *child)
     925{
     926/*
    925927    MENUITEMINFOA menuInfo;
    926928    INT nItems = GetMenuItemCount(frameWnd->wIDmenu) - 1;
     
    936938     * as it is in win95, we have to delete the bitmap.
    937939     */
     940/*
    938941    menuInfo.cbSize = sizeof(MENUITEMINFOA);
    939942    menuInfo.fMask  = MIIM_DATA | MIIM_TYPE;
     
    955958    if(TWEAK_WineLook > WIN31_LOOK)
    956959    {
    957         /* close */
     960        // close
    958961        DeleteMenu(frameWnd->wIDmenu,GetMenuItemCount(frameWnd->wIDmenu) - 1,MF_BYPOSITION);
    959962    }
    960     /* restore */
     963    // restore
    961964    DeleteMenu(frameWnd->wIDmenu,GetMenuItemCount(frameWnd->wIDmenu) - 1,MF_BYPOSITION);
    962     /* minimize */
     965    // minimize
    963966    DeleteMenu(frameWnd->wIDmenu,GetMenuItemCount(frameWnd->wIDmenu) - 1,MF_BYPOSITION);
    964967
    965968    DrawMenuBar(frameWnd->hwndSelf);
    966 
     969*/
    967970    return 1;
    968971}
    969 #endif
    970972
    971973/***********************************************************************
  • TabularUnified trunk/src/user32/win32wmdiclient.h

    r2099 r2185  
    1 /* $Id: win32wmdiclient.h,v 1.5 1999-12-17 17:18:04 cbratschi Exp $ */
     1/* $Id: win32wmdiclient.h,v 1.6 1999-12-21 17:03:46 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    7070        BOOL    cascade(UINT fuCascade);
    7171        BOOL    tile(UINT fuTile);
     72        BOOL    augmentFrameMenu(Win32MDIChildWindow *child);
     73        BOOL    restoreFrameMenu(Win32MDIChildWindow *child);
    7274
    7375private:
Note: See TracChangeset for help on using the changeset viewer.