1 | /* $Id: setwindow.cpp,v 1.2 1999-06-27 16:23:23 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 Get/SetWindowLong/Word user32 API functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #include <os2win.h>
|
---|
13 | #include <misc.h>
|
---|
14 |
|
---|
15 | #include <wndproc.h>
|
---|
16 | #include <wndclass.h>
|
---|
17 |
|
---|
18 | //******************************************************************************
|
---|
19 | //******************************************************************************
|
---|
20 | LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG arg3)
|
---|
21 | {
|
---|
22 | LONG rc;
|
---|
23 |
|
---|
24 | dprintf(("USER32: SetWindowLongA %X %d %X\n", hwnd, nIndex, arg3));
|
---|
25 | if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
|
---|
26 | Win32WindowProc *wndproc = Win32WindowProc::FindProc(hwnd);
|
---|
27 | if(wndproc == NULL) {//created with system class and app wants to change the handler
|
---|
28 | dprintf(("USER32: ERROR: SetWindowLong new WindowProc for system class\n"));
|
---|
29 | //SvL: 26/06/99 Should no longer be possible
|
---|
30 | DebugInt3();
|
---|
31 | return(0);
|
---|
32 | }
|
---|
33 | else {
|
---|
34 | if(!(nIndex == DWL_DLGPROC && wndproc->IsWindow() == TRUE)) {
|
---|
35 | rc = (LONG)wndproc->GetWin32Callback();
|
---|
36 | dprintf(("USER32: SetWindowLong change WindowProc %X to %X\n", rc, arg3));
|
---|
37 | wndproc->SetWin32Callback((WNDPROC)arg3);
|
---|
38 | O32_SetWindowLong(hwnd, nIndex, (LONG)wndproc->GetOS2Callback());
|
---|
39 | return(rc);
|
---|
40 | }
|
---|
41 | //else window that accesses it's normal window data
|
---|
42 | }
|
---|
43 | }
|
---|
44 | return O32_SetWindowLong(hwnd, nIndex, arg3);
|
---|
45 | }
|
---|
46 | //******************************************************************************
|
---|
47 | //TODO: Is this always correct? (GWL_ID: window identifier??)
|
---|
48 | //******************************************************************************
|
---|
49 | LONG WIN32API SetWindowLongW(HWND arg1, int arg2, LONG arg3)
|
---|
50 | {
|
---|
51 | dprintf(("USER32: SetWindowLongW %X %d %X\n", arg1, arg2, arg3));
|
---|
52 | return SetWindowLongA(arg1, arg2, arg3);
|
---|
53 | }
|
---|
54 | //******************************************************************************
|
---|
55 | //******************************************************************************
|
---|
56 | WORD WIN32API GetWindowWord( HWND arg1, int arg2)
|
---|
57 | {
|
---|
58 | #ifdef DEBUG
|
---|
59 | WriteLog("USER32: GetWindowWord\n");
|
---|
60 | #endif
|
---|
61 | return O32_GetWindowWord(arg1, arg2);
|
---|
62 | }
|
---|
63 | //******************************************************************************
|
---|
64 | //******************************************************************************
|
---|
65 | WORD WIN32API SetWindowWord( HWND arg1, int arg2, WORD arg3)
|
---|
66 | {
|
---|
67 | dprintf(("USER32: SetWindowWord\n"));
|
---|
68 | return O32_SetWindowWord(arg1, arg2, arg3);
|
---|
69 | }
|
---|
70 | //******************************************************************************
|
---|
71 | //******************************************************************************
|
---|
72 | LONG WIN32API GetWindowLongA(HWND hwnd, int nIndex)
|
---|
73 | {
|
---|
74 | LONG rc;
|
---|
75 |
|
---|
76 | if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
|
---|
77 | #ifdef DEBUG
|
---|
78 | WriteLog("USER32: GetWindowLong %X %d\n", hwnd, nIndex);
|
---|
79 | #endif
|
---|
80 | Win32WindowProc *window = Win32WindowProc::FindProc(hwnd);
|
---|
81 | if(window && !(nIndex == DWL_DLGPROC && window->IsWindow() == TRUE)) {
|
---|
82 | return (LONG)window->GetWin32Callback();
|
---|
83 | }
|
---|
84 | }
|
---|
85 | rc = O32_GetWindowLong(hwnd, nIndex);
|
---|
86 | return(rc);
|
---|
87 | }
|
---|
88 | //******************************************************************************
|
---|
89 | //******************************************************************************
|
---|
90 | LONG WIN32API GetWindowLongW( HWND arg1, int arg2)
|
---|
91 | {
|
---|
92 | #ifdef DEBUG
|
---|
93 | WriteLog("USER32: GetWindowLongW\n");
|
---|
94 | #endif
|
---|
95 | return GetWindowLongA(arg1, arg2); //class procedures..
|
---|
96 | }
|
---|
97 | //******************************************************************************
|
---|
98 | //******************************************************************************
|
---|