Changeset 7409 for trunk/src


Ignore:
Timestamp:
Nov 21, 2001, 12:51:39 PM (24 years ago)
Author:
sandervl
Message:

menu + groupbox fixes

Location:
trunk/src/user32
Files:
5 edited

Legend:

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

    r6605 r7409  
    1 /* $Id: button.cpp,v 1.43 2001-08-29 10:37:25 phaller Exp $ */
     1/* $Id: button.cpp,v 1.44 2001-11-21 11:51:37 sandervl Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    336336
    337337  DefWindowProcA(hwnd,WM_SETTEXT,wParam,lParam);
     338#ifdef __WIN32OS2__
     339  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
     340  if ((dwStyle & 0x0f) == BS_GROUPBOX) {
     341    RECT rc;
     342    TEXTMETRICA tm;
     343    HDC  hdc = GetDC(hwnd);
     344    int  fh1 = 0, fh2 = 0;
     345
     346    // select old font (if exists)
     347    if (infoPtr->hFont) {
     348       SelectObject (hdc, infoPtr->hFont);
     349       GetTextMetricsA (hdc, &tm);
     350       fh1 = tm.tmHeight;
     351    }
     352    // select new font (if exists)
     353    if (wParam) {
     354       SelectObject (hdc, wParam);
     355       GetTextMetricsA (hdc, &tm);
     356       fh2 = tm.tmHeight;
     357    }
     358    // Erases top border line and (old) text background
     359    GetClientRect(hwnd, &rc);
     360    rc.bottom = rc.top + max( fh1, fh2) + 1;
     361    HBRUSH hbr = GetControlBrush( hwnd, hdc, CTLCOLOR_STATIC );
     362    FillRect(hdc, &rc, hbr);
     363    ReleaseDC(hwnd,hdc);
     364  }
     365#endif
     366
    338367  if (dwStyle & WS_VISIBLE) PAINT_BUTTON(hwnd,dwStyle & 0x0f,ODA_DRAWENTIRE);
    339368
  • trunk/src/user32/menu.cpp

    r7195 r7409  
    1 /* $Id: menu.cpp,v 1.39 2001-10-24 15:41:53 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.40 2001-11-21 11:51:37 sandervl Exp $*/
    22/*
    33 * Menu functions
     
    302302//#define USER_HEAP_FREE(handle) HeapFree(GetProcessHeap(),0,(LPVOID)handle)
    303303
    304 HMENU getMenu(HWND hwnd)
    305 {
    306   Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    307  
    308   if(win32wnd) {
    309       HMENU hmenu = win32wnd->GetMenu();
    310       RELEASE_WNDOBJ(win32wnd);
    311       return hmenu;
    312   }
    313   return (HMENU)0;
    314 }
    315 
    316 VOID setMenu(HWND hwnd,HMENU hMenu)
    317 {
    318   Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    319 
    320   if (win32wnd) {
    321       win32wnd->SetMenu(hMenu);
    322       RELEASE_WNDOBJ(win32wnd);
    323   }
    324 }
    325 
    326304
    327305/***********************************************************************
     
    14681446    HFONT hfontOld = 0;
    14691447
    1470     lppop = MENU_GetMenu(getMenu(hwnd));
     1448    lppop = MENU_GetMenu(GetMenu(hwnd));
    14711449    if (lppop == NULL || lprect == NULL)
    14721450    {
     
    15181496      {
    15191497        OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top);
    1520         MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER),
     1498        MENU_DrawMenuItem( hwnd,GetMenu(hwnd), GetWindow(hwnd,GW_OWNER),
    15211499                         memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
    15221500        OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top);
     
    22662244        {
    22672245            ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd))
    2268                  : ((ht == HTMENU) && inMenuBar) ? (UINT)(getMenu(menu->hWnd)) : 0;
     2246                 : ((ht == HTMENU) && inMenuBar) ? (UINT)(GetMenu(menu->hWnd)) : 0;
    22692247        }
    22702248   }
     
    25612539                /* switch to the menu bar */
    25622540
    2563                 if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !getMenu(pmt->hOwnerWnd) )
     2541                if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !GetMenu(pmt->hOwnerWnd) )
    25642542                {
    25652543                    return FALSE;
    25662544                }
    25672545
    2568                 hNewMenu = getMenu(pmt->hOwnerWnd);
     2546                hNewMenu = GetMenu(pmt->hOwnerWnd);
    25692547                if( vk == VK_LEFT )
    25702548                {
     
    25962574                    hNewMenu =  getSysMenu(hNewWnd);
    25972575                }
    2598                 else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (getMenu(hNewWnd) != hNewMenu) )
     2576                else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (GetMenu(hNewWnd) != hNewMenu) )
    25992577                {
    26002578                    /* FIXME: Not sure what to do here, perhaps,
     
    31633141void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
    31643142{
    3165     HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd);
     3143    HMENU hMenu = (ht == 0) ? GetMenu(hWnd):getSysMenu(hWnd);
    31663144    UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
    31673145
     
    31853163void MENU_TrackMouseMenuBar_MouseMove(HWND hwnd,POINT pt,BOOL OnMenu)
    31863164{
    3187     HMENU hMenu = getMenu(hwnd);
     3165    HMENU hMenu = GetMenu(hwnd);
    31883166    MENUITEM *item = NULL;
    31893167    RECT rect;
     
    32623240
    32633241    if( (GetWindowLongA(hWnd,GWL_STYLE) & (WS_CHILD | WS_MINIMIZE)) ||
    3264         !getMenu(hWnd) || vkey == VK_SPACE )
     3242        !GetMenu(hWnd) || vkey == VK_SPACE )
    32653243    {
    32663244        if( !(GetWindowLongA(hWnd,GWL_STYLE) & WS_SYSMENU) ) return;
     
    32703248    }
    32713249    else
    3272         hTrackMenu = getMenu(hWnd);
     3250        hTrackMenu = GetMenu(hWnd);
    32733251
    32743252    if (IsMenu( hTrackMenu ))
     
    34563434    //             hwnd, menubarWidth, orgX, orgY );
    34573435
    3458     if (!(lppop = MENU_GetMenu(getMenu(hwnd))))
     3436    if (!(lppop = MENU_GetMenu(GetMenu(hwnd))))
    34593437    {
    34603438        return 0;
     
    41434121    HMENU retvalue;
    41444122
    4145     dprintf(("USER32: GetMenu %x", hWnd));
    4146 
    4147     if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) return 0;
    4148     else return getMenu(hWnd);
     4123    dprintf(("USER32: GetMenu %x %x", hWnd, GetWindowLongA( hWnd, GWL_ID )));
     4124
     4125    if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) {
     4126        dprintf(("WARNING: window is child; no menu"));
     4127        return 0;
     4128    }
     4129    retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID );
     4130    if(MENU_GetMenu(retvalue) != NULL) {
     4131        return retvalue;
     4132    }
     4133    return 0;
    41494134}
    41504135
     
    41694154        if (GetCapture() == hWnd) ReleaseCapture();
    41704155
    4171         setMenu(hWnd,hMenu);
    41724156        if (hMenu != 0)
    41734157        {
     
    41824166            lpmenu->Height = 0;  /* Make sure we recalculate the size */
    41834167        }
     4168        SetWindowLongA( hWnd, GWL_ID, hMenu );
     4169
     4170#ifdef __WIN32OS2__
    41844171//SvL: This fixes the menu in standard mine sweeper (window isn't visible
    41854172//     when SetMenu is called)
    41864173//        if (IsWindowVisible(hWnd))
     4174#endif
    41874175            SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
    41884176                        SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
     
    42024190    dprintf(("USER32: GetSubMenu %x %d", hMenu, nPos));
    42034191
     4192#ifdef __WIN32OS2__
     4193    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION)))  {
     4194        SetLastError(ERROR_INVALID_HANDLE);
     4195        return 0;
     4196    }
     4197#else
    42044198    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
     4199#endif
     4200
    42054201    if (!(lpmi->fType & MF_POPUP)) return 0;
    42064202    return lpmi->hSubMenu;
     
    42174213    dprintf(("USER32: DrawMenuBar %x", hWnd));
    42184214
    4219     if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && getMenu(hWnd))
    4220     {
    4221         lppop = MENU_GetMenu(getMenu(hWnd));
     4215    if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && GetMenu(hWnd))
     4216    {
     4217        lppop = MENU_GetMenu(GetMenu(hWnd));
    42224218        if (lppop == NULL)
    42234219        {
  • trunk/src/user32/win32wbase.cpp

    r7371 r7409  
    1 /* $Id: win32wbase.cpp,v 1.300 2001-11-17 17:49:38 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.301 2001-11-21 11:51:38 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    37053705
    37063706        case GWL_ID:
     3707                dprintf(("GWL_ID old %x, new %x", getWindowId(), value));
    37073708                oldval = getWindowId();
    37083709                setWindowId(value);
  • trunk/src/user32/win32wbase.h

    r7338 r7409  
    1 /* $Id: win32wbase.h,v 1.133 2001-11-14 14:36:03 phaller Exp $ */
     1/* $Id: win32wbase.h,v 1.134 2001-11-21 11:51:38 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    120120    !(style & (WS_CHILD | WS_POPUP))
    121121
    122 #define HAS_MENU() (!(getStyle() & WS_CHILD) && (GetMenu() != 0))
     122#define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0))
    123123
    124124#define STATE_INIT               0   //initial state
     
    239239         PVOID  getExtraPtr()                   { return pExtra; };
    240240
    241          HMENU  GetMenu()                           { return dwIDMenu; };
    242          VOID   SetMenu(HMENU newMenu)              { dwIDMenu = newMenu; };
    243241         void   SetSysMenu(HMENU hSystemMenu)       { hSysMenu = hSystemMenu; };
    244242         HMENU  GetSysMenu()                        { return hSysMenu; }
  • trunk/src/user32/winaccel.cpp

    r6762 r7409  
    1 /* $Id: winaccel.cpp,v 1.9 2001-09-19 15:39:52 sandervl Exp $ */
     1/* $Id: winaccel.cpp,v 1.10 2001-11-21 11:51:39 sandervl Exp $ */
    22/*
    33 * Win32 accelerator key functions for OS/2
     
    9191                    }
    9292
    93                     hMenu = (window->getStyle() & WS_CHILD) ? 0 : (HMENU)window->GetMenu();
     93                    hMenu = GetMenu(hWnd);
    9494
    9595                    iSysStat = (window->GetSysMenu()) ? GetMenuState(GetSubMenu(window->GetSysMenu(), 0),
Note: See TracChangeset for help on using the changeset viewer.