Changeset 327 for trunk/src


Ignore:
Timestamp:
Jul 18, 1999, 3:57:48 PM (26 years ago)
Author:
cbratschi
Message:

API Open32 -> PM

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

Legend:

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

    r325 r327  
    1 /* $Id: oslibwin.cpp,v 1.10 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.11 1999-07-18 13:57:47 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    4646
    4747  if(pszName && *pszName == 0) {
    48         pszName = NULL;
     48        pszName = NULL;
    4949  }
    5050  if(hwndParent == 0) {
     
    5353  if(dwFrameStyle) {
    5454        dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs
    55         if(pszName)
    56                 dwFrameStyle |= FCF_TITLEBAR;
     55        if(pszName)
     56                dwFrameStyle |= FCF_TITLEBAR;
    5757
    5858        *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
     
    6060                                       "", 0, 0, 0, &hwndClient);
    6161        if(*hwndFrame) {
    62                 if(pszName) {
    63                         WinSetWindowText(*hwndFrame, pszName);
    64                 }
     62                if(pszName) {
     63                        WinSetWindowText(*hwndFrame, pszName);
     64                }
    6565                return hwndClient;
    6666        }
     
    161161//******************************************************************************
    162162//******************************************************************************
     163HWND OSLibWinQueryFocus(HWND hwndDeskTop)
     164{
     165  return WinQueryFocus(hwndDeskTop);
     166}
     167//******************************************************************************
     168//******************************************************************************
     169HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
     170{
     171  return WinWindowFromID(hwndParent,id);
     172}
     173//******************************************************************************
     174//******************************************************************************
     175BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus)
     176{
     177  return WinSetFocus(hwndDeskTop,hwndNewFocus);
     178}
     179//******************************************************************************
     180//******************************************************************************
     181ULONG OSLibGetWindowHeight(HWND hwnd)
     182{
     183  RECTL rect;
     184
     185  return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
     186}
     187//******************************************************************************
     188//******************************************************************************
     189BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren)
     190{
     191  return WinInvalidateRect(hwnd,(PRECTL)pwrc,fIncludeChildren);
     192}
     193//******************************************************************************
     194//******************************************************************************
     195LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
     196{
     197  return WinQuerySysValue(hwndDeskTop,iSysValue);
     198}
     199//******************************************************************************
     200//******************************************************************************
     201ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
     202{
     203  return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
     204}
     205//******************************************************************************
     206//******************************************************************************
     207BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
     208{
     209  return WinSetDlgItemText(hwndDlg,idItem,pszText);
     210}
     211//******************************************************************************
     212//******************************************************************************
     213BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
     214{
     215  return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
     216}
    163217//******************************************************************************
    164218//******************************************************************************
     
    173227{
    174228  if(fl & SWP_MOVE) {
    175         y = MapOS2ToWin32Y(hwnd, cy, y);
     229        y = MapOS2ToWin32Y(hwnd, cy, y);
    176230  }
    177231  dprintf(("WinSetWindowPos %x %x %d %d %d %d %x", hwnd, hwndInsertBehind, x, y, cx, cy, fl));
     
    185239
    186240  if(fl & SWP_SHOW) {
    187         rc = WinShowWindow(hwnd, TRUE);
     241        rc = WinShowWindow(hwnd, TRUE);
    188242  }
    189243  if(rc == 0)
    190         dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
     244        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
    191245  rc = WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, fl);
    192246  if(rc == 0)
    193         dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
     247        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
    194248  return rc;
    195249}
     
    202256//******************************************************************************
    203257//******************************************************************************
    204 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect)
    205 {
    206  BOOL rc;
    207  RECTLOS2 rectl;
    208 
    209   rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
    210   if(rc) {
    211         MapOS2ToWin32Rectl(hwnd, &rectl, pRect);
    212   }
    213   return rc;
     258BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect)
     259{
     260  return WinQueryUpdateRect(hwnd, (PRECTL)pRect);
     261  //CB: caller must convert rect
    214262}
    215263//******************************************************************************
  • trunk/src/user32/new/oslibwin.h

    r325 r327  
    1 /* $Id: oslibwin.h,v 1.9 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.10 1999-07-18 13:57:47 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    2929HWND  OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate);
    3030
    31 #define WA_WARNING                 0
    32 #define WA_NOTE                    1
    33 #define WA_ERROR                   2
    34 #define WA_CWINALARMS             13     /* count of valid alarms     53304*/
     31#define WAOS_WARNING                 0
     32#define WAOS_NOTE                    1
     33#define WAOS_ERROR                   2
     34#define WAOS_CWINALARMS             13     /* count of valid alarms     53304*/
    3535
    3636BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle);
    3737ULONG OSLibDosBeep(ULONG freg,ULONG dur);
     38HWND OSLibWinQueryFocus(HWND hwndDeskTop);
     39HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id);
     40BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus);
     41ULONG OSLibGetWindowHeight(HWND hwnd); //for point transformation
     42
     43typedef struct _OSRECTL
     44{
     45  LONG xLeft;
     46  LONG yBottom;
     47  LONG xRight;
     48  LONG yTop;
     49} OSRECTL;
     50
     51typedef OSRECTL *POSRECTL;
     52
     53BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren); //must be RECTL pointer!
     54
     55//reserved deleted
     56
     57#define SVOS_SWAPBUTTON              0
     58#define SVOS_DBLCLKTIME              1
     59#define SVOS_CXDBLCLK                2
     60#define SVOS_CYDBLCLK                3
     61#define SVOS_CXSIZEBORDER            4
     62#define SVOS_CYSIZEBORDER            5
     63#define SVOS_ALARM                   6
     64#define SVOS_CURSORRATE              9
     65#define SVOS_FIRSTSCROLLRATE         10
     66#define SVOS_SCROLLRATE              11
     67#define SVOS_NUMBEREDLISTS           12
     68#define SVOS_WARNINGFREQ             13
     69#define SVOS_NOTEFREQ                14
     70#define SVOS_ERRORFREQ               15
     71#define SVOS_WARNINGDURATION         16
     72#define SVOS_NOTEDURATION            17
     73#define SVOS_ERRORDURATION           18
     74#define SVOS_CXSCREEN                20
     75#define SVOS_CYSCREEN                21
     76#define SVOS_CXVSCROLL               22
     77#define SVOS_CYHSCROLL               23
     78#define SVOS_CYVSCROLLARROW          24
     79#define SVOS_CXHSCROLLARROW          25
     80#define SVOS_CXBORDER                26
     81#define SVOS_CYBORDER                27
     82#define SVOS_CXDLGFRAME              28
     83#define SVOS_CYDLGFRAME              29
     84#define SVOS_CYTITLEBAR              30
     85#define SVOS_CYVSLIDER               31
     86#define SVOS_CXHSLIDER               32
     87#define SVOS_CXMINMAXBUTTON          33
     88#define SVOS_CYMINMAXBUTTON          34
     89#define SVOS_CYMENU                  35
     90#define SVOS_CXFULLSCREEN            36
     91#define SVOS_CYFULLSCREEN            37
     92#define SVOS_CXICON                  38
     93#define SVOS_CYICON                  39
     94#define SVOS_CXPOINTER               40
     95#define SVOS_CYPOINTER               41
     96#define SVOS_DEBUG                   42
     97#define SVOS_CMOUSEBUTTONS           43
     98#define SVOS_CPOINTERBUTTONS         43
     99#define SVOS_POINTERLEVEL            44
     100#define SVOS_CURSORLEVEL             45
     101#define SVOS_TRACKRECTLEVEL          46
     102#define SVOS_CTIMERS                 47
     103#define SVOS_MOUSEPRESENT            48
     104#define SVOS_CXBYTEALIGN             49
     105#define SVOS_CXALIGN                 49
     106#define SVOS_CYBYTEALIGN             50
     107#define SVOS_CYALIGN                 50
     108
     109/* The following value enables any greater value to be set by WinSetSysValue. */
     110/* This is to enable the setting of SV_EXTRAKEYBEEP by applications.          */
     111
     112#define SVOS_NOTRESERVED             56
     113#define SVOS_EXTRAKEYBEEP            57
     114
     115/* The following system value controls whether PM controls the keyboard      */
     116/* lights for light key keystrokes (else applications will)                  */
     117#define SVOS_SETLIGHTS               58
     118#define SVOS_INSERTMODE              59
     119
     120#define SVOS_MENUROLLDOWNDELAY       64
     121#define SVOS_MENUROLLUPDELAY         65
     122#define SVOS_ALTMNEMONIC             66
     123#define SVOS_TASKLISTMOUSEACCESS     67
     124#define SVOS_CXICONTEXTWIDTH         68
     125#define SVOS_CICONTEXTLINES          69
     126#define SVOS_CHORDTIME               70
     127#define SVOS_CXCHORD                 71
     128#define SVOS_CYCHORD                 72
     129#define SVOS_CXMOTIONSTART           73
     130#define SVOS_CYMOTIONSTART           74
     131#define SVOS_BEGINDRAG               75
     132#define SVOS_ENDDRAG                 76
     133#define SVOS_SINGLESELECT            77
     134#define SVOS_OPEN                    78
     135#define SVOS_CONTEXTMENU             79
     136#define SVOS_CONTEXTHELP             80
     137#define SVOS_TEXTEDIT                81
     138#define SVOS_BEGINSELECT             82
     139#define SVOS_ENDSELECT               83
     140#define SVOS_BEGINDRAGKB             84
     141#define SVOS_ENDDRAGKB               85
     142#define SVOS_SELECTKB                86
     143#define SVOS_OPENKB                  87
     144#define SVOS_CONTEXTMENUKB           88
     145#define SVOS_CONTEXTHELPKB           89
     146#define SVOS_TEXTEDITKB              90
     147#define SVOS_BEGINSELECTKB           91
     148#define SVOS_ENDSELECTKB             92
     149#define SVOS_ANIMATION               93
     150#define SVOS_ANIMATIONSPEED          94
     151#define SVOS_MONOICONS               95
     152#define SVOS_KBDALTERED              96
     153#define SVOS_PRINTSCREEN             97
     154#define SVOS_LOCKSTARTINPUT          98
     155#define SVOS_CSYSVALUES              108
     156
     157LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue);
     158ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer);
     159BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText);
     160BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint); //pptlPoint == POINTL pointer!
    38161
    39162#define SWPOS_SIZE                   0x0001
     
    61184
    62185BOOL  OSLibWinDestroyWindow(HWND hwnd);
    63 BOOL  OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect);
     186BOOL  OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect); //must be RECTL pointer!
    64187BOOL  OSLibWinIsIconic(HWND hwnd);
    65188BOOL  OSLibWinSetActiveWindow(HWND hwnd);
  • trunk/src/user32/new/user32.cpp

    r325 r327  
    1 /* $Id: user32.cpp,v 1.5 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.6 1999-07-18 13:57:47 cbratschi Exp $ */
    22
    33/*
     
    1919 *****************************************************************************/
    2020
     21/*
     22  CB:
     23  - don't replace GDI functions (hdc), only convert window handle
     24  - always use OSRECTL for PM functions
     25  - POINT == POINTL
     26*/
     27
    2128#include <os2win.h>
    2229#include "misc.h"
     
    3138#include <string.h>
    3239#include <oslibwin.h>
     40#include <win32wnd.h>
    3341
    3442//undocumented stuff
     
    6977// WIN32API YieldTask
    7078
    71 
    72 
     79//Window handle transformation
     80
     81inline HWND Win32ToOS2Handle(HWND hwnd)
     82{
     83  Win32Window *window;
     84
     85  window = Win32Window::GetWindowFromHandle(hwnd);
     86  if (window) return window->getOS2WindowHandle();
     87  else return hwnd; //already OS/2 handle?
     88}
     89
     90inline HWND OS2ToWin32Handle(HWND hwnd)
     91{
     92  Win32Window *window;
     93
     94  window = Win32Window::GetWindowFromOS2Handle(hwnd);
     95  if (window) return window->getWindowHandle();
     96  else return hwnd; //OS/2 window
     97}
     98
     99//Coordinate transformation
     100
     101inline void Win32ToOS2Rect(POSRECTL dest,PRECT source,ULONG windowH)
     102{
     103  dest->xLeft   = source->left;
     104  dest->xRight  = source->right;
     105  dest->yTop    = windowH-source->top;
     106  dest->yBottom = windowH-source->bottom;
     107}
     108
     109inline void OS2ToWin32Rect(PRECT dest,POSRECTL source,ULONG windowH)
     110{
     111  dest->left   = source->xLeft;
     112  dest->right  = source->xRight;
     113  dest->top    = windowH-source->yTop;
     114  dest->bottom = windowH-source->yBottom;
     115}
     116
     117inline void OS2ToWin32ScreenPos(POINT *dest,POINT *source)
     118{
     119  dest->x = source->x;
     120  dest->y = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN)-source->y;
     121}
     122
     123inline void Win32ToOS2ScreenPos(POINT *dest,POINT *source)
     124{
     125  OS2ToWin32ScreenPos(dest,source); //transform back
     126}
    73127
    74128//******************************************************************************
     
    185239//******************************************************************************
    186240//******************************************************************************
    187 BOOL WIN32API MessageBeep( UINT arg1)
     241BOOL WIN32API MessageBeep( UINT uType)
    188242{
    189243    INT flStyle;
     
    193247#endif
    194248
    195     switch (arg1)
     249    switch (uType)
    196250    {
    197251      case 0xFFFFFFFF:
     
    199253        return TRUE;
    200254      case MB_ICONASTERISK:
    201         flStyle = WA_NOTE;
     255        flStyle = WAOS_NOTE;
    202256        break;
    203257      case MB_ICONEXCLAMATION:
    204         flStyle = WA_WARNING;
     258        flStyle = WAOS_WARNING;
    205259        break;
    206260      case MB_ICONHAND:
    207261      case MB_ICONQUESTION:
    208262      case MB_OK:
    209         flStyle = WA_NOTE;
     263        flStyle = WAOS_NOTE;
    210264        break;
    211265      default:
    212         flStyle = WA_ERROR; //CB: should be right
     266        flStyle = WAOS_ERROR; //CB: should be right
    213267        break;
    214268    }
    215     return OSLibWinAlarm(HWND_DESKTOP,flStyle);
    216 }
     269    return OSLibWinAlarm(OSLIB_HWND_DESKTOP,flStyle);
     270}
     271//******************************************************************************
    217272//******************************************************************************
    218273
     
    231286    return GetWindowTextW(hwnd,lpString,nMaxCount);
    232287}
    233 
    234 
    235 //******************************************************************************
    236288//******************************************************************************
    237289//******************************************************************************
    238290HWND WIN32API GetFocus(void)
    239291{
     292    HWND hwnd;
    240293//    dprintf(("USER32:  GetFocus\n"));
    241     //return OS2LibWinQueryFocus(HWND_DESKTOP);
    242     return O32_GetFocus();
     294
     295    hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
     296    return OS2ToWin32Handle(hwnd);
    243297}
    244298//******************************************************************************
     
    247301{
    248302    dprintf(("USER32:  GetDesktopWindow\n"));
    249     //return HWND_DESKTOP //CB: WinQueryDesktopWindow();, hab and hdc not available!
    250     return O32_GetDesktopWindow();
     303    return OSLIB_HWND_DESKTOP;
    251304}
    252305//******************************************************************************
     
    258311
    259312  dprintf(("USER32:  EnumThreadWindows\n"));
    260   //replace
     313  //CB: replace
    261314  rc = O32_EnumThreadWindows(dwThreadId, callback->GetOS2Callback(), (LPARAM)callback);
    262315  if(callback)
     
    271324////    WriteLog("USER32:  OffsetRect\n");
    272325#endif
    273     //CB: inc values
    274326    if (lprc)
    275327    {
     
    295347//******************************************************************************
    296348//******************************************************************************
    297 HWND WIN32API SetFocus( HWND arg1)
    298 {
     349HWND WIN32API SetFocus( HWND hwnd)
     350{
     351    HWND lastFocus;
     352
    299353    dprintf(("USER32:  SetFocus\n"));
    300     //return OSLibWinSetFocus(HWND_DESKTOP,arg1);
    301     return O32_SetFocus(arg1);
    302 }
    303 //******************************************************************************
    304 //******************************************************************************
    305 BOOL WIN32API InvalidateRect(HWND arg1, const RECT *arg2, BOOL arg3)
    306 {
    307 #ifdef DEBUG
    308     if(arg2)
    309         WriteLog("USER32:  InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", arg1, arg2->left, arg2->top, arg2->right, arg2->bottom, arg3);
    310     else    WriteLog("USER32:  InvalidateRect for window %X NULL, %d\n", arg1, arg3);
    311 #endif
    312     //return OSLibWinInvalidateRect(arg1,arg2,arg3);
    313     return O32_InvalidateRect(arg1, arg2, arg3);
    314 }
    315 //******************************************************************************
    316 //******************************************************************************
    317 BOOL WIN32API GetUpdateRect( HWND arg1, PRECT arg2, BOOL  arg3)
    318 {
     354
     355    lastFocus = GetFocus();
     356    hwnd = Win32ToOS2Handle(hwnd);
     357    return (OSLibWinSetFocus(OSLIB_HWND_DESKTOP,hwnd)) ? lastFocus:0;
     358}
     359//******************************************************************************
     360//******************************************************************************
     361BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
     362{
     363#ifdef DEBUG
     364    if(lpRect)
     365        WriteLog("USER32:  InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
     366    else    WriteLog("USER32:  InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
     367#endif
     368
     369    //CB: bErase no quite the same
     370    hWnd = Win32ToOS2Handle(hWnd);
     371    if (lpRect)
     372    {
     373      OSRECTL rect;
     374      ULONG windowH;
     375
     376      windowH = OSLibGetWindowHeight(hWnd);
     377      Win32ToOS2Rect(&rect,(PRECT)lpRect,windowH);
     378      return OSLibWinInvalidateRect(hWnd,&rect,bErase); //rect == RECTL
     379    } else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
     380}
     381//******************************************************************************
     382//******************************************************************************
     383BOOL WIN32API GetUpdateRect( HWND hWnd, PRECT lpRect, BOOL  bErase)
     384{
     385    OSRECTL rect;
     386    ULONG windowH;
     387    BOOL rc;
     388
    319389#ifdef DEBUG
    320390    WriteLog("USER32:  GetUpdateRect\n");
    321391#endif
    322     // OSLibWinQueryUpdateRect(arg1,arg2);
    323     // translate top,bottom
    324     return O32_GetUpdateRect(arg1, arg2, arg3);
    325 }
    326 //******************************************************************************
    327 //******************************************************************************
    328 //******************************************************************************
    329 //******************************************************************************
    330 int WIN32API GetSystemMetrics(int arg1)
    331 {
    332  int rc;
    333 
    334    switch(arg1) {
     392    if (!lpRect) return FALSE;
     393    hWnd = Win32ToOS2Handle(hWnd);
     394    rc = OSLibWinQueryUpdateRect(hWnd,&rect);
     395    windowH = OSLibGetWindowHeight(hWnd);
     396    OS2ToWin32Rect(lpRect,&rect,windowH);
     397    return rc;
     398}
     399//******************************************************************************
     400//******************************************************************************
     401int WIN32API GetSystemMetrics(int nIndex)
     402{
     403   int rc = 0;
     404
     405   switch(nIndex) {
    335406    case SM_CXICONSPACING: //TODO: size of grid cell for large icons
    336         //rc = OSLibWinQuerySysValue(HWND_DESKTOP,SV_CXICON);
    337         //CB: better: return standard windows icon size
    338         rc = 32;
     407        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXICON);
     408        //CB: return standard windows icon size?
     409        //rc = 32;
    339410        break;
    340411    case SM_CYICONSPACING:
     412        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYICON);
    341413        //read SM_CXICONSPACING comment
    342         rc = 32;
     414        //rc = 32;
    343415        break;
    344416    case SM_PENWINDOWS:
     
    355427        break;
    356428    case SM_CXMINSPACING: //can be SM_CXMINIMIZED or larger
     429        //CB: replace with const
    357430        rc = O32_GetSystemMetrics(SM_CXMINIMIZED);
    358431        break;
    359432    case SM_CYMINSPACING:
     433        //CB: replace with const
    360434        rc = GetSystemMetrics(SM_CYMINIMIZED);
    361435        break;
     
    390464    case SM_CXMAXTRACK: //max window size
    391465    case SM_CXMAXIMIZED:    //max toplevel window size
    392         rc = O32_GetSystemMetrics(SM_CXSCREEN);
     466        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXSCREEN);
    393467        break;
    394468    case SM_CYMAXTRACK:
    395469    case SM_CYMAXIMIZED:
    396         rc = O32_GetSystemMetrics(SM_CYSCREEN);
     470        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN);
    397471        break;
    398472    case SM_NETWORK:
     
    415489        break;
    416490    case SM_CYMENUCHECK:
    417         rc = O32_GetSystemMetrics(SM_CYMENU);
     491        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYMENU);
    418492        break;
    419493    case SM_SLOWMACHINE:
     
    424498        break;
    425499    case SM_CMETRICS:
     500        //CB: replace with const
    426501        rc = O32_GetSystemMetrics(44);  //Open32 changed this one
    427502        break;
    428503    default:
    429         rc = O32_GetSystemMetrics(arg1);
     504        //better than nothing
     505        rc = O32_GetSystemMetrics(nIndex);
    430506        break;
    431507    }
    432508#ifdef DEBUG
    433     WriteLog("USER32:  GetSystemMetrics %d returned %d\n", arg1, rc);
     509    WriteLog("USER32:  GetSystemMetrics %d returned %d\n", nIndex, rc);
    434510#endif
    435511    return(rc);
     
    437513//******************************************************************************
    438514//******************************************************************************
    439 UINT WIN32API SetTimer( HWND arg1, UINT arg2, UINT arg3, TIMERPROC  arg4)
     515UINT WIN32API SetTimer( HWND hwnd, UINT idTimer, UINT uTimeout, TIMERPROC  tmprc)
    440516{
    441517#ifdef DEBUG
    442518    WriteLog("USER32: SetTimer INCORRECT CALLING CONVENTION FOR HANDLER!!!!!\n");
    443519#endif
     520    hwnd = Win32ToOS2Handle(hwnd);
    444521    //SvL: Write callback handler class for this one
    445     return O32_SetTimer(arg1, arg2, arg3, (TIMERPROC_O32)arg4);
    446 }
    447 //******************************************************************************
    448 //******************************************************************************
    449 BOOL WIN32API KillTimer(HWND arg1, UINT arg2)
     522    //CB: replace
     523    return O32_SetTimer(hwnd,idTimer,uTimeout,(TIMERPROC_O32)tmprc);
     524}
     525//******************************************************************************
     526//******************************************************************************
     527BOOL WIN32API KillTimer(HWND hWnd, UINT uIDEvent)
    450528{
    451529#ifdef DEBUG
    452530    WriteLog("USER32:  KillTimer\n");
    453531#endif
     532    hWnd = Win32ToOS2Handle(hWnd);
    454533    //WinStopTimer
    455     return O32_KillTimer(arg1, arg2);
    456 }
    457 //******************************************************************************
    458 //******************************************************************************
    459 BOOL WIN32API InflateRect( PRECT arg1, int arg2, int  arg3)
     534    //CB: replace
     535    return O32_KillTimer(hWnd,uIDEvent);
     536}
     537//******************************************************************************
     538//******************************************************************************
     539BOOL WIN32API InflateRect( PRECT lprc, int dx, int  dy)
    460540{
    461541#ifdef DEBUG
    462542    WriteLog("USER32:  InflateRect\n");
    463543#endif
    464     //don't know how Win32 handles this
    465     return O32_InflateRect(arg1, arg2, arg3);
     544    if (!lprc) return FALSE;
     545    //right?
     546    lprc->left   -= dx;
     547    lprc->right  += dx;
     548    lprc->top    -= dy;
     549    lprc->bottom += dy;
     550
     551    return TRUE;
    466552}
    467553//******************************************************************************
     
    486572    WriteLog("USER32:  ShowCursor\n");
    487573#endif
    488     //WinShowCursor(HWND_DESKTOP,arg1); //not the same
     574    //WinShowCursor(OSLIB_HWND_DESKTOP,arg1); //CB: not the same
    489575    return O32_ShowCursor(arg1);
    490576}
     
    497583#endif
    498584
     585    if (!lprc) return FALSE;
    499586    lprc->left   = nLeft;
    500587    lprc->top    = nTop;
     
    506593//******************************************************************************
    507594//******************************************************************************
    508 BOOL WIN32API WinHelpA( HWND arg1, LPCSTR arg2, UINT arg3, DWORD  arg4)
    509 {
    510 #ifdef DEBUG
    511     WriteLog("USER32:  WinHelp not implemented %s\n", arg2);
    512 #endif
     595BOOL WIN32API WinHelpA( HWND hwnd, LPCSTR lpszHelp, UINT uCommand, DWORD  dwData)
     596{
     597#ifdef DEBUG
     598    WriteLog("USER32:  WinHelp not implemented %s\n", lpszHelp);
     599#endif
     600//    hwnd = Win32ToOS2Handle(hwnd);
    513601//    return O32_WinHelp(arg1, arg2, arg3, arg4);
     602
    514603    return(TRUE);
    515604}
    516605//******************************************************************************
    517606//******************************************************************************
    518 int WIN32API TranslateAcceleratorA(HWND arg1, HACCEL arg2, LPMSG  arg3)
     607int WIN32API TranslateAcceleratorA(HWND hwnd, HACCEL haccel, LPMSG  lpmsg)
    519608{
    520609#ifdef DEBUG
    521610////    WriteLog("USER32:  TranslateAccelerator\n");
    522611#endif
     612    //CB: needs more work
    523613    //WinTranslateAccel();
    524614    //get hab, translate
    525     return O32_TranslateAccelerator(arg1, arg2, arg3);
    526 }
    527 //******************************************************************************
    528 //******************************************************************************
    529 BOOL WIN32API SubtractRect( PRECT arg1, const RECT * arg2, const RECT * arg3)
     615    hwnd = Win32ToOS2Handle(hwnd);
     616    return O32_TranslateAccelerator(hwnd,haccel,lpmsg);
     617}
     618//******************************************************************************
     619//******************************************************************************
     620BOOL WIN32API SubtractRect( PRECT lprcDest, const RECT * lprcSrc1, const RECT * lprcSrc2)
    530621{
    531622#ifdef DEBUG
    532623    WriteLog("USER32:  SubtractRect");
    533624#endif
    534     // how?
    535     return O32_SubtractRect(arg1, arg2, arg3);
     625    //CB: how?
     626    return O32_SubtractRect(lprcDest,lprcSrc1,lprcSrc2);
    536627}
    537628//******************************************************************************
    538629//SvL: 24-6-'97 - Added
    539630//******************************************************************************
    540 BOOL WIN32API ClipCursor(const RECT * arg1)
     631BOOL WIN32API ClipCursor(const RECT * lpRect)
    541632{
    542633#ifdef DEBUG
    543634    WriteLog("USER32:  ClipCursor\n");
    544635#endif
    545     return O32_ClipCursor(arg1);
     636    //CB: how to replace?
     637    return O32_ClipCursor(lpRect);
    546638}
    547639//******************************************************************************
     
    569661//SvL: 24-6-'97 - Added
    570662//******************************************************************************
    571 BOOL WIN32API GetCursorPos( PPOINT arg1)
    572 {
     663BOOL WIN32API GetCursorPos( PPOINT lpPoint)
     664{
     665    BOOL rc;
     666    POINT point;
    573667#ifdef DEBUG
    574668////    WriteLog("USER32:  GetCursorPos\n");
    575669#endif
    576     return O32_GetCursorPos(arg1);
     670    if (!lpPoint) return FALSE;
     671    if (OSLibWinQueryPointerPos(OSLIB_HWND_DESKTOP,&point)) //POINT == POINTL
     672    {
     673      OS2ToWin32ScreenPos(lpPoint,&point);
     674      return TRUE;
     675    } else return FALSE;
    577676}
    578677//******************************************************************************
    579678//SvL: 24-6-'97 - Added
    580679//******************************************************************************
    581 WORD WIN32API VkKeyScanA( char arg1)
     680WORD WIN32API VkKeyScanA( char ch)
    582681{
    583682#ifdef DEBUG
    584683    WriteLog("USER32:  VkKeyScanA\n");
    585684#endif
    586     return O32_VkKeyScan(arg1);
     685    return O32_VkKeyScan(ch);
    587686}
    588687//******************************************************************************
    589688//SvL: 24-6-'97 - Added
    590689//******************************************************************************
    591 SHORT WIN32API GetKeyState( int arg1)
    592 {
    593 #ifdef DEBUG
    594     WriteLog("USER32:  GetKeyState %d\n", arg1);
    595 #endif
    596     return O32_GetKeyState(arg1);
    597 }
    598 //******************************************************************************
    599 //******************************************************************************
    600 HCURSOR WIN32API SetCursor( HCURSOR arg1)
     690SHORT WIN32API GetKeyState( int nVirtKey)
     691{
     692#ifdef DEBUG
     693    WriteLog("USER32:  GetKeyState %d\n", nVirtKey);
     694#endif
     695    return O32_GetKeyState(nVirtKey);
     696}
     697//******************************************************************************
     698//******************************************************************************
     699HCURSOR WIN32API SetCursor( HCURSOR hcur)
    601700{
    602701#ifdef DEBUG
    603702    WriteLog("USER32:  SetCursor\n");
    604703#endif
    605     return O32_SetCursor(arg1);
     704    return O32_SetCursor(hcur);
    606705}
    607706//******************************************************************************
     
    612711    WriteLog("USER32:  SetCursorPos\n");
    613712#endif
     713//CB:{a} stopped here
    614714    return O32_SetCursorPos(arg1, arg2);
    615715}
     
    621721    WriteLog("USER32:  EnableScrollBar\n");
    622722#endif
     723    //CB: implement in window class
    623724    return O32_EnableScrollBar(arg1, arg2, arg3);
    624725}
  • trunk/src/user32/new/win32wnd.cpp

    r325 r327  
    1 /* $Id: win32wnd.cpp,v 1.9 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.10 1999-07-18 13:57:48 cbratschi Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    124124  if (cs->hwndParent)
    125125  {
    126         Win32Window *window = GetWindowFromHandle(cs->hwndParent);
    127         if(!window) {
     126        Win32Window *window = GetWindowFromHandle(cs->hwndParent);
     127        if(!window) {
    128128                dprintf(("Bad parent %04x\n", cs->hwndParent ));
    129129                SetLastError(ERROR_INVALID_PARAMETER);
    130                 return FALSE;
    131         }
     130                return FALSE;
     131        }
    132132        /* Make sure parent is valid */
    133133        if (!window->IsWindow() )
     
    231231  if ((cs->style & WS_CHILD) && cs->hwndParent)
    232232  {
    233         SetParent(cs->hwndParent);
     233        SetParent(cs->hwndParent);
    234234  }
    235235  else
     
    240240        else
    241241        {
    242                 owner = GetWindowFromHandle(cs->hwndParent);
     242                owner = GetWindowFromHandle(cs->hwndParent);
    243243                if(owner == NULL)
    244244                {
     
    263263    if (HOOK_IsHooked( WH_CBT ))
    264264    {
    265         CBT_CREATEWNDA cbtc;
     265        CBT_CREATEWNDA cbtc;
    266266        LRESULT ret;
    267267
    268         cbtc.lpcs = cs;
    269         cbtc.hwndInsertAfter = hwndLinkAfter;
     268        cbtc.lpcs = cs;
     269        cbtc.hwndInsertAfter = hwndLinkAfter;
    270270        ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc)
    271271                      : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc);
    272272        if (ret)
    273         {
    274             TRACE_(win)("CBT-hook returned 0\n");
    275             wndPtr->pDriver->pFinalize(wndPtr);
     273        {
     274            TRACE_(win)("CBT-hook returned 0\n");
     275            wndPtr->pDriver->pFinalize(wndPtr);
    276276            retvalue =  0;
    277277            goto end;
    278         }
     278        }
    279279    }
    280280#endif
     
    337337                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
    338338                                 (owner) ? owner->getOS2WindowHandle() : 0,
    339                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     339                                (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    340340                                 &OS2HwndFrame);
    341341
     
    354354#if 0
    355355  if(OS2Hwnd != OS2HwndFrame) {
    356         if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    357                 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
    358                 return FALSE;
    359         }
    360         if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    361                 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
    362                 return FALSE;
    363         }
     356        if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     357                dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
     358                return FALSE;
     359        }
     360        if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
     361                dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
     362                return FALSE;
     363        }
    364364  }
    365365#endif
     
    378378  else  windowId = (UINT)cs->hMenu;
    379379
    380   /* Send the WM_CREATE message 
    381    * Perhaps we shouldn't allow width/height changes as well. 
    382    * See p327 in "Internals". 
     380  /* Send the WM_CREATE message
     381   * Perhaps we shouldn't allow width/height changes as well.
     382   * See p327 in "Internals".
    383383   */
    384384  maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
     
    389389        OffsetRect(&rectWindow, maxPos.x - rectWindow.left,
    390390                                          maxPos.y - rectWindow.top);
    391         dprintf(("Sending WM_CREATE"));
     391        dprintf(("Sending WM_CREATE"));
    392392        if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
    393393        {
    394394            SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
    395                          rectClient.right-rectClient.left,
    396                         rectClient.bottom-rectClient.top,
    397                         SWP_NOACTIVATE);
     395                         rectClient.right-rectClient.left,
     396                        rectClient.bottom-rectClient.top,
     397                        SWP_NOACTIVATE);
    398398
    399399            if (cs->style & WS_VISIBLE) ShowWindow( sw );
     
    405405                HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
    406406#endif
    407             return TRUE;
     407            return TRUE;
    408408        }
    409409  }
     
    429429    if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))
    430430    {
    431         if( dwStyle & WS_MINIMIZE )
    432         {
    433             if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
    434                 return (SWP_NOSIZE | SWP_NOMOVE);
    435             swpFlags |= SWP_NOCOPYBITS;
    436         }
    437         switch( cmd )
    438         {
    439             case SW_MINIMIZE:
    440                 if( dwStyle & WS_MAXIMIZE)
    441                 {
    442                      flags |= WIN_RESTORE_MAX;
    443                      dwStyle &= ~WS_MAXIMIZE;
     431        if( dwStyle & WS_MINIMIZE )
     432        {
     433            if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
     434                return (SWP_NOSIZE | SWP_NOMOVE);
     435            swpFlags |= SWP_NOCOPYBITS;
     436        }
     437        switch( cmd )
     438        {
     439            case SW_MINIMIZE:
     440                if( dwStyle & WS_MAXIMIZE)
     441                {
     442                     flags |= WIN_RESTORE_MAX;
     443                     dwStyle &= ~WS_MAXIMIZE;
    444444                 }
    445445                 else
    446                      flags &= ~WIN_RESTORE_MAX;
    447                 dwStyle |= WS_MINIMIZE;
     446                     flags &= ~WIN_RESTORE_MAX;
     447                dwStyle |= WS_MINIMIZE;
    448448
    449449#if 0
    450                 if( flags & WIN_NATIVE )
    451                      if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
    452                         swpFlags |= MINMAX_NOSWP;
     450                if( flags & WIN_NATIVE )
     451                     if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
     452                        swpFlags |= MINMAX_NOSWP;
    453453#endif
    454454
    455                 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
    456 
    457                 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
    458                         GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
    459                 swpFlags |= SWP_NOCOPYBITS;
    460                 break;
    461 
    462             case SW_MAXIMIZE:
     455                lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
     456
     457                SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
     458                        GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
     459                swpFlags |= SWP_NOCOPYBITS;
     460                break;
     461
     462            case SW_MAXIMIZE:
    463463                CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
    464464                WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
    465465                CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
    466466
    467                 if( dwStyle & WS_MINIMIZE )
    468                 {
    469                      if( flags & WIN_NATIVE )
    470                         if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
    471                              swpFlags |= MINMAX_NOSWP;
    472 
    473                      WINPOS_ShowIconTitle( wndPtr, FALSE );
    474                      dwStyle &= ~WS_MINIMIZE;
    475                 }
     467                if( dwStyle & WS_MINIMIZE )
     468                {
     469                     if( flags & WIN_NATIVE )
     470                        if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
     471                             swpFlags |= MINMAX_NOSWP;
     472
     473                     WINPOS_ShowIconTitle( wndPtr, FALSE );
     474                     dwStyle &= ~WS_MINIMIZE;
     475                }
    476476                 dwStyle |= WS_MAXIMIZE;
    477477
    478                 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
    479                                     size.x, size.y );
    480                 break;
    481 
    482             case SW_RESTORE:
    483                 if( dwStyle & WS_MINIMIZE )
    484                 {
    485                      if( flags & WIN_NATIVE )
    486                         if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
    487                              swpFlags |= MINMAX_NOSWP;
    488 
    489                      dwStyle &= ~WS_MINIMIZE;
    490                      WINPOS_ShowIconTitle( wndPtr, FALSE );
    491 
    492                      if( flags & WIN_RESTORE_MAX)
    493                      {
    494                         /* Restore to maximized position */
     478                SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
     479                                    size.x, size.y );
     480                break;
     481
     482            case SW_RESTORE:
     483                if( dwStyle & WS_MINIMIZE )
     484                {
     485                     if( flags & WIN_NATIVE )
     486                        if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
     487                             swpFlags |= MINMAX_NOSWP;
     488
     489                     dwStyle &= ~WS_MINIMIZE;
     490                     WINPOS_ShowIconTitle( wndPtr, FALSE );
     491
     492                     if( flags & WIN_RESTORE_MAX)
     493                     {
     494                        /* Restore to maximized position */
    495495                         CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
    496496                         WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);
    497497                         CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
    498                         dwStyle |= WS_MAXIMIZE;
    499                         SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
    500                         break;
    501                      }
    502                  }
    503                  else
    504                      if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
    505                      else dwStyle &= ~WS_MAXIMIZE;
    506 
    507                 /* Restore to normal position */
    508 
    509                 *lpRect = lpPos->rectNormal;
    510                  lpRect->right -= lpRect->left;
    511                 lpRect->bottom -= lpRect->top;
    512 
    513                 break;
    514         }
     498                        dwStyle |= WS_MAXIMIZE;
     499                        SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
     500                        break;
     501                     }
     502                 }
     503                 else
     504                     if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
     505                     else dwStyle &= ~WS_MAXIMIZE;
     506
     507                /* Restore to normal position */
     508
     509                *lpRect = lpPos->rectNormal;
     510                 lpRect->right -= lpRect->left;
     511                lpRect->bottom -= lpRect->top;
     512
     513                break;
     514        }
    515515    } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
    516516    return swpFlags;
     
    611611   {
    612612        winposCopy = *winpos;
    613         params.rgrc[1] = *oldWindowRect;
    614         params.rgrc[2] = *oldClientRect;
    615         params.lppos = &winposCopy;
     613        params.rgrc[1] = *oldWindowRect;
     614        params.rgrc[2] = *oldClientRect;
     615        params.lppos = &winposCopy;
    616616   }
    617617   result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect,
     
    752752{
    753753  if(isUnicode) {
    754         return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
    755   }
    756   else  return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
     754        return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
     755  }
     756  else  return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
    757757}
    758758//******************************************************************************
     
    843843{
    844844  if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
     845
    845846        dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
    846847
     
    928929  postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
    929930  if(postmsg == NULL) {
    930         dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
    931         return 0;
     931        dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
     932        return 0;
    932933  }
    933934  postmsg->Msg    = msg;
     
    944945  postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
    945946  if(postmsg == NULL) {
    946         dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
    947         return 0;
     947        dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
     948        return 0;
    948949  }
    949950  postmsg->Msg    = msg;
     
    984985 PVOID menutemplate;
    985986
    986    if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR) 
     987   if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR)
    987988   {
    988         OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
    989         if(OS2HwndMenu == 0) {
    990                 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
    991                 return FALSE;
    992         }
     989        OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
     990        if(OS2HwndMenu == 0) {
     991                dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
     992                return FALSE;
     993        }
    993994   }
    994995   dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu));
     
    10041005  switch(nCmdShow)
    10051006  {
    1006         case SW_SHOW:
    1007         case SW_SHOWDEFAULT: //todo
    1008                 showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
    1009                 break;
    1010         case SW_HIDE:
    1011                 showstate = SWPOS_HIDE;
    1012                 break;
    1013         case SW_RESTORE:
    1014                 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
    1015                 break;
    1016         case SW_MINIMIZE:
    1017                 showstate = SWPOS_MINIMIZE;
    1018                 break;
    1019         case SW_SHOWMAXIMIZED:
    1020                 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
    1021                 break;
    1022         case SW_SHOWMINIMIZED:
    1023                 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
    1024                 break;
    1025         case SW_SHOWMINNOACTIVE:
    1026                 showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
    1027                 break;
    1028         case SW_SHOWNA:
    1029                 showstate = SWPOS_SHOW;
    1030                 break;
    1031         case SW_SHOWNOACTIVATE:
    1032                 showstate = SWPOS_SHOW;
    1033                 break;
    1034         case SW_SHOWNORMAL:
    1035                 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
    1036                 break;
     1007        case SW_SHOW:
     1008        case SW_SHOWDEFAULT: //todo
     1009                showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
     1010                break;
     1011        case SW_HIDE:
     1012                showstate = SWPOS_HIDE;
     1013                break;
     1014        case SW_RESTORE:
     1015                showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
     1016                break;
     1017        case SW_MINIMIZE:
     1018                showstate = SWPOS_MINIMIZE;
     1019                break;
     1020        case SW_SHOWMAXIMIZED:
     1021                showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
     1022                break;
     1023        case SW_SHOWMINIMIZED:
     1024                showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
     1025                break;
     1026        case SW_SHOWMINNOACTIVE:
     1027                showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
     1028                break;
     1029        case SW_SHOWNA:
     1030                showstate = SWPOS_SHOW;
     1031                break;
     1032        case SW_SHOWNOACTIVATE:
     1033                showstate = SWPOS_SHOW;
     1034                break;
     1035        case SW_SHOWNORMAL:
     1036                showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
     1037                break;
    10371038  }
    10381039  return OSLibWinShowWindow(OS2HwndFrame, showstate);
     
    10461047
    10471048  switch(hwndInsertAfter) {
    1048         case HWND_BOTTOM:
    1049                 hwndInsertAfter = HWNDOS_BOTTOM;
    1050                 break;
    1051         case HWND_TOPMOST: //TODO:
    1052         case HWND_NOTOPMOST: //TODO:
    1053         case HWND_TOP:
    1054                 hwndInsertAfter = HWNDOS_TOP;
    1055                 break;
    1056         default:
    1057                 window = GetWindowFromHandle(hwndInsertAfter);
    1058                 if(window) {
    1059                         hwndInsertAfter = window->getOS2WindowHandle();
    1060                 }
    1061                 else {
    1062                         dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter));
    1063                         hwndInsertAfter = 0;
    1064                 }
    1065                 break;
    1066                
     1049        case HWND_BOTTOM:
     1050                hwndInsertAfter = HWNDOS_BOTTOM;
     1051                break;
     1052        case HWND_TOPMOST: //TODO:
     1053        case HWND_NOTOPMOST: //TODO:
     1054        case HWND_TOP:
     1055                hwndInsertAfter = HWNDOS_TOP;
     1056                break;
     1057        default:
     1058                window = GetWindowFromHandle(hwndInsertAfter);
     1059                if(window) {
     1060                        hwndInsertAfter = window->getOS2WindowHandle();
     1061                }
     1062                else {
     1063                        dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter));
     1064                        hwndInsertAfter = 0;
     1065                }
     1066                break;
     1067
    10671068  }
    10681069  setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER;
    10691070  if(fuFlags & SWP_DRAWFRAME)
    1070         setstate |= 0; //TODO
     1071        setstate |= 0; //TODO
    10711072  if(fuFlags & SWP_FRAMECHANGED)
    1072         setstate |= 0; //TODO
     1073        setstate |= 0; //TODO
    10731074  if(fuFlags & SWP_HIDEWINDOW)
    1074         setstate &= ~SWPOS_ZORDER;
     1075        setstate &= ~SWPOS_ZORDER;
    10751076  if(fuFlags & SWP_NOACTIVATE)
    1076         setstate &= ~SWPOS_ACTIVATE;
     1077        setstate &= ~SWPOS_ACTIVATE;
    10771078  if(fuFlags & SWP_NOCOPYBITS)
    1078         setstate |= 0;          //TODO
     1079        setstate |= 0;          //TODO
    10791080  if(fuFlags & SWP_NOMOVE)
    1080         setstate &= ~SWPOS_MOVE;
     1081        setstate &= ~SWPOS_MOVE;
    10811082  if(fuFlags & SWP_NOSIZE)
    1082         setstate &= ~SWPOS_SIZE;
     1083        setstate &= ~SWPOS_SIZE;
    10831084  if(fuFlags & SWP_NOREDRAW)
    1084         setstate |= SWPOS_NOREDRAW;
     1085        setstate |= SWPOS_NOREDRAW;
    10851086  if(fuFlags & SWP_NOZORDER)
    1086         setstate &= ~SWPOS_ZORDER;
     1087        setstate &= ~SWPOS_ZORDER;
    10871088  if(fuFlags & SWP_SHOWWINDOW)
    1088         setstate |= SWPOS_SHOW;
     1089        setstate |= SWPOS_SHOW;
    10891090
    10901091  return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
     
    11021103{
    11031104  if(getParent()) {
    1104         return getParent()->getWindowHandle();
    1105   }
    1106   else  return 0;
     1105        return getParent()->getWindowHandle();
     1106  }
     1107  else  return 0;
    11071108}
    11081109//******************************************************************************
     
    11141115
    11151116   if(getParent()) {
    1116         oldhwnd = getParent()->getWindowHandle();
     1117        oldhwnd = getParent()->getWindowHandle();
    11171118   }
    11181119   else oldhwnd = 0;
    11191120
    11201121   if(hwndNewParent == 0) {//desktop window = parent
    1121         setParent(NULL);
     1122        setParent(NULL);
    11221123        OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
    11231124        return oldhwnd;
     
    11381139{
    11391140  if(getParent()) {
    1140         return getParent()->getWindowHandle() == hwndParent;
    1141   }
    1142   else  return 0;
     1141        return getParent()->getWindowHandle() == hwndParent;
     1142  }
     1143  else  return 0;
    11431144}
    11441145//******************************************************************************
     
    11541155//******************************************************************************
    11551156BOOL Win32Window::UpdateWindow()
    1156 { 
    1157  RECT rect;
     1157{
     1158   OSRECTL rect;
    11581159
    11591160  if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
    11601161  {//update region not empty
    1161         SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
     1162        SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
    11621163  }
    11631164  return TRUE;
     
    11821183  switch(uCmd)
    11831184  {
    1184         case GW_CHILD:
    1185                 getcmd = QWOS_TOP;
    1186                 break;
    1187         case GW_HWNDFIRST:
    1188                 if(getParent()) {
    1189                         getcmd = QWOS_TOP; //top of child windows
    1190                 }
    1191                 else    getcmd = QWOS_TOP; //TODO
    1192                 break;
    1193         case GW_HWNDLAST:
    1194                 if(getParent()) {
    1195                         getcmd = QWOS_BOTTOM; //bottom of child windows
    1196                 }
    1197                 else    getcmd = QWOS_BOTTOM; //TODO
    1198                 break;
    1199         case GW_HWNDNEXT:
    1200                 getcmd = QWOS_NEXT;
    1201                 break;
    1202         case GW_HWNDPREV:
    1203                 getcmd = QWOS_PREV;
    1204                 break;
    1205         case GW_OWNER:
    1206                 if(owner) {
    1207                         return owner->getWindowHandle();
    1208                 }
    1209                 else    return 0;
     1185        case GW_CHILD:
     1186                getcmd = QWOS_TOP;
     1187                break;
     1188        case GW_HWNDFIRST:
     1189                if(getParent()) {
     1190                        getcmd = QWOS_TOP; //top of child windows
     1191                }
     1192                else    getcmd = QWOS_TOP; //TODO
     1193                break;
     1194        case GW_HWNDLAST:
     1195                if(getParent()) {
     1196                        getcmd = QWOS_BOTTOM; //bottom of child windows
     1197                }
     1198                else    getcmd = QWOS_BOTTOM; //TODO
     1199                break;
     1200        case GW_HWNDNEXT:
     1201                getcmd = QWOS_NEXT;
     1202                break;
     1203        case GW_HWNDPREV:
     1204                getcmd = QWOS_PREV;
     1205                break;
     1206        case GW_OWNER:
     1207                if(owner) {
     1208                        return owner->getWindowHandle();
     1209                }
     1210                else    return 0;
    12101211  }
    12111212  hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
    1212   if(hwndRelated) 
    1213   {
    1214         win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
    1215         magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
    1216         if(CheckMagicDword(magic) && win32wnd)
    1217         {
    1218                 return win32wnd->getWindowHandle();
    1219         }
     1213  if(hwndRelated)
     1214  {
     1215        win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
     1216        magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
     1217        if(CheckMagicDword(magic) && win32wnd)
     1218        {
     1219                return win32wnd->getWindowHandle();
     1220        }
    12201221  }
    12211222  return 0;
     
    12541255  if(CheckMagicDword(magic) && win32wnd)
    12551256  {
    1256         return win32wnd->getWindowHandle();
     1257        return win32wnd->getWindowHandle();
    12571258  }
    12581259  return hwndActive;
     
    13241325                return oldval;
    13251326        case GWL_HWNDPARENT:
    1326                 return SetParent((HWND)value);
     1327                return SetParent((HWND)value);
    13271328
    13281329        case GWL_ID:
     
    14091410
    14101411   if(HIWORD(hwnd) != 0x6800) {
    1411         return NULL;
     1412        return NULL;
    14121413   }
    14131414
    14141415   if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) {
    1415         return window;
     1416        return window;
    14161417   }
    14171418   else return NULL;
     
    14191420//******************************************************************************
    14201421//******************************************************************************
     1422Win32Window *Win32Window::GetWindowFromOS2Handle(HWND hwnd)
     1423{
     1424   ULONG winHandle;
     1425   Win32Window *window;
     1426
     1427   //CB: returns index, not handle!
     1428   if(HMHandleTranslateToWin(hwnd,(PULONG)&winHandle) == NO_ERROR)
     1429   {
     1430     if (HMHandleTranslateToOS2(LOWORD(winHandle),(PULONG)&window) == NO_ERROR)
     1431     {
     1432       return window;
     1433     } else return NULL;
     1434   } else return NULL;
     1435}
     1436//******************************************************************************
     1437//******************************************************************************
    14211438GenericObject *Win32Window::windows  = NULL;
  • trunk/src/user32/new/win32wnd.h

    r325 r327  
    1 /* $Id: win32wnd.h,v 1.8 1999-07-18 10:39:52 sandervl Exp $ */
     1/* $Id: win32wnd.h,v 1.9 1999-07-18 13:57:48 cbratschi Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    2121class Win32Window;
    2222
    23 #define OFFSET_WIN32WNDPTR      0
    24 #define OFFSET_WIN32PM_MAGIC    4
    25 
    26 #define WIN32PM_MAGIC           0x12345678
    27 #define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
     23#define OFFSET_WIN32WNDPTR      0
     24#define OFFSET_WIN32PM_MAGIC    4
     25
     26#define WIN32PM_MAGIC           0x12345678
     27#define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
    2828
    2929typedef struct {
    30         USHORT          cb;
    31         Win32Window    *win32wnd;
    32         ULONG           win32CreateStruct;      //or dialog create dword
     30        USHORT          cb;
     31        Win32Window    *win32wnd;
     32        ULONG           win32CreateStruct;      //or dialog create dword
    3333} CUSTOMWNDDATA;
    3434
    3535typedef struct
    3636{
    37         ULONG           Msg;
    38         ULONG           wParam;
    39         ULONG           lParam;
     37        ULONG           Msg;
     38        ULONG           wParam;
     39        ULONG           lParam;
    4040} POSTMSG_PACKET;
    4141
    42 #define WM_WIN32_POSTMESSAGEA   0x4000
    43 #define WM_WIN32_POSTMESSAGEW   0x4001
     42#define WM_WIN32_POSTMESSAGEA   0x4000
     43#define WM_WIN32_POSTMESSAGEW   0x4001
    4444
    4545class Win32Window : private GenericObject, private ChildWindow
    4646{
    4747public:
    48         DWORD   magic;
    49 
    50                 Win32Window(DWORD objType);
    51                 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
     48        DWORD   magic;
     49
     50                Win32Window(DWORD objType);
     51                Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
    5252virtual        ~Win32Window();
    5353
    5454virtual  ULONG  MsgCreate(HWND hwndOS2, ULONG initParam);
    55         ULONG  MsgQuit();
    56         ULONG  MsgClose();
     55        ULONG  MsgQuit();
     56        ULONG  MsgClose();
    5757         ULONG  MsgDestroy();
    58         ULONG  MsgEnable(BOOL fEnable);
    59         ULONG  MsgShow(BOOL fShow);
    60         ULONG  MsgMove(ULONG xParent, ULONG yParent);
    61         ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
     58        ULONG  MsgEnable(BOOL fEnable);
     59        ULONG  MsgShow(BOOL fShow);
     60        ULONG  MsgMove(ULONG xParent, ULONG yParent);
     61        ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
    6262         ULONG  MsgActivate(BOOL fActivate, HWND hwnd);
    63          ULONG  MsgSetFocus(HWND hwnd);
    64          ULONG  MsgKillFocus(HWND hwnd);
    65          ULONG  MsgButton(ULONG msg, ULONG x, ULONG y);
    66          ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
    67          ULONG  MsgEraseBackGround(ULONG hps);
    68          ULONG  MsgSetText(LPSTR lpsz, LONG cch);
    69 
    70 virtual  LONG   SetWindowLongA(int index, ULONG value);
    71 virtual  ULONG  GetWindowLongA(int index);
    72 virtual  WORD   SetWindowWord(int index, WORD value);
    73 virtual  WORD   GetWindowWord(int index);
    74 
    75          DWORD  getStyle()                      { return dwStyle; };
    76          DWORD  getExStyle()                    { return dwExStyle; };
    77          HWND   getWindowHandle()               { return Win32Hwnd; };
    78          HWND   getOS2WindowHandle()            { return OS2Hwnd; };
    79    Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
    80          void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
     63         ULONG  MsgSetFocus(HWND hwnd);
     64         ULONG  MsgKillFocus(HWND hwnd);
     65         ULONG  MsgButton(ULONG msg, ULONG x, ULONG y);
     66         ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
     67         ULONG  MsgEraseBackGround(ULONG hps);
     68         ULONG  MsgSetText(LPSTR lpsz, LONG cch);
     69
     70virtual  LONG   SetWindowLongA(int index, ULONG value);
     71virtual  ULONG  GetWindowLongA(int index);
     72virtual  WORD   SetWindowWord(int index, WORD value);
     73virtual  WORD   GetWindowWord(int index);
     74
     75         DWORD  getStyle()                      { return dwStyle; };
     76         DWORD  getExStyle()                    { return dwExStyle; };
     77         HWND   getWindowHandle()               { return Win32Hwnd; };
     78         HWND   getOS2WindowHandle()            { return OS2Hwnd; };
     79   Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
     80         void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
     81
    8182       WNDPROC  getWindowProc()                 { return win32wndproc; };
    8283         void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
     
    8485         void   setWindowId(DWORD id)           { windowId = id; };
    8586
    86          DWORD  getFlags()                      { return flags; };
    87          void   setFlags(DWORD newflags)        { flags = newflags; };
    88 
    89         BOOL   SetMenu(ULONG hMenu);
    90         BOOL   ShowWindow(ULONG nCmdShow);
    91         BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
    92         BOOL   DestroyWindow();
    93         HWND   SetActiveWindow();
    94         HWND   GetParent();
    95         HWND   SetParent(HWND hwndNewParent);
    96         BOOL   IsChild(HWND hwndParent);
    97         HWND   GetTopWindow();
    98         BOOL   UpdateWindow();
    99         BOOL   IsIconic();
     87         DWORD  getFlags()                      { return flags; };
     88         void   setFlags(DWORD newflags)        { flags = newflags; };
     89
     90        BOOL   SetMenu(ULONG hMenu);
     91        BOOL   ShowWindow(ULONG nCmdShow);
     92        BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
     93        BOOL   DestroyWindow();
     94        HWND   SetActiveWindow();
     95        HWND   GetParent();
     96        HWND   SetParent(HWND hwndNewParent);
     97        BOOL   IsChild(HWND hwndParent);
     98        HWND   GetTopWindow();
     99        BOOL   UpdateWindow();
     100        BOOL   IsIconic();
    100101         HWND   GetWindow(UINT uCmd);
    101         BOOL   EnableWindow(BOOL fEnable);
    102          BOOL   BringWindowToTop();
     102        BOOL   EnableWindow(BOOL fEnable);
     103         BOOL   BringWindowToTop();
    103104  static HWND   GetActiveWindow();
    104          BOOL   IsWindow();
    105          BOOL   IsWindowEnabled();
    106          BOOL   IsWindowVisible();
    107 
    108          BOOL   GetWindowRect(PRECT pRect);
    109          int    GetWindowTextLengthA();
    110          int    GetWindowTextA(LPSTR lpsz, int cch);
    111          BOOL   SetWindowTextA(LPCSTR lpsz);
     105
     106         BOOL   IsWindow();
     107         BOOL   IsWindowEnabled();
     108         BOOL   IsWindowVisible();
     109
     110         BOOL   GetWindowRect(PRECT pRect);
     111         int    GetWindowTextLengthA();
     112         int    GetWindowTextA(LPSTR lpsz, int cch);
     113         BOOL   SetWindowTextA(LPCSTR lpsz);
    112114
    113115       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     
    123125
    124126static Win32Window *GetWindowFromHandle(HWND hwnd);
     127static Win32Window *GetWindowFromOS2Handle(HWND hwnd);
    125128
    126129protected:
    127130       LRESULT  SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    128131       LRESULT  SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
    129         void    Init();
    130 
    131         HWND    OS2Hwnd;
    132         HWND    OS2HwndFrame;
    133         HWND    OS2HwndMenu;
    134         HWND    Win32Hwnd;
    135         BOOL    isUnicode;
    136 
    137         int     posx, posy, width, height;
    138 
    139         // values normally contained in the standard window words
    140         ULONG   dwExStyle;              //GWL_EXSTYLE
    141         ULONG   dwStyle;                //GWL_STYLE
    142       WNDPROC   win32wndproc;           //GWL_WNDPROC
    143         ULONG   hInstance;              //GWL_HINSTANCE
     132        void    Init();
     133
     134        HWND    OS2Hwnd;
     135        HWND    OS2HwndFrame;
     136        HWND    OS2HwndMenu;
     137        HWND    Win32Hwnd;
     138        BOOL    isUnicode;
     139
     140        int     posx, posy, width, height;
     141
     142        // values normally contained in the standard window words
     143        ULONG   dwExStyle;              //GWL_EXSTYLE
     144        ULONG   dwStyle;                //GWL_STYLE
     145      WNDPROC   win32wndproc;           //GWL_WNDPROC
     146        ULONG   hInstance;              //GWL_HINSTANCE
    144147//Moved in ChildWindow class
    145 /////   Win32Window *parent;                    //GWL_HWNDPARENT
    146         ULONG   windowId;               //GWL_ID
    147         ULONG   userData;               //GWL_USERDATA
     148/////   Win32Window *parent;                    //GWL_HWNDPARENT
     149        ULONG   windowId;               //GWL_ID
     150        ULONG   userData;               //GWL_USERDATA
    148151
    149152         HWND   hwndLinkAfter;
    150153        DWORD   flags;
    151154
    152         BOOL    isIcon;
    153 
    154    Win32Window *owner;                 
    155 
    156         char   *windowName;
    157         ULONG   wndNameLength;
    158 
    159         char   *windowText;
    160         ULONG   wndTextLength;
    161        
    162         ULONG  *userWindowLong;
    163         ULONG   nrUserWindowLong;
    164 
    165         RECT    rectWindow;
    166         RECT    rectClient;
     155        BOOL    isIcon;
     156
     157   Win32Window *owner;
     158
     159        char   *windowName;
     160        ULONG   wndNameLength;
     161
     162        char   *windowText;
     163        ULONG   wndTextLength;
     164
     165        ULONG  *userWindowLong;
     166        ULONG   nrUserWindowLong;
     167
     168        RECT    rectWindow;
     169        RECT    rectClient;
    167170
    168171Win32WndClass  *windowClass;
     
    172175private:
    173176#ifndef OS2_INCLUDED
    174         BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
    175 
    176         void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
    177 
    178         LONG  SendNCCalcSize(BOOL calcValidRect,
     177        BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
     178
     179        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
     180
     181        LONG  SendNCCalcSize(BOOL calcValidRect,
    179182                             RECT *newWindowRect, RECT *oldWindowRect,
    180183                             RECT *oldClientRect, WINDOWPOS *winpos,
     
    183186     LRESULT  SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
    184187     {
    185         if(isUnicode)
    186                 return SendInternalMessageW(msg, wParam, lParam);
    187         else    return SendInternalMessageA(msg, wParam, lParam);
     188        if(isUnicode)
     189                return SendInternalMessageW(msg, wParam, lParam);
     190        else    return SendInternalMessageA(msg, wParam, lParam);
    188191     }
    189192#endif
     
    191194
    192195
    193 #define BUTTON_LEFTDOWN         0
    194 #define BUTTON_LEFTUP           1
    195 #define BUTTON_LEFTDBLCLICK     2
    196 #define BUTTON_RIGHTUP          3
    197 #define BUTTON_RIGHTDOWN        4
    198 #define BUTTON_RIGHTDBLCLICK    5
     196#define BUTTON_LEFTDOWN         0
     197#define BUTTON_LEFTUP           1
     198#define BUTTON_LEFTDBLCLICK     2
     199#define BUTTON_RIGHTUP          3
     200#define BUTTON_RIGHTDOWN        4
     201#define BUTTON_RIGHTDBLCLICK    5
    199202
    200203#endif //__cplusplus
  • trunk/src/user32/new/windlg.cpp

    r325 r327  
    1 /* $Id: windlg.cpp,v 1.1 1999-07-18 10:39:52 sandervl Exp $ */
     1/* $Id: windlg.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */
    22/*
    33 * Win32 dialog apis for OS/2
     
    99 *
    1010 */
     11#include <wchar.h>
    1112#include <os2win.h>
    1213#include <misc.h>
     
    8990//******************************************************************************
    9091//******************************************************************************
    91 BOOL WIN32API SetDlgItemInt( HWND arg1, int arg2, UINT arg3, BOOL  arg4)
    92 {
     92BOOL WIN32API SetDlgItemInt( HWND hwndDlg, int idControl, UINT uValue, BOOL  fSigned)
     93{
     94    char buf[30];
     95
    9396#ifdef DEBUG
    9497    WriteLog("USER32:  SetDlgItemInt\n");
    9598#endif
    96     //get item text and translate to int
    97     return O32_SetDlgItemInt(arg1, arg2, arg3, arg4);
     99    if (fSigned) sprintf(buf,"%u",uValue);
     100    else sprintf(buf,"%d",uValue);
     101
     102    return SetDlgItemTextA(hwndDlg,idControl,buf);
    98103}
    99104//******************************************************************************
  • trunk/src/user32/new/wingdi.cpp

    r326 r327  
    1 /* $Id: wingdi.cpp,v 1.1 1999-07-18 10:40:16 sandervl Exp $ */
     1/* $Id: wingdi.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    2323{
    2424  Win32Window *window;
     25  OSRECTL rect;
    2526
    2627   window = Win32Window::GetWindowFromHandle(hwnd);
    2728   if(!window) {
    28         dprintf(("GetDC, window %x not found", hwnd));
    29         return 0;
     29        dprintf(("GetDC, window %x not found", hwnd));
     30        return 0;
    3031   }
    3132   dprintf(("BeginPaint %X\n", hwnd));
    32    if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &lps->rcPaint) == FALSE)
     33   if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &rect) == FALSE)
    3334   {
    34         dprintf(("BeginPaint, NO update rectl"));
    35         return 0;
     35        dprintf(("BeginPaint, NO update rectl"));
     36        return 0;
    3637   }
     38   MapOS2ToWin32Rectl(window->getOS2WindowHandle(),(PRECTLOS2)&rect,&lps->rcPaint);
    3739   lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), (PVOID)&lps->rcPaint);
    3840
     
    5557   window = Win32Window::GetWindowFromHandle(hwnd);
    5658   if(!window) {
    57         dprintf(("GetDC, window %x not found", hwnd));
    58         return 0;
     59        dprintf(("GetDC, window %x not found", hwnd));
     60        return 0;
    5961   }
    6062   dprintf(("GetDC %x", hwnd));
Note: See TracChangeset for help on using the changeset viewer.