Changeset 2611 for trunk/src


Ignore:
Timestamp:
Feb 3, 2000, 6:13:03 PM (26 years ago)
Author:
cbratschi
Message:

merged controls with wine 20000130

Location:
trunk/src/user32
Files:
7 edited

Legend:

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

    r2469 r2611  
    1 /* $Id: button.cpp,v 1.30 2000-01-18 20:10:31 sandervl Exp $ */
     1/* $Id: button.cpp,v 1.31 2000-02-03 17:13:00 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    77 * Copyright (c) 1999 Christoph Bratschi
    88 *
    9  * WINE version: 991212
     9 * WINE version: 20000130
    1010 *
    1111 * Status: complete
  • trunk/src/user32/menu.cpp

    r2582 r2611  
    1 /* $Id: menu.cpp,v 1.14 2000-01-31 22:30:52 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.15 2000-02-03 17:13:00 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    99 * Copyright 1999 Christoph Bratschi
    1010 *
    11  * WINE version: 991212
     11 * WINE version: 20000130
    1212 *
    1313 * Status:  ???
     
    301301
    302302/***********************************************************************
     303 *           MENU_GetMenu
     304 *
     305 * Validate the given menu handle and returns the menu structure pointer.
     306 */
     307POPUPMENU *MENU_GetMenu(HMENU hMenu)
     308{
     309    POPUPMENU *menu;
     310    menu = (POPUPMENU*)hMenu;
     311    if (!IS_A_MENU(menu))
     312    {
     313        //ERR("invalid menu handle=%x, ptr=%p, magic=%x\n", hMenu, menu, menu? menu->wMagic:0);
     314        menu = NULL;
     315    }
     316    return menu;
     317}
     318
     319/***********************************************************************
    303320 *           MENU_CopySysPopup
    304321 *
     
    578595    UINT i;
    579596
    580     if (((*hmenu)==0xffff) || (!(menu = (POPUPMENU*)*hmenu))) return NULL;
     597    if (((*hmenu)==0xffff) || (!(menu = MENU_GetMenu(*hmenu)))) return NULL;
    581598    if (wFlags & MF_BYPOSITION)
    582599    {
     
    623640    MENUITEM *item;
    624641    if (((*hmenu)==0xffff) ||
    625             (!(menu = (POPUPMENU*)*hmenu)))
     642            (!(menu = MENU_GetMenu(*hmenu))))
    626643        return NO_SELECTED_ITEM;
    627644    item = menu->items;
     
    701718    if (hmenu)
    702719    {
    703         POPUPMENU *menu = (POPUPMENU*)hmenu;
     720        POPUPMENU *menu = MENU_GetMenu(hmenu);
    704721        MENUITEM *item = menu->items;
    705722        LONG menuchar;
     
    13201337            /* draw menu items */
    13211338
    1322             menu = (POPUPMENU*)hmenu;
     1339            menu = MENU_GetMenu(hmenu);
    13231340            if (menu && menu->nItems)
    13241341            {
     
    13511368    HFONT hfontOld = 0;
    13521369
    1353     lppop = (LPPOPUPMENU)getMenu(hwnd);
     1370    lppop = MENU_GetMenu(getMenu(hwnd));
    13541371    if (lppop == NULL || lprect == NULL)
    13551372    {
     
    14931510    //hwndOwner, hmenu, id, x, y, xanchor, yanchor);
    14941511
    1495     if (!(menu = (POPUPMENU*)hmenu)) return FALSE;
     1512    if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
    14961513    if (menu->FocusedItem != NO_SELECTED_ITEM)
    14971514    {
     
    16011618    //TRACE("owner=0x%04x menu=0x%04x index=0x%04x select=0x%04x\n", hwndOwner, hmenu, wIndex, sendMenuSelect);
    16021619
    1603     lppop = (POPUPMENU*)hmenu;
    1604     if (!lppop->nItems) return;
     1620    lppop = MENU_GetMenu(hmenu);
     1621    if ((!lppop) || (!lppop->nItems)) return;
    16051622
    16061623    if (lppop->FocusedItem == wIndex) return;
     
    16681685    //TRACE("hwnd=0x%04x hmenu=0x%04x off=0x%04x\n", hwndOwner, hmenu, offset);
    16691686
    1670     menu = (POPUPMENU*)hmenu;
    1671     if (!menu->items) return;
     1687    menu = MENU_GetMenu(hmenu);
     1688    if ((!menu) || (!menu->items)) return;
    16721689
    16731690    if ( menu->FocusedItem != NO_SELECTED_ITEM )
     
    17411758    if (flags & MF_POPUP)
    17421759    {
    1743         POPUPMENU *menu = (POPUPMENU*)(UINT)id;
    1744         if (IS_A_MENU(menu)) menu->wFlags |= MF_POPUP;
     1760        POPUPMENU *menu = MENU_GetMenu((UINT)id);
     1761        if (menu) menu->wFlags |= MF_POPUP;
    17451762        else
    17461763        {
     
    17851802    POPUPMENU *menu;
    17861803
    1787     if (!(menu = (POPUPMENU*)hMenu))
    1788     {
    1789         //WARN("%04x not a menu handle\n",
    1790         //              hMenu );
     1804    if (!(menu = MENU_GetMenu(hMenu)))
    17911805        return NULL;
    1792     }
    17931806
    17941807    /* Find where to insert new item */
     
    17991812        /* Some programs specify the menu length to do that */
    18001813        pos = menu->nItems;
    1801     }
    1802     else
     1814    } else
    18031815    {
    18041816        if (!MENU_FindItem( &hMenu, &pos, flags ))
    18051817        {
    1806             //WARN("item %x not found\n",
    1807             //              pos );
     1818            //FIXME("item %x not found\n", pos );
    18081819            return NULL;
    18091820        }
    1810         if (!(menu = (LPPOPUPMENU)hMenu))
    1811         {
    1812             //WARN("%04x not a menu handle\n",
    1813             //             hMenu);
     1821        if (!(menu = MENU_GetMenu(hMenu)))
    18141822            return NULL;
    1815         }
    18161823    }
    18171824
     
    19521959    MENUITEM *item;
    19531960
    1954     menu = (POPUPMENU*)hmenu;
    1955 
    1956     if (menu->FocusedItem == NO_SELECTED_ITEM) return 0;
     1961    menu = MENU_GetMenu(hmenu);
     1962
     1963    if ((!menu) || (menu->FocusedItem == NO_SELECTED_ITEM)) return 0;
    19571964
    19581965    item = &menu->items[menu->FocusedItem];
     
    19711978                                BOOL sendMenuSelect )
    19721979{
    1973     POPUPMENU *menu = (POPUPMENU*)hmenu;
     1980    POPUPMENU *menu = MENU_GetMenu(hmenu);
    19741981
    19751982    //TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, sendMenuSelect);
     
    19901997        } else return;
    19911998
    1992         submenu = (POPUPMENU*)hsubmenu;
     1999        submenu = MENU_GetMenu(hsubmenu);
    19932000        MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE );
    19942001        MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, sendMenuSelect, 0 );
     
    20252032    //TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, selectFirst);
    20262033
    2027     if (!(menu = (POPUPMENU*)hmenu)) return hmenu;
     2034    if (!(menu = MENU_GetMenu(hmenu))) return hmenu;
    20282035
    20292036    if (menu->FocusedItem == NO_SELECTED_ITEM)
     
    21242131static HMENU MENU_PtMenu(HMENU hMenu,POINT pt,BOOL inMenuBar)
    21252132{
    2126    POPUPMENU *menu = (POPUPMENU*)hMenu;
     2133   POPUPMENU *menu = MENU_GetMenu(hMenu);
    21272134   register UINT ht = menu->FocusedItem;
    21282135
     
    21652172{
    21662173    MENUITEM *item;
    2167     POPUPMENU *menu = (POPUPMENU*)hMenu;
     2174    POPUPMENU *menu = MENU_GetMenu(hMenu);
    21682175
    21692176    //TRACE("%p hmenu=0x%04x\n", pmt, hMenu);
     
    22072214static void MENU_SwitchTracking( MTRACKER* pmt, HMENU hPtMenu, UINT id )
    22082215{
    2209     POPUPMENU *ptmenu = (POPUPMENU*)hPtMenu;
    2210     POPUPMENU *topmenu = (POPUPMENU*)pmt->hTopMenu;
     2216    POPUPMENU *ptmenu = MENU_GetMenu(hPtMenu);
     2217    POPUPMENU *topmenu = MENU_GetMenu(pmt->hTopMenu);
    22112218
    22122219    //TRACE("%p hmenu=0x%04x 0x%04x\n", pmt, hPtMenu, id);
     
    22372244    {
    22382245        UINT id = 0;
    2239         POPUPMENU *ptmenu = (POPUPMENU*)hPtMenu;
     2246        POPUPMENU *ptmenu = MENU_GetMenu(hPtMenu);
    22402247        MENUITEM *item;
    22412248
     
    22782285    {
    22792286        UINT id = 0;
    2280         POPUPMENU *ptmenu = (POPUPMENU*)hPtMenu;
     2287        POPUPMENU *ptmenu = MENU_GetMenu(hPtMenu);
    22812288        MENUITEM *item;
    22822289
     
    23152322    if( hPtMenu )
    23162323    {
    2317         ptmenu = (POPUPMENU*)hPtMenu;
     2324        ptmenu = MENU_GetMenu(hPtMenu);
    23182325        if( IS_SYSTEM_MENU(ptmenu) )
    23192326            id = 0;
     
    23442351static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
    23452352{
    2346     POPUPMENU *menu = (POPUPMENU*)pmt->hTopMenu;
     2353    POPUPMENU *menu = MENU_GetMenu(pmt->hTopMenu);
    23472354
    23482355    if( (vk == VK_LEFT &&  menu->FocusedItem == 0 ) ||
     
    23732380                if( vk == VK_LEFT )
    23742381                {
    2375                     menu = (POPUPMENU*)hNewMenu;
     2382                    menu = MENU_GetMenu(hNewMenu);
    23762383                    id = menu->nItems - 1;
    23772384                }
     
    24852492
    24862493    hmenuprev = hmenutmp = pmt->hTopMenu;
    2487     menu = (POPUPMENU*)hmenutmp;
     2494    menu = MENU_GetMenu(hmenutmp);
    24882495
    24892496    /* Try to move 1 column left (if possible) */
     
    25342541{
    25352542    HMENU hmenutmp;
    2536     POPUPMENU *menu = (POPUPMENU*)pmt->hTopMenu;
     2543    POPUPMENU *menu = MENU_GetMenu(pmt->hTopMenu);
    25372544    UINT  nextcol;
    25382545
     
    26192626
    26202627    fEndMenu = FALSE;
    2621     if (!(menu = (POPUPMENU*)hmenu)) return FALSE;
    2622 
    2623     if (wFlags & TPM_BUTTONDOWN) MENU_ButtonDown( &mt, hmenu, wFlags );
     2628    if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
     2629
     2630    if (wFlags & TPM_BUTTONDOWN)
     2631    {
     2632        /* Get the result in order to start the tracking or not */
     2633        fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
     2634        fEndMenu = !fRemove;
     2635    }
    26242636
    26252637    //EVENT_Capture( mt.hOwnerWnd, HTMENU ); //CB: todo
     
    26292641    while (!fEndMenu)
    26302642    {
    2631         menu = (POPUPMENU*)mt.hCurrentMenu;
     2643        menu = MENU_GetMenu(mt.hCurrentMenu);
    26322644        msg.hwnd = (wFlags & TPM_ENTERIDLEEX && menu->wFlags & MF_POPUP) ? menu->hWnd : 0;
    26332645
     
    27202732                case VK_DOWN: /* If on menu bar, pull-down the menu */
    27212733
    2722                     menu = (POPUPMENU*)mt.hCurrentMenu;
     2734                    menu = MENU_GetMenu(mt.hCurrentMenu);
    27232735                    if (!(menu->wFlags & MF_POPUP))
    27242736                        mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, mt.hTopMenu, TRUE, wFlags,&mt.pt);
     
    28012813    ReleaseCapture();
    28022814
    2803     menu = (POPUPMENU*)mt.hTopMenu;
     2815    menu = MENU_GetMenu(mt.hTopMenu);
    28042816
    28052817    if( IsWindow( mt.hOwnerWnd ) )
     
    30893101    //             hwnd, menubarWidth, orgX, orgY );
    30903102
    3091     if (!(lppop = (LPPOPUPMENU)getMenu(hwnd)))
     3103    if (!(lppop = MENU_GetMenu(getMenu(hwnd))))
    30923104    {
    30933105        return 0;
     
    31843196
    31853197    /* Get the Popupmenu to access the owner menu */
    3186     if (!(menu = (POPUPMENU*)hMenu))
     3198    if (!(menu = MENU_GetMenu(hMenu)))
    31873199        return (UINT)-1;
    31883200
     
    32013213
    32023214            /* Get the parent menu to access*/
    3203             if (!(parentMenu = (POPUPMENU*)menu->hSysMenuOwner))
     3215            if (!(parentMenu = MENU_GetMenu(menu->hSysMenuOwner)))
    32043216                return (UINT)-1;
    32053217
     
    32173229 *         GetMenuString32A    (USER32.268)
    32183230 */
    3219 INT WINAPI GetMenuStringA(HMENU hMenu, UINT wItemID,
    3220                           LPSTR str, INT nMaxSiz, UINT wFlags )
    3221 {
     3231INT WINAPI GetMenuStringA(
     3232        HMENU hMenu,    /* [in] menuhandle */
     3233        UINT wItemID,   /* [in] menu item (dep. on wFlags) */
     3234        LPSTR str,      /* [out] outbuffer. If NULL, func returns entry length*/
     3235        INT nMaxSiz,    /* [in] length of buffer. if 0, func returns entry len*/
     3236        UINT wFlags     /* [in] MF_ flags */
     3237) {
    32223238    MENUITEM *item;
    32233239
     
    32703286    //             hWnd, hMenu, wItemID, wHilite);
    32713287    if (!MENU_FindItem( &hMenu, &wItemID, wHilite )) return FALSE;
    3272     if (!(menu = (LPPOPUPMENU)hMenu)) return FALSE;
     3288    if (!(menu = MENU_GetMenu(hMenu))) return FALSE;
    32733289    if (menu->FocusedItem == wItemID) return TRUE;
    32743290    MENU_HideSubPopups( hWnd, hMenu, FALSE );
     
    32953311    if (item->fType & MF_POPUP)
    32963312    {
    3297         POPUPMENU *menu = (POPUPMENU*)item->hSubMenu;
     3313        POPUPMENU *menu = MENU_GetMenu(item->hSubMenu);
    32983314        if (!menu) return -1;
    32993315        else return (menu->nItems << 8) | ((item->fState|item->fType) & 0xff);
     
    33143330INT WINAPI GetMenuItemCount( HMENU hMenu )
    33153331{
    3316     LPPOPUPMENU menu = (LPPOPUPMENU)hMenu;
     3332    LPPOPUPMENU menu = MENU_GetMenu(hMenu);
    33173333
    33183334    dprintf(("USER32: GetMenuItemCount"));
    33193335
    3320     if (!IS_A_MENU(menu)) return -1;
     3336    if (!menu) return -1;
    33213337    //TRACE("(%04x) returning %d\n",
    33223338    //              hMenu, menu->nItems );
     
    33663382
    33673383    if (flags & MF_POPUP)  /* Set the MF_POPUP flag on the popup-menu */
    3368         ((POPUPMENU *)(HMENU)id)->wFlags |= MF_POPUP;
     3384        (MENU_GetMenu((HMENU)id))->wFlags |= MF_POPUP;
    33693385
    33703386    item->hCheckBit = item->hUnCheckBit = 0;
     
    34283444    //TRACE("(menu=%04x pos=%04x flags=%04x)\n",hMenu, nPos, wFlags);
    34293445    if (!(item = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
    3430     if (!(menu = (LPPOPUPMENU)hMenu)) return FALSE;
     3446    if (!(menu = MENU_GetMenu(hMenu))) return FALSE;
    34313447
    34323448      /* Remove item */
     
    36123628    if (hMenu && hMenu != MENU_DefSysPopup)
    36133629    {
    3614         LPPOPUPMENU lppop = (LPPOPUPMENU)hMenu;
     3630        LPPOPUPMENU lppop = MENU_GetMenu(hMenu);
    36153631        HWND pTPWnd = MENU_GetTopPopupWnd();
    36163632
     
    36183634          SetWindowLongA(pTPWnd,0,0);
    36193635
    3620         if (IS_A_MENU( lppop ))
     3636        if (!IS_A_MENU(lppop)) lppop = NULL;
     3637        if (lppop)
    36213638        {
    36223639            lppop->wMagic = 0;  /* Mark it as destroyed */
     
    36723689            else
    36733690            {
    3674                 POPUPMENU *menu = (POPUPMENU*)hSysMenu;
    3675                 if( IS_A_MENU(menu) )
     3691                POPUPMENU *menu = MENU_GetMenu(hSysMenu);
     3692                if(menu)
    36763693                {
    36773694                   if( menu->nItems > 0 && menu->items[0].hSubMenu == MENU_DefSysPopup )
     
    37013718            /* Store the dummy sysmenu handle to facilitate the refresh */
    37023719            /* of the close button if the SC_CLOSE item change */
    3703             menu = (POPUPMENU*)retvalue;
    3704             if ( IS_A_MENU(menu) )
     3720            menu = MENU_GetMenu(retvalue);
     3721            if (menu)
    37053722               menu->hSysMenuOwner = hSysMenu;
    37063723        }
     
    37663783            LPPOPUPMENU lpmenu;
    37673784
    3768             if (!(lpmenu = (LPPOPUPMENU)hMenu))
     3785            if (!(lpmenu = MENU_GetMenu(hMenu)))
    37693786            {
    37703787                return FALSE;
     
    38113828    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && getMenu(hWnd))
    38123829    {
    3813         lppop = (LPPOPUPMENU)getMenu(hWnd);
     3830        lppop = MENU_GetMenu(getMenu(hWnd));
    38143831        if (lppop == NULL)
    38153832        {
     
    40954112        menu->hSubMenu = lpmii->hSubMenu;
    40964113        if (menu->hSubMenu) {
    4097             POPUPMENU *subMenu = (POPUPMENU*)(UINT)menu->hSubMenu;
    4098             if (IS_A_MENU(subMenu)) {
     4114            POPUPMENU *subMenu = MENU_GetMenu((UINT)menu->hSubMenu);
     4115            if (subMenu) {
    40994116                subMenu->wFlags |= MF_POPUP;
    41004117                menu->fType |= MF_POPUP;
     
    41584175        //TRACE("(0x%x,%d,%d)\n", hmenu, uItem, bypos);
    41594176
    4160         if (!(menu = (POPUPMENU*)hmenu)) return FALSE;
     4177        if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
    41614178
    41624179        /* reset all default-item flags */
     
    42074224        //TRACE("(0x%x,%d,%d)\n", hmenu, bypos, flags);
    42084225
    4209         if (!(menu = (POPUPMENU*)hmenu)) return -1;
     4226        if (!(menu = MENU_GetMenu(hmenu))) return -1;
    42104227
    42114228        /* find default item */
     
    43264343     if(!hwnd)
    43274344     {
    4328          itemMenu = (POPUPMENU*)hMenu;
     4345         itemMenu = MENU_GetMenu(hMenu);
    43294346         if (itemMenu == NULL) {
    4330                 SetLastError(ERROR_INVALID_PARAMETER);
    4331                 return FALSE;
    4332         }
     4347                SetLastError(ERROR_INVALID_PARAMETER);
     4348                return FALSE;
     4349        }
    43334350
    43344351         if(itemMenu->hWnd == 0)
     
    43384355
    43394356     if ((rect == NULL) || (item == NULL)) {
    4340         SetLastError(ERROR_INVALID_PARAMETER);
     4357        SetLastError(ERROR_INVALID_PARAMETER);
    43414358        return FALSE;
    43424359     }
     
    43634380    //TRACE("(0x%04x %p)\n", hMenu, lpmi);
    43644381
    4365     if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=(POPUPMENU*)hMenu))
     4382    if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=MENU_GetMenu(hMenu)))
    43664383    {
    43674384
     
    43994416    //TRACE("(0x%04x %p)\n", hMenu, lpmi);
    44004417
    4401     if (lpmi && (menu = (POPUPMENU*)hMenu))
     4418    if (lpmi && (menu = MENU_GetMenu(hMenu)))
    44024419    {
    44034420
     
    44324449    //TRACE("(0x%04x 0x%08lx)\n", hMenu, dwContextHelpID);
    44334450
    4434     menu = (POPUPMENU*)hMenu;
     4451    menu = MENU_GetMenu(hMenu);
    44354452    if (menu)
    44364453    {
     
    44514468    //TRACE("(0x%04x)\n", hMenu);
    44524469
    4453     menu = (POPUPMENU*)hMenu;
     4470    menu = MENU_GetMenu(hMenu);
    44544471    if (menu)
    44554472    {
  • trunk/src/user32/scroll.cpp

    r2469 r2611  
    1 /* $Id: scroll.cpp,v 1.32 2000-01-18 20:10:44 sandervl Exp $ */
     1/* $Id: scroll.cpp,v 1.33 2000-02-03 17:13:01 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
     
    88 * Copyright 1994, 1996 Alexandre Julliard
    99 *
    10  * WINE version: 991031
     10 * WINE version: 20000130
    1111 *
    1212 * Status:  complete
     
    12601260    //             infoPtr->MinVal, infoPtr->MaxVal );
    12611261
     1262    /* don't change the scrollbar state if SetScrollInfo
     1263     * is just called with SIF_DISABLENOSCROLL
     1264     */
     1265    if(!(info->fMask & SIF_ALL)) goto done;
     1266
    12621267    /* Check if the scrollbar should be hidden or disabled */
    12631268    if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))
  • trunk/src/user32/win32wbase.cpp

    r2569 r2611  
    1 /* $Id: win32wbase.cpp,v 1.149 2000-01-29 20:46:52 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.150 2000-02-03 17:13:01 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    651651            if(!(flags & WIN_NEED_SIZE))
    652652            {
    653              LPARAM lParam;
    654 
    655653                SendInternalMessageA(WM_SIZE, SIZE_RESTORED,
    656654                                MAKELONG(rectClient.right-rectClient.left,
    657655                                         rectClient.bottom-rectClient.top));
    658656
    659                 if(getParent()) {//in parent coordinates
    660                     POINT point;
    661 
    662                     point.x = rectClient.left;
    663                     point.y = rectClient.top;
    664                     MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
    665 
    666                     lParam = MAKELONG(point.x, point.y);
    667                 }
    668                 else {//in screen coordinates
    669                     lParam = MAKELONG(rectWindow.left+rectClient.left, rectWindow.top+rectClient.top);
    670                 }
    671 
    672                 SendInternalMessageA(WM_MOVE, 0, lParam);
     657                SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    673658            }
    674659
     
    684669            }
    685670
     671            //CB: timew32.exe, blockcad.exe -> children not shown!!!
    686672            if (cs->style & WS_VISIBLE) ShowWindow(sw);
    687673
     
    12801266    {
    12811267        LPCSTR lpsz = (LPCSTR)lParam;
    1282         CHAR* oldNameA = windowNameA;
    1283         WCHAR* oldNameW = windowNameW;
    1284 
     1268
     1269        if(windowNameA) free(windowNameA);
     1270        if(windowNameW) free(windowNameW);
    12851271        if (lParam)
    12861272        {
     
    12981284        }
    12991285        dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, lParam));
    1300         if ((dwStyle & WS_CAPTION) && (lstrcmpA(oldNameA,windowNameA) != 0))
    1301         {
    1302           UpdateCaptionText();
     1286        if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     1287        {
     1288          HandleNCPaint((HRGN)1);
    13031289          OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA);
    13041290        }
    1305 
    1306         if(oldNameA) free(oldNameA);
    1307         if(oldNameW) free(oldNameW);
    13081291
    13091292        return TRUE;
     
    14281411        if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE))
    14291412        {
    1430             SendInternalMessageA(WM_MOVE, 0, MAKELONG(wpos->x + rectClient.left, wpos->y + rectClient.top));
     1413            SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));
    14311414        }
    14321415        if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE))
     
    16961679        LPWSTR lpsz = (LPWSTR)lParam;
    16971680
    1698         CHAR* oldNameA = windowNameA;
    1699         WCHAR* oldNameW = windowNameW;
    1700 
     1681        if(windowNameA) free(windowNameA);
     1682        if(windowNameW) free(windowNameW);
    17011683        if (lParam)
    17021684        {
     
    17141696        }
    17151697        dprintf(("WM_SETTEXT of %x\n",Win32Hwnd));
    1716         if ((dwStyle & WS_CAPTION) && (lstrcmpW(oldNameW,windowNameW) != 0))
    1717         {
    1718           UpdateCaptionText();
     1698        if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     1699        {
     1700          HandleNCPaint((HRGN)1);
    17191701          OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA);
    17201702        }
    1721 
    1722         if(oldNameA) free(oldNameA);
    1723         if(oldNameW) free(oldNameW);
    17241703
    17251704        return TRUE;
     
    19781957                     MAKELONG(rectClient.right-rectClient.left,
    19791958                              rectClient.bottom-rectClient.top));
    1980         DWORD lParam;
    1981 
    1982         if(getParent()) {//in parent coordinates
    1983             POINT point;
    1984 
    1985             point.x = rectClient.left;
    1986             point.y = rectClient.top;
    1987             MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
    1988 
    1989             lParam = MAKELONG(point.x, point.y);
    1990         }
    1991         else {//in screen coordinates
    1992             lParam = MAKELONG(rectWindow.left+rectClient.left, rectWindow.top+rectClient.top);
    1993         }
    1994         SendInternalMessageA(WM_MOVE, 0, lParam);
     1959        SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    19951960    }
    19961961    switch(nCmdShow)
  • trunk/src/user32/win32wbase.h

    r2552 r2611  
    1 /* $Id: win32wbase.h,v 1.77 2000-01-28 22:26:00 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.78 2000-02-03 17:13:02 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    106106         ULONG  MsgPosChanging(LPARAM lp);
    107107         ULONG  MsgPosChanged(LPARAM lp);
    108         ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
     108        ULONG  MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win);
    109109         ULONG  MsgSetFocus(HWND hwnd);
    110110         ULONG  MsgKillFocus(HWND hwnd);
     
    401401        VOID  DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
    402402        VOID  DrawCaption(HDC hdc,RECT *rect,BOOL active,BOOL redrawText);
    403         VOID  UpdateCaptionText();
    404403        VOID  DoNCPaint(HRGN clip,BOOL suppress_menupaint);
    405404        LONG  HandleNCPaint(HRGN clip);
  • trunk/src/user32/win32wbasenonclient.cpp

    r2577 r2611  
    1 /* $Id: win32wbasenonclient.cpp,v 1.7 2000-01-30 18:48:29 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.8 2000-02-03 17:13:03 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    415415  if (!PtInRect(&rect,pt)) return HTNOWHERE;
    416416
    417   if (!(flags & WIN_MANAGED))
    418   {
    419     /* Check borders */
    420     if (HAS_THICKFRAME(dwStyle,dwExStyle))
    421     {
    422       InflateRect(&rect,-GetSystemMetrics(SM_CXFRAME),-GetSystemMetrics(SM_CYFRAME));
    423       if (!PtInRect(&rect,pt))
     417  /* Check borders */
     418  if (HAS_THICKFRAME(dwStyle,dwExStyle))
     419  {
     420    InflateRect(&rect,-GetSystemMetrics(SM_CXFRAME),-GetSystemMetrics(SM_CYFRAME));
     421    if (!PtInRect(&rect,pt))
     422    {
     423      /* Check top sizing border */
     424      if (pt.y < rect.top)
    424425      {
    425         /* Check top sizing border */
    426         if (pt.y < rect.top)
    427         {
    428           if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
    429           if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
    430           return HTTOP;
    431         }
    432         /* Check bottom sizing border */
    433         if (pt.y >= rect.bottom)
    434         {
    435           if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
    436           if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
    437           return HTBOTTOM;
    438         }
    439         /* Check left sizing border */
    440         if (pt.x < rect.left)
    441         {
    442           if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
    443           if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
    444           return HTLEFT;
    445         }
    446         /* Check right sizing border */
    447         if (pt.x >= rect.right)
    448         {
    449           if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
    450           if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
    451           return HTRIGHT;
    452         }
     426        if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
     427        if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
     428        return HTTOP;
    453429      }
    454     } else  /* No thick frame */
    455     {
    456       if (HAS_DLGFRAME(dwStyle,dwExStyle))
    457         InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
    458       else if (HAS_THINFRAME(dwStyle ))
    459         InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
    460       if (!PtInRect( &rect, pt )) return HTBORDER;
    461     }
    462 
    463     /* Check caption */
    464 
    465     if ((dwStyle & WS_CAPTION) == WS_CAPTION)
    466     {
    467       if (dwExStyle & WS_EX_TOOLWINDOW)
    468         rect.top += GetSystemMetrics(SM_CYSMCAPTION)-1;
    469       else
    470         rect.top += GetSystemMetrics(SM_CYCAPTION)-1;
    471       if (!PtInRect(&rect,pt))
     430      /* Check bottom sizing border */
     431      if (pt.y >= rect.bottom)
    472432      {
    473         /* Check system menu */
    474         if(dwStyle & WS_SYSMENU)
    475         {
    476           /* Check if there is an user icon */
    477           HICON hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
    478           if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
    479 
    480           /* If there is an icon associated with the window OR              */
    481           /* If there is no hIcon specified and this is not a modal dialog, */
    482           /* there is a system menu icon.                                   */
    483           if((hIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
    484           rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
    485         }
    486         if (pt.x < rect.left) return HTSYSMENU;
    487 
    488         /* Check close button */
    489         if (dwStyle & WS_SYSMENU)
    490         rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
    491         if (pt.x > rect.right) return HTCLOSE;
    492 
    493         /* Check maximize box */
    494         /* In win95 there is automatically a Maximize button when there is a minimize one*/
    495         if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
    496         rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    497         if (pt.x > rect.right) return HTMAXBUTTON;
    498 
    499         /* Check minimize box */
    500         /* In win95 there is automatically a Maximize button when there is a Maximize one*/
    501         if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX))
    502         rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    503 
    504         if (pt.x > rect.right) return HTMINBUTTON;
    505         return HTCAPTION;
     433        if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
     434        if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
     435        return HTBOTTOM;
    506436      }
     437      /* Check left sizing border */
     438      if (pt.x < rect.left)
     439      {
     440        if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
     441        if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
     442        return HTLEFT;
     443      }
     444      /* Check right sizing border */
     445      if (pt.x >= rect.right)
     446      {
     447        if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
     448        if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
     449        return HTRIGHT;
     450      }
     451    }
     452  } else  /* No thick frame */
     453  {
     454    if (HAS_DLGFRAME(dwStyle,dwExStyle))
     455      InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
     456    else if (HAS_THINFRAME(dwStyle ))
     457      InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
     458    if (!PtInRect( &rect, pt )) return HTBORDER;
     459  }
     460
     461  /* Check caption */
     462
     463  if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     464  {
     465    if (dwExStyle & WS_EX_TOOLWINDOW)
     466      rect.top += GetSystemMetrics(SM_CYSMCAPTION)-1;
     467    else
     468      rect.top += GetSystemMetrics(SM_CYCAPTION)-1;
     469    if (!PtInRect(&rect,pt))
     470    {
     471      /* Check system menu */
     472      if(dwStyle & WS_SYSMENU)
     473      {
     474        /* Check if there is an user icon */
     475        HICON hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
     476        if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
     477
     478        /* If there is an icon associated with the window OR              */
     479        /* If there is no hIcon specified and this is not a modal dialog, */
     480        /* there is a system menu icon.                                   */
     481        if((hIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
     482        rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
     483      }
     484      if (pt.x < rect.left) return HTSYSMENU;
     485
     486      /* Check close button */
     487      if (dwStyle & WS_SYSMENU)
     488      rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
     489      if (pt.x > rect.right) return HTCLOSE;
     490
     491      /* Check maximize box */
     492      /* In win95 there is automatically a Maximize button when there is a minimize one*/
     493      if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
     494      rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     495      if (pt.x > rect.right) return HTMAXBUTTON;
     496
     497      /* Check minimize box */
     498      /* In win95 there is automatically a Maximize button when there is a Maximize one*/
     499      if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX))
     500      rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     501
     502      if (pt.x > rect.right) return HTMINBUTTON;
     503      return HTCAPTION;
    507504    }
    508505  }
     
    557554  rect->bottom = rectWindow.bottom - rectWindow.top;
    558555
    559   if ((dwStyle & WS_ICONIC) || (flags & WIN_MANAGED)) return;
     556  if (dwStyle & WS_ICONIC) return;
    560557
    561558  /* Remove frame from rectangle */
     
    618615BOOL Win32BaseWindow::DrawSysButton(HDC hdc,RECT *rect)
    619616{
    620   if(!(flags & WIN_MANAGED))
    621   {
    622     HICON  hIcon;
    623     RECT r;
    624 
    625     if (!rect) GetInsideRect(&r);
    626     else r = *rect;
    627 
    628     hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
    629     if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
    630 
    631     /* If there is no hIcon specified or this is not a modal dialog, */
    632     /* get the default one.                                          */
    633     if(hIcon == 0)
    634       if (!(dwStyle & DS_MODALFRAME))
    635         hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
    636 
    637     if (hIcon)
    638       DrawIconEx(hdc,r.left+2,r.top+2,hIcon,
    639                  GetSystemMetrics(SM_CXSMICON),
    640                  GetSystemMetrics(SM_CYSMICON),
    641                  0, 0, DI_NORMAL);
    642 
    643     return (hIcon != 0);
    644   }
    645   return FALSE;
     617  HICON  hIcon;
     618  RECT r;
     619
     620  if (!rect) GetInsideRect(&r);
     621  else r = *rect;
     622
     623  hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
     624  if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
     625
     626  /* If there is no hIcon specified or this is not a modal dialog, */
     627  /* get the default one.                                          */
     628  if(hIcon == 0)
     629    if (!(dwStyle & DS_MODALFRAME))
     630      hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
     631
     632  if (hIcon)
     633    DrawIconEx(hdc,r.left+2,r.top+2,hIcon,
     634               GetSystemMetrics(SM_CXSMICON),
     635               GetSystemMetrics(SM_CYSMICON),
     636               0, 0, DI_NORMAL);
     637
     638  return (hIcon != 0);
    646639}
    647640//******************************************************************************
     
    696689  RECT r;
    697690  HDC hdcMem;
    698 
    699   if( !(flags & WIN_MANAGED) )
    700   {
    701     BITMAP bmp;
    702     HBITMAP hBmp, hOldBmp;
    703 
    704     if (!rect) GetInsideRect(&r);
    705     else r = *rect;
    706 
    707     hdcMem = CreateCompatibleDC( hdc );
    708     hBmp = down ? hbitmapCloseD : hbitmapClose;
    709     hOldBmp = SelectObject (hdcMem, hBmp);
    710     GetObjectA (hBmp, sizeof(BITMAP), &bmp);
    711 
    712     BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
    713             r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    714             bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
    715 
    716     if(bGrayed)
    717       DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
    718                      r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    719 
    720     SelectObject (hdcMem, hOldBmp);
    721     DeleteDC (hdcMem);
    722   }
     691  BITMAP bmp;
     692  HBITMAP hBmp, hOldBmp;
     693
     694  if (!rect) GetInsideRect(&r);
     695  else r = *rect;
     696
     697  hdcMem = CreateCompatibleDC( hdc );
     698  hBmp = down ? hbitmapCloseD : hbitmapClose;
     699  hOldBmp = SelectObject (hdcMem, hBmp);
     700  GetObjectA (hBmp, sizeof(BITMAP), &bmp);
     701
     702  BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
     703          r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     704          bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
     705
     706  if(bGrayed)
     707    DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
     708                   r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     709
     710  SelectObject (hdcMem, hOldBmp);
     711  DeleteDC (hdcMem);
    723712}
    724713//******************************************************************************
     
    728717  RECT r;
    729718  HDC hdcMem;
    730 
    731   if( !(flags & WIN_MANAGED))
    732   {
    733     BITMAP  bmp;
    734     HBITMAP  hBmp,hOldBmp;
    735 
    736     if (!rect) GetInsideRect(&r);
    737     else r = *rect;
    738     hdcMem = CreateCompatibleDC( hdc );
    739     hBmp = IsZoomed(Win32Hwnd) ?
    740             (down ? hbitmapRestoreD : hbitmapRestore ) :
    741             (down ? hbitmapMaximizeD: hbitmapMaximize);
    742     hOldBmp=SelectObject( hdcMem, hBmp );
    743     GetObjectA (hBmp, sizeof(BITMAP), &bmp);
    744 
    745     if (dwStyle & WS_SYSMENU)
    746       r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    747 
    748     BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
     719  BITMAP  bmp;
     720  HBITMAP  hBmp,hOldBmp;
     721
     722  if (!rect) GetInsideRect(&r);
     723  else r = *rect;
     724  hdcMem = CreateCompatibleDC( hdc );
     725  hBmp = IsZoomed(Win32Hwnd) ?
     726          (down ? hbitmapRestoreD : hbitmapRestore ) :
     727          (down ? hbitmapMaximizeD: hbitmapMaximize);
     728  hOldBmp=SelectObject( hdcMem, hBmp );
     729  GetObjectA (hBmp, sizeof(BITMAP), &bmp);
     730
     731  if (dwStyle & WS_SYSMENU)
     732    r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
     733
     734  BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
     735        r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     736        bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
     737
     738  if(bGrayed)
     739    DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
     740                   r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     741
     742  SelectObject (hdcMem, hOldBmp);
     743  DeleteDC( hdcMem );
     744}
     745//******************************************************************************
     746//******************************************************************************
     747VOID Win32BaseWindow::DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
     748{
     749  RECT r;
     750  HDC hdcMem;
     751  BITMAP  bmp;
     752  HBITMAP  hBmp,hOldBmp;
     753
     754  if (!rect) GetInsideRect(&r);
     755  else r = *rect;
     756
     757  hdcMem = CreateCompatibleDC( hdc );
     758  hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
     759  hOldBmp= SelectObject( hdcMem, hBmp );
     760  GetObjectA (hBmp, sizeof(BITMAP), &bmp);
     761
     762  if (dwStyle & WS_SYSMENU)
     763    r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
     764
     765  /* In win 95 there is always a Maximize box when there is a Minimize one */
     766  if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
     767    r.right -= bmp.bmWidth;
     768
     769  BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
    749770          r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    750771          bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
    751772
    752     if(bGrayed)
    753       DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
    754                       r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    755 
    756 
    757     SelectObject (hdcMem, hOldBmp);
    758     DeleteDC( hdcMem );
    759   }
    760 }
    761 //******************************************************************************
    762 //******************************************************************************
    763 VOID Win32BaseWindow::DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
    764 {
    765   RECT r;
    766   HDC hdcMem;
    767 
    768   if( !(flags & WIN_MANAGED))
    769 
    770   {
    771     BITMAP  bmp;
    772     HBITMAP  hBmp,hOldBmp;
    773 
    774     if (!rect) GetInsideRect(&r);
    775     else r = *rect;
    776 
    777     hdcMem = CreateCompatibleDC( hdc );
    778     hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
    779     hOldBmp= SelectObject( hdcMem, hBmp );
    780     GetObjectA (hBmp, sizeof(BITMAP), &bmp);
    781 
    782     if (dwStyle & WS_SYSMENU)
    783       r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    784 
    785     /* In win 95 there is always a Maximize box when there is a Minimize one */
    786     if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
    787       r.right -= bmp.bmWidth;
    788 
    789     BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
    790           r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    791           bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
    792 
    793     if(bGrayed)
    794       DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
    795                       r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    796 
    797 
    798     SelectObject (hdcMem, hOldBmp);
    799     DeleteDC( hdcMem );
    800   }
     773  if(bGrayed)
     774    DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
     775                   r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     776
     777
     778  SelectObject (hdcMem, hOldBmp);
     779  DeleteDC( hdcMem );
    801780}
    802781//******************************************************************************
     
    810789  HDC memDC;
    811790  HBITMAP memBmp,oldBmp;
    812 
    813   if (flags & WIN_MANAGED) return;
    814791
    815792  memDC = CreateCompatibleDC(hdc);
     
    934911//******************************************************************************
    935912//******************************************************************************
    936 VOID Win32BaseWindow::UpdateCaptionText()
    937 {
    938   BOOL active = flags & WIN_NCACTIVATED;
    939   HDC hdc;
    940   RECT rect,r;
    941   HRGN hrgn;
    942 
    943   if (!((dwStyle & WS_CAPTION) == WS_CAPTION)) return;
    944 
    945   rect.top = rect.left = 0;
    946   rect.right  = rectWindow.right - rectWindow.left;
    947   rect.bottom = rectWindow.bottom - rectWindow.top;
    948   if(!(flags & WIN_MANAGED))
    949   {
    950     if (HAS_BIGFRAME( dwStyle, dwExStyle))
    951     {
    952       InflateRect(&rect,-2,-2);
    953     }
    954 
    955     if (HAS_THICKFRAME(dwStyle,dwExStyle))
    956     {
    957       INT width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
    958       INT height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE);
    959 
    960       InflateRect(&rect,-width,-height);
    961     }
    962     else if (HAS_DLGFRAME(dwStyle,dwExStyle))
    963     {
    964       INT width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
    965       INT height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
    966 
    967       InflateRect(&rect,-width,-height);
    968     }
    969     else if (HAS_THINFRAME(dwStyle))
    970     {
    971     }
    972 
    973     r = rect;
    974     if (dwExStyle & WS_EX_TOOLWINDOW)
    975     {
    976       r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
    977     }
    978     else
    979     {
    980       r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
    981     }
    982 
    983     //clip the buttons
    984     if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
    985     {
    986       HICON hIcon;
    987 
    988       hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
    989       if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
    990       if (hIcon)
    991         rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
    992     }
    993     if (dwStyle & WS_SYSMENU)
    994     {
    995       rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
    996 
    997       if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
    998       {
    999         rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    1000         rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    1001       }
    1002     }
    1003 
    1004     hrgn = CreateRectRgnIndirect(&rect);
    1005     hdc = GetDCEx(Win32Hwnd,hrgn,DCX_USESTYLE | DCX_WINDOW | DCX_INTERSECTRGN);
    1006     SelectObject(hdc,GetSysColorPen(COLOR_WINDOWFRAME));
    1007     DrawCaption(hdc,&r,active,TRUE);
    1008     DeleteObject(hrgn);
    1009     ReleaseDC(Win32Hwnd,hdc);
    1010   }
    1011 }
    1012 //******************************************************************************
    1013 //******************************************************************************
    1014913VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint)
    1015914{
     
    1034933  rect.bottom = rectWindow.bottom - rectWindow.top;
    1035934
    1036   if( clip > 1 )
    1037   {
    1038     //CB: unknown WINE handling (clip == 1), clip client?
    1039     GetRgnBox( clip, &rectClip );
    1040   } 
     935  if (clip > 1)
     936  {
     937    //only redraw caption
     938    GetRgnBox(clip,&rectClip);
     939  }
    1041940  else
    1042941  {
     
    1047946  SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
    1048947
    1049   if(!(flags & WIN_MANAGED))
    1050   {
    1051     if (HAS_BIGFRAME( dwStyle, dwExStyle))
    1052     {
    1053       DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
    1054     }
    1055     if (HAS_THICKFRAME( dwStyle, dwExStyle ))
    1056       DrawFrame(hdc, &rect, FALSE, active );
    1057     else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
    1058       DrawFrame( hdc, &rect, TRUE, active );
    1059     else if (HAS_THINFRAME( dwStyle ))
    1060     {
    1061       SelectObject( hdc, GetStockObject(NULL_BRUSH) );
    1062       Rectangle( hdc, 0, 0, rect.right, rect.bottom );
    1063     }
    1064 
    1065     if ((dwStyle & WS_CAPTION) == WS_CAPTION)
    1066     {
    1067       RECT  r = rect;
    1068       if (dwExStyle & WS_EX_TOOLWINDOW)
    1069       {
    1070         r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
    1071         rect.top += GetSystemMetrics(SM_CYSMCAPTION);
    1072       }
    1073       else
    1074       {
    1075         r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
    1076         rect.top += GetSystemMetrics(SM_CYCAPTION);
    1077       }
    1078       if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
    1079         DrawCaption(hdc,&r,active,FALSE);
    1080     }
    1081   }
     948  if (HAS_BIGFRAME( dwStyle, dwExStyle))
     949  {
     950    DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
     951  }
     952  if (HAS_THICKFRAME( dwStyle, dwExStyle ))
     953    DrawFrame(hdc, &rect, FALSE, active );
     954  else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
     955    DrawFrame( hdc, &rect, TRUE, active );
     956  else if (HAS_THINFRAME( dwStyle ))
     957  {
     958    SelectObject( hdc, GetStockObject(NULL_BRUSH) );
     959    Rectangle( hdc, 0, 0, rect.right, rect.bottom );
     960  }
     961
     962  if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     963  {
     964    RECT  r = rect;
     965    if (dwExStyle & WS_EX_TOOLWINDOW)
     966    {
     967      r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
     968      rect.top += GetSystemMetrics(SM_CYSMCAPTION);
     969    }
     970    else
     971    {
     972      r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
     973      rect.top += GetSystemMetrics(SM_CYCAPTION);
     974    }
     975    if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
     976      DrawCaption(hdc,&r,active,FALSE);
     977  }
     978
    1082979  if (HAS_MENU())
    1083980  {
  • trunk/src/user32/win32wbasepos.cpp

    r2521 r2611  
    1 /* $Id: win32wbasepos.cpp,v 1.11 2000-01-26 18:02:38 cbratschi Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.12 2000-02-03 17:13:03 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    5959    MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
    6060
    61     if (flags & WIN_MANAGED) xinc = yinc = 0;
    62     else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
     61    if (HAS_DLGFRAME( dwStyle, dwExStyle ))
    6362    {
    6463        xinc = GetSystemMetrics(SM_CXDLGFRAME);
Note: See TracChangeset for help on using the changeset viewer.