Changeset 2857 for trunk/src/user32


Ignore:
Timestamp:
Feb 22, 2000, 6:07:43 PM (26 years ago)
Author:
cbratschi
Message:

WS_EX_CONTEXTHELP, activated some WINE code

Location:
trunk/src/user32
Files:
10 edited

Legend:

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

    r2804 r2857  
    1 /* $Id: loadres.cpp,v 1.23 2000-02-16 14:34:21 sandervl Exp $ */
     1/* $Id: loadres.cpp,v 1.24 2000-02-22 17:07:40 cbratschi Exp $ */
    22
    33/*
     
    2929#include <win\cursoricon.h>
    3030
    31 #define DBG_LOCALLOG    DBG_loadres
     31#define DBG_LOCALLOG    DBG_loadres
    3232#include "dbglocal.h"
    3333
     
    255255        case OBM_OLD_LFARROW:
    256256        case OBM_CHECK:
    257         case OBM_RADIOCHECK:
     257        case OBM_RADIOCHECK:
    258258        case OBM_CHECKBOXES:
    259259        case OBM_BTNCORNERS:
     
    270270        case OBM_RGARROWI:
    271271        case OBM_LFARROWI:
    272         case OBM_CLOSED:
     272        case OBM_CLOSED:
    273273        case OBM_OLD_CLOSE:
    274274        case OBM_BTSIZE:
     
    276276        case OBM_OLD_ZOOM:
    277277        case OBM_OLD_RESTORE:
     278        case OBM_CONTEXTHELP:
     279        case OBM_CONTEXTHELPD:
    278280                return TRUE;
    279281
     
    361363        }
    362364        else {
    363 //        if(fix_info->bmiHeader.biBitCount == 1) {
    364 //              hbitmap = CreateBitmap(fix_info->bmiHeader.biWidth,
     365//        if(fix_info->bmiHeader.biBitCount == 1) {
     366//              hbitmap = CreateBitmap(fix_info->bmiHeader.biWidth,
    365367//                                       fix_info->bmiHeader.biHeight,
    366 //                                       fix_info->bmiHeader.biPlanes, 
    367 //                                       fix_info->bmiHeader.biBitCount, 
     368//                                       fix_info->bmiHeader.biPlanes,
     369//                                       fix_info->bmiHeader.biBitCount,
    368370//                                       (PVOID)bits);
    369 //        }
    370 //        else {
    371                 hbitmap = CreateDIBitmap(hdc, &fix_info->bmiHeader, CBM_INIT,
     371//        }
     372//        else {
     373                hbitmap = CreateDIBitmap(hdc, &fix_info->bmiHeader, CBM_INIT,
    372374                                         bits, fix_info, DIB_RGB_COLORS );
    373 //        }
     375//        }
    374376        }
    375377        ReleaseDC( 0, hdc );
     
    384386//TODO: No support for RT_NEWBITMAP
    385387//******************************************************************************
    386 //******************************************************************************
    387 //TODO: No support for RT_NEWBITMAP
    388 //******************************************************************************
    389388HBITMAP WIN32API LoadBitmapA(HINSTANCE hinst, LPCSTR lpszBitmap)
    390389{
     
    395394    if(IsSystemBitmap((ULONG)lpszBitmap))
    396395    {
    397         hBitmap =  LoadBitmapA(hInstanceUser32, lpszBitmap, 0, 0, 0);
    398     } 
    399   } 
    400   if(!hBitmap) 
    401         hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
     396        hBitmap =  LoadBitmapA(hInstanceUser32, lpszBitmap, 0, 0, 0);
     397    }
     398  }
     399  if(!hBitmap)
     400        hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
    402401
    403402  dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
  • trunk/src/user32/syscolor.cpp

    r2804 r2857  
    1 /* $Id: syscolor.cpp,v 1.18 2000-02-16 14:34:35 sandervl Exp $ */
     1/* $Id: syscolor.cpp,v 1.19 2000-02-22 17:07:40 cbratschi Exp $ */
    22
    33/*
     
    1313 * Copyright  David W. Metcalfe, 1993
    1414 * Copyright  Alexandre Julliard, 1994
     15 * Copyright 1997 Bertho A. Stultiens
    1516 *
    1617 *
     
    2425#include "options.h"
    2526
    26 #define DBG_LOCALLOG    DBG_syscolor
     27#define DBG_LOCALLOG    DBG_syscolor
    2728#include "dbglocal.h"
    2829
     
    109110       (PALETTEINDEX(GetNearestPaletteIndex(STOCK_DEFAULT_PALETTE,(color))))
    110111
     112static const WORD wPattern55AA[] =
     113{
     114    0x5555, 0xaaaa, 0x5555, 0xaaaa,
     115    0x5555, 0xaaaa, 0x5555, 0xaaaa
     116};
     117
     118static HBRUSH  hPattern55AABrush = 0;
     119static HBITMAP hPattern55AABitmap = 0;
     120
    111121static void SYSCOLOR_SetColor( int index, COLORREF color )
    112122{
     
    277287  return USEWINCOLORS;
    278288}
     289/*********************************************************************
     290 *      CACHE_GetPattern55AABrush
     291 */
     292HBRUSH CACHE_GetPattern55AABrush(void)
     293{
     294    if (!hPattern55AABrush)
     295        hPattern55AABrush = CreatePatternBrush(CACHE_GetPattern55AABitmap());
     296    return hPattern55AABrush;
     297}
     298/*********************************************************************
     299 *      CACHE_GetPattern55AABitmap
     300 */
     301HBITMAP CACHE_GetPattern55AABitmap(void)
     302{
     303    if (!hPattern55AABitmap)
     304        hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
     305    return hPattern55AABitmap;
     306}
  • trunk/src/user32/syscolor.h

    r2469 r2857  
    1 /* $Id: syscolor.h,v 1.10 2000-01-18 20:08:13 sandervl Exp $ */
     1/* $Id: syscolor.h,v 1.11 2000-02-22 17:07:40 cbratschi Exp $ */
    22
    33/*
     
    2222extern BOOL SYSCOLOR_GetUseWinColors(VOID);
    2323
     24HBRUSH  CACHE_GetPattern55AABrush(void);
     25HBITMAP CACHE_GetPattern55AABitmap(void);
     26
    2427#endif  /* __WINE_SYSCOLOR_H */
  • trunk/src/user32/text.cpp

    r2804 r2857  
    1 /* $Id: text.cpp,v 1.7 2000-02-16 14:34:35 sandervl Exp $ */
     1/* $Id: text.cpp,v 1.8 2000-02-22 17:07:40 cbratschi Exp $ */
    22
    33/*
     
    66 * Copyright 1999 Christoph Bratschi
    77 *
    8  * Copyright 1997 Bertho A. Stultiens
    98 * Copyright 1993, 1994 Alexandre Julliard
    109 *
     
    1413#include "winuser.h"
    1514#include "user32.h"
     15#include "syscolor.h"
    1616
    17 #define DBG_LOCALLOG    DBG_text
     17#define DBG_LOCALLOG    DBG_text
    1818#include "dbglocal.h"
    1919
    2020//WINE parts: wine-991031
    21 
    22 static const WORD wPattern55AA[] =
    23 {
    24     0x5555, 0xaaaa, 0x5555, 0xaaaa,
    25     0x5555, 0xaaaa, 0x5555, 0xaaaa
    26 };
    27 
    28 static HBRUSH  hPattern55AABrush = 0;
    29 static HBITMAP hPattern55AABitmap = 0;
    30 
    31 /*********************************************************************
    32  *      CACHE_GetPattern55AABitmap
    33  */
    34 HBITMAP CACHE_GetPattern55AABitmap(void)
    35 {
    36     if (!hPattern55AABitmap)
    37         hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
    38     return hPattern55AABitmap;
    39 }
    40 
    41 /*********************************************************************
    42  *      CACHE_GetPattern55AABrush
    43  */
    44 HBRUSH CACHE_GetPattern55AABrush(void)
    45 {
    46     if (!hPattern55AABrush)
    47         hPattern55AABrush = CreatePatternBrush(CACHE_GetPattern55AABitmap());
    48     return hPattern55AABrush;
    49 }
    5021
    5122INT WIN32API DrawTextA(HDC hDC,LPCSTR lpString,INT nCount,PRECT lpRect,UINT nFormat)
     
    5627
    5728  if(nFormat == 0x828) {
    58         bla = 1;
     29        bla = 1;
    5930  }
    6031  return InternalDrawTextExA(hDC,lpString,nCount,lpRect,nFormat,NULL,FALSE);
  • trunk/src/user32/uitools.cpp

    r2852 r2857  
    1 /* $Id: uitools.cpp,v 1.24 2000-02-21 17:25:29 cbratschi Exp $ */
     1/* $Id: uitools.cpp,v 1.25 2000-02-22 17:07:40 cbratschi Exp $ */
    22/*
    33 * User Interface Functions
     
    1515#include "user32.h"
    1616#include "win32wbase.h"
     17#include "syscolor.h"
    1718
    1819#define DBG_LOCALLOG    DBG_uitools
    1920#include "dbglocal.h"
    20 
    21 static const WORD wPattern_AA55[8] = { 0xaaaa, 0x5555, 0xaaaa, 0x5555,
    22                                        0xaaaa, 0x5555, 0xaaaa, 0x5555 };
    2321
    2422/* These tables are used in:
     
    616614    if(GetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255))
    617615    {
    618       HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55);
     616      COLORREF bg;
    619617      HBRUSH hbsave;
    620       HBRUSH hb = CreatePatternBrush(hbm);
    621       COLORREF bg;
    622618
    623619      FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE));
    624620      bg = SetBkColor(dc, RGB(255, 255, 255));
    625       hbsave = (HBRUSH)SelectObject(dc, hb);
     621      hbsave = (HBRUSH)SelectObject(dc,CACHE_GetPattern55AABrush());
    626622      PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089);
    627623      SelectObject(dc, hbsave);
    628624      SetBkColor(dc, bg);
    629       DeleteObject(hb);
    630       DeleteObject(hbm);
    631625    }
    632626    else
     
    15291523    if(flags & (DSS_UNION|DSS_DISABLED))
    15301524    {
    1531         WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
    1532         HBITMAP hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
    1533         HBRUSH hPattern55AABrush = CreatePatternBrush(hPattern55AABitmap);
    1534 
    1535         hbsave = (HBRUSH)SelectObject(memdc, hPattern55AABrush);
     1525        hbsave = (HBRUSH)SelectObject(memdc,CACHE_GetPattern55AABrush());
    15361526        if(!hbsave) goto cleanup;
    15371527        tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089);
  • trunk/src/user32/user32.rc

    r2834 r2857  
    1 /* $Id: user32.rc,v 1.9 2000-02-20 18:28:34 cbratschi Exp $ */
     1/* $Id: user32.rc,v 1.10 2000-02-22 17:07:41 cbratschi Exp $ */
    22/* converted from WINE */
    33
     
    2828 /* Odin bitmaps */
    2929
    30 #define OBM_HELP            32730
    31 
    32 OBM_HELP BITMAP LOADONCALL DISCARDABLE
    33 {
    34         '42 4D C8 00 00 00 00 00 00 00 26 00 00 00 0C 00'
    35         '00 00 10 00 0E 00 01 00 04 00 C2 C2 C2 02 02 02'
    36         'FE FE FE 82 82 82 DE DE DE 00 00 00 00 00 00 00'
    37         '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    38         '00 00 00 00 00 00 00 00 00 00 11 11 11 11 11 11'
    39         '11 11 23 33 33 33 33 33 33 31 24 00 00 00 00 00'
    40         '00 31 24 00 00 01 10 00 00 31 24 00 00 01 10 00'
    41         '00 31 24 00 00 00 00 00 00 31 24 00 00 01 10 00'
    42         '00 31 24 00 00 01 10 00 00 31 24 00 00 00 11 00'
    43         '00 31 24 00 01 10 01 10 00 31 24 00 01 10 01 10'
    44         '00 31 24 00 00 11 11 00 00 31 24 44 44 44 44 44'
    45         '44 31 22 22 22 22 22 22 22 21 44 44 44 44 44 31'
    46         '22 22 22 22 22 22 22 21'
    47 }
    48 
    49 #define OBM_HELPD           32729
    50 
    51 OBM_HELPD BITMAP LOADONCALL DISCARDABLE
     30#define OBM_CONTEXTHELP            32730
     31
     32OBM_CONTEXTHELP BITMAP LOADONCALL DISCARDABLE
     33{
     34        '42 4D C8 00 00 00 00 00 00 00 26 00 00 00 0C 00'
     35        '00 00 10 00 0E 00 01 00 04 00 C2 C2 C2 02 02 02'
     36        'FE FE FE 82 82 82 DE DE DE 00 00 00 00 00 00 00'
     37        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     38        '00 00 00 00 00 00 00 00 00 00 11 11 11 11 11 11'
     39        '11 11 23 33 33 33 33 33 33 31 24 00 00 00 00 00'
     40        '00 31 24 00 00 01 10 00 00 31 24 00 00 01 10 00'
     41        '00 31 24 00 00 00 00 00 00 31 24 00 00 01 10 00'
     42        '00 31 24 00 00 01 10 00 00 31 24 00 00 00 11 00'
     43        '00 31 24 00 01 10 01 10 00 31 24 00 01 10 01 10'
     44        '00 31 24 00 00 11 11 00 00 31 24 44 44 44 44 44'
     45        '44 31 22 22 22 22 22 22 22 21 44 44 44 44 44 31'
     46        '22 22 22 22 22 22 22 21'
     47}
     48
     49#define OBM_CONTEXTHELPD           32729
     50
     51OBM_CONTEXTHELPD BITMAP LOADONCALL DISCARDABLE
    5252{
    5353        '42 4D C8 00 00 00 00 00 00 00 26 00 00 00 0C 00'
  • trunk/src/user32/win32dlg.cpp

    r2803 r2857  
    1 /* $Id: win32dlg.cpp,v 1.44 2000-02-16 14:28:22 sandervl Exp $ */
     1/* $Id: win32dlg.cpp,v 1.45 2000-02-22 17:07:41 cbratschi Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    2525#include "syscolor.h"
    2626
    27 #define DBG_LOCALLOG    DBG_win32dlg
     27#define DBG_LOCALLOG    DBG_win32dlg
    2828#include "dbglocal.h"
    2929
     
    162162    cs.cy             = rect.bottom;
    163163    cs.style          = dlgInfo.style & ~WS_VISIBLE;
     164
    164165    if(!isUnicode) {
    165166        if(dlgInfo.caption) {
     
    177178    }
    178179    cs.dwExStyle      = dlgInfo.exStyle;
     180    if (dlgInfo.style & DS_CONTEXTHELP) cs.dwExStyle |= WS_EX_CONTEXTHELP;
    179181
    180182    fIsDialog = TRUE;
  • trunk/src/user32/win32wbase.cpp

    r2852 r2857  
    1 /* $Id: win32wbase.cpp,v 1.166 2000-02-21 17:25:31 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.167 2000-02-22 17:07:42 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    12031203        SetBkColor( hdc, bk);
    12041204
    1205 //TODO?
    1206 #if 0
    12071205         /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
    12081206          * we better use 0x55aa bitmap brush to make scrollbar's background
     
    12121210             return CACHE_GetPattern55AABrush();
    12131211        }
    1214 #endif
     1212
    12151213        UnrealizeObject( hb );
    12161214        return (LRESULT)hb;
     
    17071705
    17081706    case WM_HELP:
    1709         if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam);
    1710         break;
     1707        if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam);
     1708        break;
    17111709
    17121710    case WM_NOTIFY:
  • trunk/src/user32/win32wbase.h

    r2852 r2857  
    1 /* $Id: win32wbase.h,v 1.84 2000-02-21 17:25:31 cbratschi Exp $ */
     1/* $Id: win32wbase.h,v 1.85 2000-02-22 17:07:43 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    384384        LONG  HandleWindowPosChanging(WINDOWPOS *winpos);
    385385        LONG  HandleNCActivate(WPARAM wParam);
    386         VOID  TrackMinMaxBox(WORD wParam);
     386        VOID  TrackMinMaxHelpBox(WORD wParam);
    387387        VOID  TrackCloseButton(WORD wParam);
    388388        VOID  TrackScrollBar(WPARAM wParam,POINT pt);
     
    404404        VOID  DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
    405405        VOID  DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
    406         VOID  DrawHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
     406        VOID  DrawContextHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed);
    407407        VOID  DrawCaption(HDC hdc,RECT *rect,BOOL active);
    408408        VOID  DoNCPaint(HRGN clip,BOOL suppress_menupaint);
  • trunk/src/user32/win32wbasenonclient.cpp

    r2852 r2857  
    1 /* $Id: win32wbasenonclient.cpp,v 1.13 2000-02-21 17:25:32 cbratschi Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.14 2000-02-22 17:07:43 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    4848
    4949static INT bitmapW = 16,bitmapH = 14;
    50 static HBITMAP hbitmapClose     = 0;
    51 static HBITMAP hbitmapCloseD    = 0;
    52 static HBITMAP hbitmapMinimize  = 0;
    53 static HBITMAP hbitmapMinimizeD = 0;
    54 static HBITMAP hbitmapMaximize  = 0;
    55 static HBITMAP hbitmapMaximizeD = 0;
    56 static HBITMAP hbitmapRestore   = 0;
    57 static HBITMAP hbitmapRestoreD  = 0;
    58 static HBITMAP hbitmapHelp      = 0;
    59 static HBITMAP hbitmapHelpD    = 0;
     50static HBITMAP hbitmapClose        = 0;
     51static HBITMAP hbitmapCloseD       = 0;
     52static HBITMAP hbitmapMinimize     = 0;
     53static HBITMAP hbitmapMinimizeD    = 0;
     54static HBITMAP hbitmapMaximize     = 0;
     55static HBITMAP hbitmapMaximizeD    = 0;
     56static HBITMAP hbitmapRestore      = 0;
     57static HBITMAP hbitmapRestoreD     = 0;
     58static HBITMAP hbitmapContextHelp  = 0;
     59static HBITMAP hbitmapContextHelpD = 0;
    6060
    6161BYTE lpGrayMask[] = { 0xAA, 0xA0,
     
    9696//******************************************************************************
    9797//******************************************************************************
    98 VOID Win32BaseWindow::TrackMinMaxBox(WORD wParam)
     98VOID Win32BaseWindow::TrackMinMaxHelpBox(WORD wParam)
    9999{
    100100  MSG msg;
     
    110110    /* Check if the sysmenu item for minimize is there  */
    111111    state = GetMenuState(hSysMenu,SC_MINIMIZE,MF_BYCOMMAND);
    112   } else
     112  } else if (wParam == HTMAXBUTTON)
    113113  {
    114114    /* If the style is not present, do nothing */
     
    117117    /* Check if the sysmenu item for maximize is there  */
    118118    state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
    119   }
     119  } else state = 0;
    120120  SetCapture(Win32Hwnd);
    121121  hdc = GetWindowDC(Win32Hwnd);
    122122  if (wParam == HTMINBUTTON)
    123123    DrawMinButton(hdc,NULL,TRUE,FALSE);
     124  else if (wParam == HTMAXBUTTON)
     125    DrawMaxButton(hdc,NULL,TRUE,FALSE);
    124126  else
    125     DrawMaxButton(hdc,NULL,TRUE,FALSE);
     127    DrawContextHelpButton(hdc,NULL,TRUE,FALSE);
    126128  do
    127129  {
     
    134136      if (wParam == HTMINBUTTON)
    135137        DrawMinButton(hdc,NULL,pressed,FALSE);
     138      else if (wParam == HTMAXBUTTON)
     139        DrawMaxButton(hdc,NULL,pressed,FALSE);
    136140      else
    137         DrawMaxButton(hdc,NULL,pressed,FALSE);
     141        DrawContextHelpButton(hdc,NULL,pressed,FALSE);
    138142    }
    139143  } while (msg.message != WM_LBUTTONUP);
    140144  if (wParam == HTMINBUTTON)
    141145    DrawMinButton(hdc,NULL,FALSE,FALSE);
     146  else if (wParam == HTMAXBUTTON)
     147    DrawMaxButton(hdc,NULL,FALSE,FALSE);
    142148  else
    143     DrawMaxButton(hdc,NULL,FALSE,FALSE);
     149    DrawContextHelpButton(hdc,NULL,FALSE,FALSE);
    144150  ReleaseCapture();
    145151  ReleaseDC(Win32Hwnd,hdc);
     
    148154  if ((!pressed) || (state == 0xFFFFFFFF))
    149155    return;
     156
    150157  if (wParam == HTMINBUTTON)
    151158    SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,*(LPARAM*)&msg.pt);
     159  else if (wParam == HTMAXBUTTON)
     160    SendInternalMessageA(WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt);
    152161  else
    153     SendInternalMessageA(WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt);
     162    SendInternalMessageA(WM_SYSCOMMAND,SC_CONTEXTHELP,*(LPARAM*)&msg.pt);
    154163}
    155164//******************************************************************************
     
    280289    case HTMINBUTTON:
    281290    case HTMAXBUTTON:
    282       TrackMinMaxBox(wParam);
     291    case HTHELP:
     292      TrackMinMaxHelpBox(wParam);
    283293      break;
    284294
     
    717727  if (dwExStyle & WS_EX_TOOLWINDOW)
    718728  {
    719     RECT toolRect;     
     729    RECT toolRect;
    720730    INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE   */
    721     INT iBmpWidth = 11;  /* it uses 11x11 for  the close button in tool window */               
     731    INT iBmpWidth = 11;  /* it uses 11x11 for  the close button in tool window */
    722732    INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION);
    723733
     
    826836//******************************************************************************
    827837//******************************************************************************
    828 VOID Win32BaseWindow::DrawHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
     838VOID Win32BaseWindow::DrawContextHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
    829839{
    830840  RECT r;
     
    837847
    838848  hdcMem = CreateCompatibleDC(hdc);
    839   hBmp = down ? hbitmapHelpD : hbitmapHelp;
     849  hBmp = down ? hbitmapContextHelpD : hbitmapContextHelp;
    840850  hOldBmp = SelectObject(hdcMem,hBmp);
    841851  GetObjectA(hBmp,sizeof(BITMAP),&bmp);
     
    915925  {
    916926    if (!(hbitmapClose = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSE)))) return;
    917     hbitmapCloseD    = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED));
    918     hbitmapMinimize  = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE));
    919     hbitmapMinimizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED));
    920     hbitmapMaximize  = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM));
    921     hbitmapMaximizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD));
    922     hbitmapRestore   = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE));
    923     hbitmapRestoreD  = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED));
    924     hbitmapHelp      = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_HELP));
    925     hbitmapHelpD     = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_HELPD));
     927    hbitmapCloseD       = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED));
     928    hbitmapMinimize     = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE));
     929    hbitmapMinimizeD    = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED));
     930    hbitmapMaximize     = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM));
     931    hbitmapMaximizeD    = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD));
     932    hbitmapRestore      = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE));
     933    hbitmapRestoreD     = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED));
     934    hbitmapContextHelp  = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CONTEXTHELP));
     935    hbitmapContextHelpD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CONTEXTHELPD));
    926936  }
    927937
     
    946956    if (dwExStyle & WS_EX_CONTEXTHELP)
    947957    {
    948       DrawHelpButton(memDC,&r2,FALSE,FALSE);
    949       r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     958      DrawContextHelpButton(memDC,&r2,FALSE,FALSE);
     959      r.right -= GetSystemMetrics(SM_CXSIZE)+1;
    950960    }
    951961
     
    10831093    r.top  = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
    10841094    FillRect( hdc, &r,  GetSysColorBrush(COLOR_SCROLLBAR) );
     1095    //CB: todo: child window have sometimes a size grip (i.e. Notepad)
     1096    //    WS_SIZEBOX isn't set in these cases
    10851097    if (!(dwStyle & WS_CHILD))
    10861098    {
     
    12801292        return SendInternalMessageA(WM_CLOSE,0,0);
    12811293
     1294    case SC_CONTEXTHELP:
     1295        {
     1296          //CB: todo
     1297          break;
     1298        }
     1299
    12821300    case SC_VSCROLL:
    12831301    case SC_HSCROLL:
     
    13361354 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    13371355 *****************************************************************************/
    1338 
    1339 BOOL WIN32API DrawCaption (HWND hwnd,
    1340                            HDC  hdc,
    1341                            const RECT *lprc,
    1342                            UINT wFlags)
    1343 {
    1344   dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    1345          hwnd,
    1346          hdc,
    1347          lprc,
    1348          wFlags));
    1349 
    1350   return FALSE;
     1356BOOL WIN32API DrawCaption (HWND hwnd,HDC  hdc,const RECT *lprc,UINT wFlags)
     1357{
     1358  dprintf(("USER32: DrawCaption"));
     1359
     1360  return DrawCaptionTempA(hwnd,hdc,lprc,0,0,NULL,wFlags & 0x1F);
     1361}
     1362//******************************************************************************
     1363// CB: this code is a subset of Win32BaseWindow::DrawCaption
     1364//     todo: move Win32BaseWindow:DrawCaption to this function
     1365//******************************************************************************
     1366BOOL WIN32API DrawCaptionTemp(HWND hwnd,HDC hdc,const RECT *rect,HFONT hFont,HICON hIcon,LPWSTR str,UINT uFlags,BOOL unicode)
     1367{
     1368  RECT rc = *rect;
     1369
     1370  /* drawing background */
     1371  if (uFlags & DC_INBUTTON)
     1372  {
     1373    FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE));
     1374
     1375    if (uFlags & DC_ACTIVE)
     1376    {
     1377      HBRUSH hbr = SelectObject (hdc, CACHE_GetPattern55AABrush ());
     1378      PatBlt (hdc, rc.left, rc.top,
     1379              rc.right-rc.left, rc.bottom-rc.top, 0xFA0089);
     1380      SelectObject (hdc, hbr);
     1381    }
     1382  } else
     1383  {
     1384    FillRect (hdc, &rc, GetSysColorBrush ((uFlags & DC_ACTIVE) ?
     1385              COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
     1386  }
     1387
     1388  /* drawing icon */
     1389  if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))
     1390  {
     1391    POINT pt;
     1392
     1393    pt.x = rc.left + 2;
     1394    pt.y = (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2;
     1395
     1396    if (hIcon)
     1397    {
     1398      DrawIconEx (hdc, pt.x, pt.y, hIcon, GetSystemMetrics(SM_CXSMICON),
     1399                  GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
     1400    } else
     1401    {
     1402      Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     1403
     1404      if (!win32wnd) return 0;
     1405
     1406      /* Get small icon. */
     1407      HICON hAppIcon = win32wnd->GetSmallIcon();
     1408
     1409      /* if no small icon and no large icon, use class small icon */
     1410      if (!hAppIcon && !win32wnd->GetIcon())
     1411        hAppIcon = (HICON) GetClassLongA(hwnd, GCL_HICONSM);
     1412
     1413      /* otherwise use the large icon it */
     1414      if (!hAppIcon) hAppIcon = win32wnd->GetIcon();
     1415
     1416      /* if all else fails, use the application icon. */
     1417      if(!hAppIcon) hAppIcon = (HICON) GetClassLongA(hwnd, GCL_HICON);
     1418
     1419      DrawIconEx (hdc, pt.x, pt.y, hAppIcon, GetSystemMetrics(SM_CXSMICON),
     1420                  GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
     1421    }
     1422
     1423    rc.left += (rc.bottom - rc.top);
     1424  }
     1425
     1426  /* drawing text */
     1427  if (uFlags & DC_TEXT)
     1428  {
     1429    HFONT hOldFont;
     1430
     1431    if (uFlags & DC_INBUTTON)
     1432      SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT));
     1433    else if (uFlags & DC_ACTIVE)
     1434      SetTextColor (hdc, GetSysColor (COLOR_CAPTIONTEXT));
     1435    else
     1436      SetTextColor (hdc, GetSysColor (COLOR_INACTIVECAPTIONTEXT));
     1437
     1438    SetBkMode (hdc, TRANSPARENT);
     1439
     1440    if (hFont)
     1441      hOldFont = SelectObject (hdc, hFont);
     1442    else
     1443    {
     1444      NONCLIENTMETRICSA nclm;
     1445      HFONT hNewFont;
     1446
     1447      nclm.cbSize = sizeof(NONCLIENTMETRICSA);
     1448      SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
     1449      hNewFont = CreateFontIndirectA ((uFlags & DC_SMALLCAP) ?
     1450        &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);
     1451      hOldFont = SelectObject (hdc, hNewFont);
     1452    }
     1453
     1454    if (str)
     1455    {
     1456      if (unicode)
     1457        DrawTextW(hdc,str,-1,&rc,DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
     1458      else
     1459        DrawTextA(hdc,(LPSTR)str,-1,&rc,DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
     1460    } else
     1461    {
     1462      CHAR szText[128];
     1463      INT nLen;
     1464
     1465      nLen = GetWindowTextA (hwnd, szText, 128);
     1466      DrawTextA (hdc, szText, nLen, &rc,
     1467                 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
     1468    }
     1469
     1470    if (hFont)
     1471      SelectObject (hdc, hOldFont);
     1472    else
     1473      DeleteObject (SelectObject (hdc, hOldFont));
     1474  }
     1475
     1476  /* drawing focus ??? */
     1477  //if (uFlags & 0x2000)
     1478  //  FIXME("undocumented flag (0x2000)!\n");
     1479
     1480  return 0;
    13511481}
    13521482/***********************************************************************
     
    13591489 *     Failure:
    13601490 */
    1361 
    1362 BOOL WIN32API DrawCaptionTempA(HWND       hwnd,
    1363                                HDC        hdc,
    1364                                const RECT *rect,
    1365                                HFONT      hFont,
    1366                                HICON      hIcon,
    1367                                LPCSTR     str,
    1368                                UINT       uFlags)
    1369 {
    1370   RECT   rc = *rect;
    1371 
    1372   dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
    1373            hwnd,
    1374            hdc,
    1375            rect,
    1376            hFont,
    1377            hIcon,
    1378            str,
    1379            uFlags));
    1380 
    1381   /* drawing background */
    1382   if (uFlags & DC_INBUTTON)
    1383   {
    1384     O32_FillRect (hdc,
    1385                   &rc,
    1386                   GetSysColorBrush (COLOR_3DFACE));
    1387 
    1388     if (uFlags & DC_ACTIVE)
    1389     {
    1390       HBRUSH hbr = O32_SelectObject (hdc,
    1391                                      GetSysColorBrush (COLOR_ACTIVECAPTION));
    1392       O32_PatBlt (hdc,
    1393                   rc.left,
    1394                   rc.top,
    1395                   rc.right - rc.left,
    1396                   rc.bottom - rc.top,
    1397                   0xFA0089);
    1398 
    1399       O32_SelectObject (hdc,
    1400                         hbr);
    1401     }
    1402   }
    1403   else
    1404   {
    1405     O32_FillRect (hdc,
    1406                   &rc,
    1407                   GetSysColorBrush ((uFlags & DC_ACTIVE) ?
    1408                     COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
    1409   }
    1410 
    1411 
    1412   /* drawing icon */
    1413   if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))
    1414   {
    1415     POINT pt;
    1416 
    1417     pt.x = rc.left + 2;
    1418     pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2;
    1419 
    1420     if (hIcon)
    1421     {
    1422       DrawIconEx (hdc,
    1423                   pt.x,
    1424                   pt.y,
    1425                   hIcon,
    1426                   O32_GetSystemMetrics(SM_CXSMICON),
    1427                   O32_GetSystemMetrics(SM_CYSMICON),
    1428                   0,
    1429                   0,
    1430                   DI_NORMAL);
    1431     }
    1432     else
    1433     {
    1434     /* @@@PH 1999/06/08 not ported yet, just don't draw any icon
    1435       WND *wndPtr = WIN_FindWndPtr(hwnd);
    1436       HICON hAppIcon = 0;
    1437 
    1438       if (wndPtr->class->hIconSm)
    1439         hAppIcon = wndPtr->class->hIconSm;
    1440       else
    1441         if (wndPtr->class->hIcon)
    1442           hAppIcon = wndPtr->class->hIcon;
    1443 
    1444       DrawIconEx (hdc,
    1445                   pt.x,
    1446                   pt.y,
    1447                   hAppIcon,
    1448                   GetSystemMetrics(SM_CXSMICON),
    1449                   GetSystemMetrics(SM_CYSMICON),
    1450                   0,
    1451                   0,
    1452                   DI_NORMAL);
    1453 
    1454       WIN_ReleaseWndPtr(wndPtr);
    1455       */
    1456     }
    1457 
    1458     rc.left += (rc.bottom - rc.top);
    1459   }
    1460 
    1461   /* drawing text */
    1462   if (uFlags & DC_TEXT)
    1463   {
    1464     HFONT hOldFont;
    1465 
    1466     if (uFlags & DC_INBUTTON)
    1467       O32_SetTextColor (hdc,
    1468                         O32_GetSysColor (COLOR_BTNTEXT));
    1469     else
    1470       if (uFlags & DC_ACTIVE)
    1471         O32_SetTextColor (hdc,
    1472                           O32_GetSysColor (COLOR_CAPTIONTEXT));
    1473       else
    1474         O32_SetTextColor (hdc,
    1475                           O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT));
    1476 
    1477     O32_SetBkMode (hdc,
    1478                    TRANSPARENT);
    1479 
    1480     if (hFont)
    1481       hOldFont = O32_SelectObject (hdc,
    1482                                    hFont);
    1483     else
    1484     {
    1485       NONCLIENTMETRICSA nclm;
    1486       HFONT             hNewFont;
    1487 
    1488       nclm.cbSize = sizeof(NONCLIENTMETRICSA);
    1489       O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS,
    1490                                 0,
    1491                                 &nclm,
    1492                                 0);
    1493       hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ?
    1494                                  &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);
    1495       hOldFont = O32_SelectObject (hdc,
    1496                                    hNewFont);
    1497     }
    1498 
    1499     if (str)
    1500       DrawTextA (hdc,
    1501                     str,
    1502                     -1,
    1503                     &rc,
    1504                     DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
    1505     else
    1506     {
    1507       CHAR szText[128];
    1508       INT  nLen;
    1509 
    1510       nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd),
    1511                                 szText,
    1512                                 128);
    1513 
    1514       DrawTextA (hdc,
    1515                     szText,
    1516                     nLen,
    1517                     &rc,
    1518                     DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
    1519     }
    1520 
    1521     if (hFont)
    1522       O32_SelectObject (hdc,
    1523                         hOldFont);
    1524     else
    1525       O32_DeleteObject (O32_SelectObject (hdc,
    1526                                           hOldFont));
    1527   }
    1528 
    1529   /* drawing focus ??? */
    1530   if (uFlags & 0x2000)
    1531   {
    1532     dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n"));
    1533   }
    1534 
    1535   return 0;
     1491BOOL WIN32API DrawCaptionTempA(HWND hwnd,HDC hdc,const RECT *rect,HFONT hFont,HICON hIcon,LPCSTR str,UINT uFlags)
     1492{
     1493  dprintf(("USER32: DrawCaptionTempA"));
     1494
     1495  return DrawCaptionTemp(hwnd,hdc,rect,hFont,hIcon,(LPWSTR)str,uFlags,FALSE);
    15361496}
    15371497/***********************************************************************
     
    15441504 *     Failure:
    15451505 */
    1546 
    1547 BOOL WIN32API DrawCaptionTempW (HWND       hwnd,
    1548                                 HDC        hdc,
    1549                                 const RECT *rect,
    1550                                 HFONT      hFont,
    1551                                 HICON      hIcon,
    1552                                 LPCWSTR    str,
    1553                                 UINT       uFlags)
    1554 {
    1555   LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str);
    1556 
    1557   BOOL res = DrawCaptionTempA (hwnd,
    1558                                hdc,
    1559                                rect,
    1560                                hFont,
    1561                                hIcon,
    1562                                strAscii,
    1563                                uFlags);
    1564 
    1565   FreeAsciiString(strAscii);
    1566 
    1567   return res;
    1568 }
    1569 
     1506BOOL WIN32API DrawCaptionTempW (HWND hwnd,HDC hdc,const RECT *rect,HFONT hFont,HICON hIcon,LPCWSTR str,UINT uFlags)
     1507{
     1508  dprintf(("USER32: DrawCaptionTempA"));
     1509
     1510  return DrawCaptionTemp(hwnd,hdc,rect,hFont,hIcon,(LPWSTR)str,uFlags,TRUE);
     1511}
     1512
Note: See TracChangeset for help on using the changeset viewer.