Changeset 2444 for trunk/src


Ignore:
Timestamp:
Jan 15, 2000, 3:18:18 PM (26 years ago)
Author:
cbratschi
Message:

several nc changes

Location:
trunk/src/user32/new
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/menu.cpp

    r2433 r2444  
    1 /* $Id: menu.cpp,v 1.9 2000-01-13 20:11:36 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.10 2000-01-15 14:18:16 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    10291029    //debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "");
    10301030
    1031     if (lpitem->fType & MF_SYSMENU)
    1032     {
    1033         if( !IsIconic(hwnd) )
    1034         {
    1035           Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    1036 
    1037           if (win32wnd) win32wnd->DrawSysButton(hdc,lpitem->fState & (MF_HILITE | MF_MOUSESELECT));
    1038         }
    1039 
    1040         return;
    1041     }
     1031    if (lpitem->fType & MF_SYSMENU) return;
    10421032
    10431033    if (lpitem->fType & MF_OWNERDRAW)
     
    10741064
    10751065    if ((lpitem->fState & MF_HILITE) && !(IS_BITMAP_ITEM(lpitem->fType)))
    1076         if (menuBar)
    1077             DrawEdge(hdc, &rect, BDR_SUNKENOUTER, BF_RECT);
    1078         else
    10791066            FillRect( hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT) );
    10801067    else {
     
    13851372    }
    13861373
    1387     FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
    1388 
    1389     SelectObject( hDC, GetSysColorPen(COLOR_3DFACE));
    1390     MoveToEx( hDC, lprect->left, lprect->bottom,NULL);
    1391     LineTo( hDC, lprect->right, lprect->bottom );
     1374    HDC memDC;
     1375    HBITMAP memBmp,oldBmp;
     1376    RECT r;
     1377    HFONT oldMemFont;
     1378
     1379    memDC = CreateCompatibleDC(hDC);
     1380    r = *lprect;
     1381    r.right -= r.left;
     1382    r.bottom -= r.top;
     1383    r.left = r.top = 0;
     1384    memBmp = CreateCompatibleBitmap(hDC,r.right,r.bottom+1);
     1385    oldBmp = SelectObject(memDC,memBmp);
     1386    oldMemFont = SelectObject(memDC,hMenuFont);
     1387
     1388    FillRect(memDC,&r,GetSysColorBrush(COLOR_MENU));
     1389
     1390    SelectObject(memDC,GetSysColorPen(COLOR_3DFACE));
     1391    MoveToEx(memDC,r.left,r.bottom,NULL);
     1392    LineTo(memDC,r.right,r.bottom);
    13921393
    13931394    if (lppop->nItems == 0)
    13941395    {
    1395         retvalue = GetSystemMetrics(SM_CYMENU);
    1396         goto END;
    1397     }
    1398 
    1399     for (i = 0; i < lppop->nItems; i++)
    1400     {
     1396      retvalue = GetSystemMetrics(SM_CYMENU);
     1397    } else
     1398    {
     1399      for (i = 0; i < lppop->nItems; i++)
     1400      {
     1401        OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top);
    14011402        MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER),
    1402                          hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
    1403     }
    1404     retvalue = lppop->Height;
     1403                         memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
     1404        OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top);
     1405      }
     1406      retvalue = lppop->Height;
     1407    }
     1408
     1409    BitBlt(hDC,lprect->left,lprect->top,lprect->right-lprect->left,lprect->bottom-lprect->top+1,memDC,0,0,SRCCOPY);
     1410    SelectObject(memDC,oldBmp);
     1411    if (oldMemFont) SelectObject(memDC,oldMemFont);
     1412    DeleteObject(memBmp);
     1413    DeleteDC(memDC);
    14051414
    14061415END:
     
    21032112 * Walks menu chain trying to find a menu pt maps to.
    21042113 */
    2105 static HMENU MENU_PtMenu( HMENU hMenu, POINT pt )
     2114static HMENU MENU_PtMenu(HMENU hMenu,POINT pt,BOOL inMenuBar)
    21062115{
    21072116   POPUPMENU *menu = (POPUPMENU*)hMenu;
     
    21122121          (menu->items[ht].fType & MF_POPUP) &&
    21132122          (menu->items[ht].fState & MF_MOUSESELECT))
    2114         ? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu, pt) : 0;
     2123        ? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu,pt,inMenuBar) : 0;
    21152124
    21162125   if( !ht )    /* check the current window (avoiding WM_HITTEST) */
     
    21262135        else
    21272136        {
    2128             ht = ( ht == HTSYSMENU ) ? (UINT)(getSysMenu(menu->hWnd))
    2129                  : ( ht == HTMENU ) ? (UINT)(getMenu(menu->hWnd)) : 0;
     2137            ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd))
     2138                 : ((ht == HTMENU) && inMenuBar) ? (UINT)(getMenu(menu->hWnd)) : 0;
    21302139        }
    21312140   }
     
    24022411        if( hNewWnd != pmt->hOwnerWnd )
    24032412        {
    2404             ReleaseCapture(); 
     2413            ReleaseCapture();
    24052414            pmt->hOwnerWnd = hNewWnd;
    2406             SetCapture(pmt->hOwnerWnd); //SvL: Don't know if this is good enough
     2415            SetCapture(pmt->hOwnerWnd); //SvL: Don't know if this is good enough
    24072416            //EVENT_Capture( pmt->hOwnerWnd, HTMENU ); //CB: todo
    24082417        }
     
    25682577 * Menu tracking code.
    25692578 */
    2570 static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
    2571                               HWND hwnd, const RECT *lprect )
     2579static INT MENU_TrackMenu(HMENU hmenu,UINT wFlags,INT x,INT y,HWND hwnd,BOOL inMenuBar,const RECT *lprect)
    25722580{
    25732581    MSG msg;
     
    26062614         * clear that menu loop is not over yet. */
    26072615//        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
    2608         //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo)
     2616        //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo)
    26092617        if (!GetMessageA(&msg,0,0,0)) break;
    26102618        TranslateMessage( &msg );
     
    26192627            /* Find a menu for this mouse event */
    26202628            POINT pt = msg.pt;
    2621             hmenu = MENU_PtMenu( mt.hTopMenu, pt );
     2629
     2630            hmenu = MENU_PtMenu(mt.hTopMenu,pt,inMenuBar);
    26222631
    26232632            switch(msg.message)
     
    28282837void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
    28292838{
    2830     HMENU hMenu = (ht == HTSYSMENU) ? getSysMenu(hWnd):getMenu(hWnd);
     2839    HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd);
    28312840    UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
    28322841
     
    28362845    {
    28372846        MENU_InitTracking( hWnd, hMenu, FALSE, wFlags );
    2838         MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd, NULL );
     2847        MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd,ht == 0, NULL );
    28392848        MENU_ExitTracking(hWnd);
    28402849    }
     
    28952904                PostMessageA( hWnd, WM_KEYDOWN, VK_DOWN, 0L );
    28962905
    2897             MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd, NULL );
     2906            MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd,TRUE, NULL );
    28982907        }
    28992908
     
    29242933
    29252934    if (MENU_ShowPopup( hWnd, hMenu, 0, x, y, 0, 0 ))
    2926         ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, lpRect );
     2935        ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd,FALSE, lpRect );
    29272936    MENU_ExitTracking(hWnd);
    29282937
     
    33113320
    33123321    if (IS_STRING_ITEM(flags) && str)
    3313         dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
     3322        dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
    33143323    //    TRACE("hMenu %04x, pos %d, flags %08x, "
    33153324    //                  "id %04x, str '%s'\n",
    33163325    //                  hMenu, pos, flags, id, str );
    33173326    else // TRACE("hMenu %04x, pos %d, flags %08x, "
    3318         dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str));
     3327        dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str));
    33193328    //                   "id %04x, str %08lx (not a string)\n",
    33203329    //                   hMenu, pos, flags, id, (DWORD)str );
     
    34453454    if (IS_STRING_ITEM(flags))
    34463455    {
    3447         dprintf(("USER32: ModifyMenuA, %x %d %x %d %s", hMenu, pos, flags, id, str));
     3456        dprintf(("USER32: ModifyMenuA, %x %d %x %d %s", hMenu, pos, flags, id, str));
    34483457        //TRACE("%04x %d %04x %04x '%s'\n",
    34493458        //              hMenu, pos, flags, id, str ? str : "#NULL#" );
     
    34523461    else
    34533462    {
    3454         dprintf(("USER32: ModifyMenuA, %x %d %x %d %x", hMenu, pos, flags, id, str));
     3463        dprintf(("USER32: ModifyMenuA, %x %d %x %d %x", hMenu, pos, flags, id, str));
    34553464        //TRACE("%04x %d %04x %04x %08lx\n",
    34563465        //              hMenu, pos, flags, id, (DWORD)str );
  • trunk/src/user32/new/oslibwin.cpp

    r2437 r2444  
    1 /* $Id: oslibwin.cpp,v 1.37 2000-01-14 14:45:16 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.38 2000-01-15 14:18:16 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    5151HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle,
    5252                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
    53                           ULONG id, BOOL fTaskList)
     53                          ULONG id, BOOL fTaskList,BOOL saveBits)
    5454{
    5555 HWND  hwndClient;
     
    7575
    7676  dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS);
     77  if (saveBits) dwWinStyle |= WS_SAVEBITS;
    7778
    7879  dwFrameStyle |= FCF_NOBYTEALIGN;
     
    9293
    9394  if (*hwndFrame) {
    94     hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
     95    hwndClient = WinCreateWindow (*hwndFrame,saveBits ? WIN32_STDCLASS:WIN32_STDCLASS2,
    9596                                  NULL, dwClientStyle, 0, 0, 0, 0,
    9697                                  *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
  • trunk/src/user32/new/oslibwin.h

    r2437 r2444  
    1 /* $Id: oslibwin.h,v 1.30 2000-01-14 14:45:16 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.31 2000-01-15 14:18:17 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3939HWND  OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle,
    4040                           char *pszName, HWND Owner, ULONG fBottom,
    41                            HWND *hwndFrame, ULONG id, BOOL fTaskList);
     41                           HWND *hwndFrame, ULONG id, BOOL fTaskList,BOOL saveBits);
    4242
    4343BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight);
  • trunk/src/user32/new/win32wbase.cpp

    r2440 r2444  
    1 /* $Id: win32wbase.cpp,v 1.42 2000-01-14 17:48:32 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.43 2000-01-15 14:18:17 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    530530                                 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    531531                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    532                                  &OS2HwndFrame, 0, fTaskList);
     532                                 &OS2HwndFrame, 0, fTaskList,windowClass->getStyle() & CS_SAVEBITS);
    533533  if(OS2Hwnd == 0) {
    534534        dprintf(("Window creation failed!!"));
     
    15041504
    15051505    case WM_NCRBUTTONUP:
     1506        return HandleNCRButtonUp(wParam,lParam);
     1507
    15061508    case WM_NCMBUTTONUP:
    15071509        return 0;
  • trunk/src/user32/new/win32wbase.h

    r2440 r2444  
    1 /* $Id: win32wbase.h,v 1.29 2000-01-14 17:48:33 cbratschi Exp $ */
     1/* $Id: win32wbase.h,v 1.30 2000-01-15 14:18:18 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    385385        LONG  HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
    386386        LONG  HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
     387        LONG  HandleNCRButtonUp(WPARAM wParam,LPARAM lParam);
    387388        BOOL  WindowNeedsWMBorder();
    388389        VOID  AdjustRectOuter(LPRECT rect,BOOL menu);
     
    393394public:
    394395        LONG  HandleNCHitTest(POINT pt);
    395         BOOL  DrawSysButton(HDC hdc,BOOL down);
    396396        BOOL  GetSysPopupPos(RECT* rect);
    397397private:
     398        BOOL  DrawSysButton(HDC hdc,RECT *rect);
    398399        BOOL  DrawGrayButton(HDC hdc,int x,int y);
    399         VOID  DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed);
    400         VOID  DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed);
    401         VOID  DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed);
     400        VOID  DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
     401        VOID  DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
     402        VOID  DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
    402403        VOID  DrawCaption(HDC hdc,RECT *rect,BOOL active,BOOL redrawText);
    403404        VOID  UpdateCaptionText();
  • trunk/src/user32/new/win32wbasenonclient.cpp

    r2440 r2444  
    1 /* $Id: win32wbasenonclient.cpp,v 1.7 2000-01-14 17:48:33 cbratschi Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.8 2000-01-15 14:18:18 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    7474  WORD wStateChange;
    7575
     76  //CB: only caption is changed on activation
     77  if (!(dwStyle & WS_CAPTION)) return TRUE;
     78
    7679  if( wParam ) wStateChange = !(flags & WIN_NCACTIVATED);
    7780  else wStateChange = flags & WIN_NCACTIVATED;
     
    115118  hdc = GetWindowDC(Win32Hwnd);
    116119  if (wParam == HTMINBUTTON)
    117     DrawMinButton(hdc,TRUE,FALSE);
     120    DrawMinButton(hdc,NULL,TRUE,FALSE);
    118121  else
    119     DrawMaxButton(hdc,TRUE,FALSE);
     122    DrawMaxButton(hdc,NULL,TRUE,FALSE);
    120123  do
    121124  {
     
    127130    {
    128131      if (wParam == HTMINBUTTON)
    129         DrawMinButton(hdc,pressed,FALSE);
     132        DrawMinButton(hdc,NULL,pressed,FALSE);
    130133      else
    131         DrawMaxButton(hdc,pressed,FALSE);
     134        DrawMaxButton(hdc,NULL,pressed,FALSE);
    132135    }
    133136  } while (msg.message != WM_LBUTTONUP);
    134137  if (wParam == HTMINBUTTON)
    135     DrawMinButton(hdc,FALSE,FALSE);
     138    DrawMinButton(hdc,NULL,FALSE,FALSE);
    136139  else
    137     DrawMaxButton(hdc,FALSE,FALSE);
     140    DrawMaxButton(hdc,NULL,FALSE,FALSE);
    138141  ReleaseCapture();
    139142  ReleaseDC(Win32Hwnd,hdc);
     
    164167  hdc = GetWindowDC(Win32Hwnd);
    165168  SetCapture(Win32Hwnd);
    166   DrawCloseButton(hdc,TRUE,FALSE);
     169  DrawCloseButton(hdc,NULL,TRUE,FALSE);
    167170  do
    168171  {
     
    172175    pressed = (HandleNCHitTest(msg.pt) == wParam);
    173176    if (pressed != oldstate)
    174       DrawCloseButton(hdc, pressed, FALSE);
     177      DrawCloseButton(hdc,NULL,pressed,FALSE);
    175178  } while (msg.message != WM_LBUTTONUP);
    176   DrawCloseButton(hdc,FALSE,FALSE);
     179  DrawCloseButton(hdc,NULL,FALSE,FALSE);
    177180  ReleaseCapture();
    178181  ReleaseDC(Win32Hwnd,hdc);
     
    244247      if(dwStyle & WS_SYSMENU )
    245248      {
    246         if( !(dwStyle & WS_MINIMIZE) )
    247         {
    248           HDC hDC = GetWindowDC(Win32Hwnd);
    249           DrawSysButton(hDC,TRUE);
    250           ReleaseDC(Win32Hwnd,hDC);
    251         }
    252249        SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
    253250      }
     
    606603//******************************************************************************
    607604//******************************************************************************
    608 BOOL Win32BaseWindow::DrawSysButton(HDC hdc,BOOL down)
     605BOOL Win32BaseWindow::DrawSysButton(HDC hdc,RECT *rect)
    609606{
    610607  if(!(flags & WIN_MANAGED))
    611608  {
    612609    HICON  hIcon;
    613     RECT rect;
    614 
    615     GetInsideRect(&rect);
     610    RECT r;
     611
     612    if (!rect) GetInsideRect(&r);
     613    else r = *rect;
    616614
    617615    hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
     
    625623
    626624    if (hIcon)
    627       DrawIconEx (hdc, rect.left + 2, rect.top + 2, hIcon,
    628                   GetSystemMetrics(SM_CXSMICON),
    629                   GetSystemMetrics(SM_CYSMICON),
    630                   0, 0, DI_NORMAL);
     625      DrawIconEx(hdc,r.left+2,r.top+2,hIcon,
     626                 GetSystemMetrics(SM_CXSMICON),
     627                 GetSystemMetrics(SM_CYSMICON),
     628                 0, 0, DI_NORMAL);
    631629
    632630    return (hIcon != 0);
     
    683681//******************************************************************************
    684682//******************************************************************************
    685 VOID Win32BaseWindow::DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed)
    686 {
    687   RECT rect;
     683VOID Win32BaseWindow::DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
     684{
     685  RECT r;
    688686  HDC hdcMem;
    689687
     
    693691    HBITMAP hBmp, hOldBmp;
    694692
    695     GetInsideRect(&rect);
     693    if (!rect) GetInsideRect(&r);
     694    else r = *rect;
    696695
    697696    hdcMem = CreateCompatibleDC( hdc );
     
    700699    GetObjectA (hBmp, sizeof(BITMAP), &bmp);
    701700
    702     BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
    703             rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     701    BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
     702            r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    704703            bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
    705704
    706705    if(bGrayed)
    707       DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
    708                      rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     706      DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
     707                     r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    709708
    710709    SelectObject (hdcMem, hOldBmp);
     
    714713//******************************************************************************
    715714//******************************************************************************
    716 VOID Win32BaseWindow::DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed)
    717 {
    718   RECT rect;
     715VOID Win32BaseWindow::DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
     716{
     717  RECT r;
    719718  HDC hdcMem;
    720719
     
    724723    HBITMAP  hBmp,hOldBmp;
    725724
    726     GetInsideRect(&rect);
     725    if (!rect) GetInsideRect(&r);
     726    else r = *rect;
    727727    hdcMem = CreateCompatibleDC( hdc );
    728728    hBmp = IsZoomed(Win32Hwnd) ?
     
    733733
    734734    if (dwStyle & WS_SYSMENU)
    735       rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    736 
    737     BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
    738           rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     735      r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
     736
     737    BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
     738          r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    739739          bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
    740740
    741741    if(bGrayed)
    742       DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
    743                       rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     742      DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
     743                      r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    744744
    745745
     
    750750//******************************************************************************
    751751//******************************************************************************
    752 VOID Win32BaseWindow::DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed)
    753 {
    754   RECT rect;
     752VOID Win32BaseWindow::DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
     753{
     754  RECT r;
    755755  HDC hdcMem;
    756756
     
    761761    HBITMAP  hBmp,hOldBmp;
    762762
    763     GetInsideRect(&rect);
     763    if (!rect) GetInsideRect(&r);
     764    else r = *rect;
    764765
    765766    hdcMem = CreateCompatibleDC( hdc );
     
    769770
    770771    if (dwStyle & WS_SYSMENU)
    771       rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
     772      r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    772773
    773774    /* In win 95 there is always a Maximize box when there is a Minimize one */
    774775    if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
    775       rect.right += -1 - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2;
    776 
    777     BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
    778           rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     776      r.right -= bmp.bmWidth;
     777
     778    BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
     779          r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    779780          bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
    780781
    781782    if(bGrayed)
    782       DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
    783                       rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     783      DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
     784                      r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    784785
    785786
     
    793794VOID Win32BaseWindow::DrawCaption(HDC hdc,RECT *rect,BOOL active,BOOL redrawText)
    794795{
    795   RECT  r = *rect;
     796  RECT  r = *rect,r2;
    796797  char  buffer[256];
    797798  HPEN  hPrevPen;
     799  HDC memDC;
     800  HBITMAP memBmp,oldBmp;
    798801
    799802  if (flags & WIN_MANAGED) return;
    800803
    801   hPrevPen = SelectObject( hdc, GetSysColorPen(COLOR_3DFACE) );
    802   MoveToEx( hdc, r.left, r.bottom - 1, NULL );
    803   LineTo( hdc, r.right, r.bottom - 1 );
    804   SelectObject( hdc, hPrevPen );
     804  memDC = CreateCompatibleDC(hdc);
     805  r.right -= r.left;
     806  r.bottom -= r.top;
     807  r.left = r.top = 0;
     808  r2 = r;
     809  memBmp = CreateCompatibleBitmap(hdc,r.right,r.bottom);
     810  oldBmp = SelectObject(memDC,memBmp);
     811
     812  hPrevPen = SelectObject(memDC,GetSysColorPen(COLOR_3DFACE));
     813  MoveToEx(memDC,r.left,r.bottom-1,NULL);
     814  LineTo(memDC,r.right,r.bottom-1);
     815  SelectObject(memDC,hPrevPen);
    805816  r.bottom--;
    806817
     
    810821
    811822    if (startColor == endColor)
    812       FillRect(hdc,&r,GetSysColorBrush(startColor));
     823      FillRect(memDC,&r,GetSysColorBrush(startColor));
    813824    else
    814825    {
     
    831842        r2.left = r2.right;
    832843        r2.right = r.left+w*x/steps;
    833         FillRect(hdc,&r2,brush);
     844        FillRect(memDC,&r2,brush);
    834845        DeleteObject(brush);
    835846      }
    836847    }
    837   } else FillRect(hdc,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
     848  } else FillRect(memDC,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
    838849
    839850  if (!hbitmapClose)
     
    851862  if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
    852863  {
    853     if (redrawText || DrawSysButton(hdc,FALSE))
     864    if (redrawText || DrawSysButton(memDC,&r))
    854865      r.left += GetSystemMetrics(SM_CYCAPTION) - 1;
    855866  }
     
    865876
    866877      /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
    867       DrawCloseButton(hdc, FALSE,
     878      DrawCloseButton(memDC,&r2,FALSE,
    868879                      ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
    869880    }
     
    876887
    877888      if (!redrawText)
    878         DrawMaxButton(hdc, FALSE, (!(dwStyle & WS_MAXIMIZEBOX)));
     889        DrawMaxButton(memDC,&r2,FALSE,(!(dwStyle & WS_MAXIMIZEBOX)));
    879890      r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    880891
    881892      if (!redrawText)
    882         DrawMinButton(hdc, FALSE,  (!(dwStyle & WS_MINIMIZEBOX)));
     893        DrawMinButton(memDC,&r2,FALSE,  (!(dwStyle & WS_MINIMIZEBOX)));
    883894      r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    884895    }
     
    889900    NONCLIENTMETRICSA nclm;
    890901    HFONT hFont, hOldFont;
     902
    891903    nclm.cbSize = sizeof(NONCLIENTMETRICSA);
    892904    SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
     
    895907    else
    896908      hFont = CreateFontIndirectA (&nclm.lfCaptionFont);
    897     hOldFont = SelectObject (hdc, hFont);
    898     SetTextColor(hdc,GetSysColor(active ? COLOR_CAPTIONTEXT:COLOR_INACTIVECAPTIONTEXT));
    899     SetBkMode( hdc, TRANSPARENT );
     909    hOldFont = SelectObject (memDC, hFont);
     910    SetTextColor(memDC,GetSysColor(active ? COLOR_CAPTIONTEXT:COLOR_INACTIVECAPTIONTEXT));
     911    SetBkMode(memDC, TRANSPARENT );
    900912    r.left += 2;
    901     DrawTextA( hdc, buffer, -1, &r,
     913    DrawTextA(memDC, buffer, -1, &r,
    902914             DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
    903     DeleteObject (SelectObject (hdc, hOldFont));
    904   }
     915    DeleteObject (SelectObject (memDC, hOldFont));
     916  }
     917
     918  BitBlt(hdc,rect->left,rect->top,rect->right-rect->left,rect->bottom-rect->top,memDC,0,0,SRCCOPY);
     919  SelectObject(memDC,oldBmp);
     920  DeleteObject(memBmp);
     921  DeleteDC(memDC);
    905922}
    906923//******************************************************************************
     
    10541071    r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
    10551072
    1056     rect.top += MENU_DrawMenuBar( hdc, &r, Win32Hwnd, suppress_menupaint ) + 1;
     1073    rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1;
    10571074  }
    10581075
     
    11681185  return 0;
    11691186}
     1187//******************************************************************************
     1188//******************************************************************************
     1189LONG Win32BaseWindow::HandleNCRButtonUp(WPARAM wParam,LPARAM lParam)
     1190{
     1191  if (wParam == HTCAPTION)
     1192  {
     1193    if (GetActiveWindow() != Win32Hwnd)
     1194        SetActiveWindow();
     1195
     1196    if ((GetActiveWindow() == Win32Hwnd) && (dwStyle & WS_SYSMENU))
     1197    {
     1198      SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
     1199    }
     1200  }
     1201
     1202  return 0;
     1203}
    11701204/***********************************************************************
    11711205 *           NC_HandleSysCommand
     
    11731207 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
    11741208 *
    1175  * TODO: Not done (see #if 0)
    11761209 */
    11771210LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam,POINT *pt32)
     
    11791212    UINT uCommand = wParam & 0xFFF0;
    11801213
    1181 /* //CB: don't need this, perhaps recycle for menus
    1182     if ((getStyle() & WS_CHILD) && (uCommand != SC_KEYMENU))
    1183         ScreenToClient(getParent()->getWindowHandle(), pt32 );
    1184 */
    11851214    switch (uCommand)
    11861215    {
  • trunk/src/user32/new/winprop.cpp

    r2290 r2444  
    1 /* $Id: winprop.cpp,v 1.3 2000-01-01 14:57:39 cbratschi Exp $ */
     1/* $Id: winprop.cpp,v 1.4 2000-01-15 14:18:18 cbratschi Exp $ */
    22/*
    33 * Win32 Property apis for OS/2
     
    4343{
    4444#ifdef DEBUG
    45     WriteLog("USER32:  EnumPropsExW\n");
     45    WriteLog("USER32:  EnumPropsExW DOES NOT WORK\n");
    4646#endif
    4747    // NOTE: This will not work as is (needs UNICODE support)
     
    5555{
    5656#ifdef DEBUG
    57     WriteLog("USER32:  EnumPropsW\n");
     57    WriteLog("USER32:  EnumPropsW DOES NOT WORK\n");
    5858#endif
    5959    // NOTE: This will not work as is (needs UNICODE support)
     
    7272    if(!window) {
    7373        dprintf(("GetPropA, window %x not found", hwnd));
    74         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     74        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    7575        return 0;
    7676    }
     
    109109    if(!window) {
    110110        dprintf(("RemovePropA, window %x not found", hwnd));
    111         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     111        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    112112        return 0;
    113113    }
     
    145145    if(!window) {
    146146        dprintf(("SetPropA, window %x not found", hwnd));
    147         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     147        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    148148        return 0;
    149149    }
Note: See TracChangeset for help on using the changeset viewer.