- Timestamp:
- Jul 14, 1999, 10:35:38 AM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 42 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/pmwindow.cpp
r4 r300 1 /* $Id: pmwindow.cpp,v 1.1 1999-05-24 20:20:04 ktk Exp $ */ 2 1 /* $Id: pmwindow.cpp,v 1.2 1999-07-14 08:35:35 sandervl Exp $ */ 3 2 /* 4 3 * Win32 Window Managment Code for OS/2 5 4 * 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 5 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) 6 * 7 * 8 * Project Odin Software License can be found in LICENSE.TXT 7 9 * 8 10 */ … … 11 13 12 14 #include <os2.h> /* PM header file */ 13 #include "misc.h" 14 #include "win32wnd.h" 15 #include "win32dlg.h" 15 #include <os2wrap.h> 16 #include "win32type.h" 17 #include <wprocess.h> 18 #include <misc.h> 19 #include <win32wnd.h> 20 #include <win32dlg.h> 21 #include "pmwindow.h" 22 #include "oslibwin.h" 16 23 17 24 HMQ hmq = 0; /* Message queue handle */ … … 19 26 20 27 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 21 MRESULT EXPENTRY Win32DialogProc(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2); 22 23 //****************************************************************************** 24 //Initialize PM; create hab, message queue and register special Win32 window class 28 29 //****************************************************************************** 30 //Initialize PM; create hab, message queue and register special Win32 window classes 25 31 //****************************************************************************** 26 32 BOOL InitPM() … … 36 42 if(!WinRegisterClass( /* Register window class */ 37 43 hab, /* Anchor block handle */ 38 (PSZ) "Win32Window",/* Window class name */44 (PSZ)WIN32_STDCLASS, /* Window class name */ 39 45 (PFNWP)Win32WindowProc, /* Address of window procedure */ 40 46 CS_SIZEREDRAW, /* Class style */ 41 4)) {47 8)) { 42 48 dprintf(("WinRegisterClass Win32Window failed")); 43 49 return(FALSE); 44 50 } 45 51 46 if(!WinRegisterClass( /* Register window class */47 hab, /* Anchor block handle */48 (PSZ)"Win32Dialog", /* Window class name */49 (PFNWP)Win32DialogProc, /* Address of window procedure */50 CS_SIZEREDRAW, /* Class style */51 4)) {52 dprintf(("WinRegisterClass Win32Dialog failed"));53 return(FALSE);54 }55 56 52 return(TRUE); 57 53 } /* End of main */ … … 61 57 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 62 58 { 63 Win32Window *win32wnd = (Win32Window *)WinQueryWindowULong(hwnd, 0); 64 MRESULT rc; 65 59 Win32Window *win32wnd; 60 ULONG magic; 61 APIRET rc; 62 63 //Restore our FS selector 64 SetWin32TIB(); 65 66 win32wnd = (Win32Window *)WinQueryWindowULong(hwnd, OFFSET_WIN32WNDPTR); 67 magic = WinQueryWindowULong(hwnd, OFFSET_WIN32PM_MAGIC); 68 69 if(msg != WM_CREATE && win32wnd == NULL && magic != WIN32PM_MAGIC) { 70 dprintf(("Invalid win32wnd pointer for window %x!!", hwnd)); 71 goto RunDefWndProc; 72 } 66 73 switch( msg ) 67 { 74 { 68 75 case WM_CREATE: 69 win32wnd = new Win32Window(hwnd, msg, mp1, mp2); 70 if(win32wnd == NULL) { 71 dprintf(("new win32wnd failed!")); 72 } 73 if(WinSetWindowULong(hwnd, 0, (ULONG)win32wnd) == FALSE) { 74 dprintf(("WinSetWindowULong %X failed!!", hwnd)); 75 } 76 //Processing is done in after WinCreateWindow returns 76 77 break; 77 78 79 case WM_QUIT: 80 if(win32wnd->MsgQuit()) { 81 goto RunDefWndProc; 82 } 83 break; 84 85 case WM_CLOSE: 86 if(win32wnd->MsgClose()) { 87 goto RunDefWndProc; 88 } 89 break; 90 91 case WM_DESTROY: 92 if(win32wnd->MsgDestroy()) { 93 goto RunDefWndProc; 94 } 95 break; 96 97 case WM_ENABLE: 98 if(win32wnd->MsgEnable((ULONG)mp1)) { 99 goto RunDefWndProc; 100 } 101 break; 102 103 case WM_SHOW: 104 if(win32wnd->MsgShow((ULONG)mp1)) { 105 goto RunDefWndProc; 106 } 107 break; 108 109 case WM_MOVE: 110 { 111 RECTL rectl, rectl2; 112 POINTL point; 113 HWND hwndParent; 114 ULONG xScreen, yScreen, yParent, xParent; 115 116 rc = WinQueryWindowRect(hwnd, &rectl); 117 if(rc == TRUE) { 118 point.x = rectl.xLeft; 119 point.y = rectl.yBottom; 120 121 //If the window has a parent, calculate position relative to that window 122 if((hwndParent = WinQueryWindow(hwnd, QW_PARENT)) != WinQueryDesktopWindow(hab, NULLHANDLE)) { 123 rc = WinMapWindowPoints(hwnd, hwndParent, &point, 1); 124 if(rc == FALSE) { 125 dprintf(("WM_MOVE: WinMapWindowPoints (parent) failed!")); 126 break; 127 } 128 rc = WinQueryWindowRect(hwndParent, &rectl2); 129 if(rc == FALSE) { 130 dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!")); 131 break; 132 } 133 yParent = point.x; 134 yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y); 135 } 136 else xParent = yParent = -1; 137 138 point.x = rectl.xLeft; 139 point.y = rectl.yBottom; 140 141 rc = WinMapWindowPoints(hwnd, HWND_DESKTOP, &point, 1); 142 if(rc == FALSE) { 143 dprintf(("WM_MOVE: WinMapWindowPoints (desktop) failed!")); 144 break; 145 } 146 rc = WinQueryWindowRect(HWND_DESKTOP, &rectl); 147 if(rc == FALSE) { 148 dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!")); 149 break; 150 } 151 xScreen = point.x; 152 yScreen = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, point.y); 153 154 if(win32wnd->MsgMove(xScreen, yScreen, xParent, yParent)) { 155 goto RunDefWndProc; 156 } 157 } 158 else { 159 dprintf(("WM_MOVE: WinQueryWindowRect failed!")); 160 } 161 break; 162 } 163 164 case WM_WINDOWPOSCHANGED: 165 { 166 break; 167 } 168 169 case WM_ADJUSTWINDOWPOS: 170 { 171 // if(win32wnd->MsgWindowPosChanging(0, 0)) { 172 break; 173 } 174 175 case WM_ERASEBACKGROUND: 176 { 177 HPS hps; 178 179 hps = WinGetPS(hwnd); 180 if(win32wnd->MsgEraseBackGround((ULONG)hps)) 181 { 182 /* 183 * Return TRUE to request PM to paint the window background 184 * in SYSCLR_WINDOW. 185 */ 186 WinReleasePS(hps); 187 return (MRESULT)( TRUE ); 188 } 189 WinReleasePS(hps); 190 return (MRESULT) FALSE; 191 } 192 case WM_SIZE: 193 { 194 SWP swp; 195 196 rc = WinQueryWindowPos(hwnd, &swp); 197 if(rc == FALSE) { 198 dprintf(("WM_SIZE: WinQueryWindowPos failed!")); 199 break; 200 } 201 if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), 202 (swp.fl & SWP_MINIMIZE) != 0, 203 (swp.fl & SWP_MAXIMIZE) != 0)) 204 { 205 goto RunDefWndProc; 206 } 207 208 break; 209 } 210 211 case WM_ACTIVATE: 212 { 213 HWND hwndActivate = (HWND)mp1; 214 215 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 216 //another (non-win32) application's window 217 //set to NULL (allowed according to win32 SDK) to avoid problems 218 hwndActivate = NULL; 219 } 220 if(win32wnd->MsgActivate(1, hwndActivate)) { 221 goto RunDefWndProc; 222 } 223 break; 224 } 225 case WM_FOCUSCHANGE: 226 break; 227 228 case WM_SETFOCUS: 229 { 230 HWND hwndFocus = (HWND)mp1; 231 232 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 233 //another (non-win32) application's window 234 //set to NULL (allowed according to win32 SDK) to avoid problems 235 hwndFocus = NULL; 236 } 237 if((ULONG)mp2 == TRUE) { 238 rc = win32wnd->MsgSetFocus(hwndFocus); 239 } 240 else rc = win32wnd->MsgKillFocus(hwndFocus); 241 if(rc) { 242 goto RunDefWndProc; 243 } 244 break; 245 } 246 //************************************************************************** 247 //Mouse messages 248 //************************************************************************** 249 case WM_BUTTON1DOWN: 250 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 251 goto RunDefWndProc; 252 } 253 break; 254 case WM_BUTTON1UP: 255 if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 256 goto RunDefWndProc; 257 } 258 break; 259 case WM_BUTTON1DBLCLK: 260 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 261 goto RunDefWndProc; 262 } 263 break; 264 case WM_BUTTON2DOWN: 265 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 266 goto RunDefWndProc; 267 } 268 break; 269 case WM_BUTTON2UP: 270 if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 271 goto RunDefWndProc; 272 } 273 break; 274 case WM_BUTTON2DBLCLK: 275 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 276 goto RunDefWndProc; 277 } 278 break; 279 case WM_BUTTON2MOTIONSTART: 280 case WM_BUTTON2MOTIONEND: 281 case WM_BUTTON2CLICK: 282 case WM_BUTTON1MOTIONSTART: 283 case WM_BUTTON1MOTIONEND: 284 case WM_BUTTON1CLICK: 285 case WM_BUTTON3DOWN: 286 case WM_BUTTON3UP: 287 case WM_BUTTON3DBLCLK: 288 case WM_BUTTON3MOTIONSTART: 289 case WM_BUTTON3MOTIONEND: 290 case WM_BUTTON3CLICK: 291 break; 292 293 case WM_MOUSEMOVE: 294 break; 295 296 //************************************************************************** 297 //Slider messages 298 //************************************************************************** 299 case WM_VSCROLL: 300 break; 301 case WM_HSCROLL: 302 break; 303 304 case WM_CONTROL: 305 break; 306 307 case WM_COMMAND: 308 case WM_SYSCOMMAND: 309 break; 310 311 case WM_CHAR: 312 break; 313 314 case WM_INITMENU: 315 case WM_MENUSELECT: 316 case WM_MENUEND: 317 case WM_NEXTMENU: 318 break; 319 320 case WM_TIMER: 321 break; 322 323 case WM_PAINT: 324 if(win32wnd->MsgPaint(0, 0)) { 325 goto RunDefWndProc; 326 } 327 break; 328 329 case WM_SYSCOLORCHANGE: 330 case WM_SYSVALUECHANGED: 331 break; 332 333 case WM_CALCVALIDRECTS: 334 case WM_SETWINDOWPARAMS: 335 case WM_QUERYWINDOWPARAMS: 336 case WM_HITTEST: 337 case WM_SETSELECTION: 338 case WM_PPAINT: 339 case WM_PSETFOCUS: 340 case WM_PSYSCOLORCHANGE: 341 case WM_PSIZE: 342 case WM_PACTIVATE: 343 case WM_PCONTROL: 344 case WM_HELP: 345 case WM_APPTERMINATENOTIFY: 346 case WM_PRESPARAMCHANGED: 347 case WM_DRAWITEM: 348 case WM_MEASUREITEM: 349 case WM_CONTROLPOINTER: 350 case WM_QUERYDLGCODE: 351 case WM_SUBSTITUTESTRING: 352 case WM_MATCHMNEMONIC: 353 case WM_SAVEAPPLICATION: 354 case WM_SEMANTICEVENT: 355 break; 78 356 default: 79 /* 80 * Everything else comes here. This call MUST exist 81 * in your window procedure. 82 */ 83 if(win32wnd == NULL) { 84 dprintf(("Win32WindowProc: win32wnd NULL!")); 85 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 86 } 87 88 if(win32wnd->ProcessMessage(hwnd, msg, mp1, mp2, &rc) == TRUE) { 89 return(rc); 90 } 91 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 357 RestoreOS2TIB(); 358 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 92 359 } 360 RestoreOS2TIB(); 93 361 return (MRESULT)FALSE; 362 363 RunDefWndProc: 364 RestoreOS2TIB(); 365 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 94 366 } /* End of Win32WindowProc */ 95 367 //****************************************************************************** 96 //Win32 dialog message handler 97 //****************************************************************************** 98 MRESULT EXPENTRY Win32DialogProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2 ) 99 { 100 Win32Dialog *win32dlg = (Win32Dialog *)WinQueryWindowULong(hwndDlg, 0); 101 MRESULT rc; 102 103 switch(msg) 104 { 105 case WM_INITDLG: 106 win32dlg = new Win32Dialog(hwndDlg, msg, mp1, mp2); 107 if(win32dlg == NULL) { 108 dprintf(("new win32dlg failed!")); 109 } 110 if(WinSetWindowULong(hwndDlg, 0, (ULONG)win32dlg) == FALSE) { 111 dprintf(("WinSetWindowULong %X failed!!", hwndDlg)); 112 } 113 break; 114 115 default: 116 /* 117 * Any event messages that the dialog procedure has not processed 118 * come here and are processed by WinDefDlgProc. 119 * This call MUST exist in your dialog procedure. 120 */ 121 if(win32dlg == NULL) { 122 dprintf(("Win32DialogProc: win32dlg NULL!")); 123 return WinDefDlgProc( hwndDlg, msg, mp1, mp2 ); 124 } 125 if(win32dlg->ProcessDlgMessage(hwndDlg, msg, mp1, mp2, &rc) == TRUE) { 126 return(rc); 127 } 128 return WinDefDlgProc( hwndDlg, msg, mp1, mp2 ); 129 } 130 return (MRESULT) FALSE; 131 } 132 //****************************************************************************** 133 //****************************************************************************** 368 //****************************************************************************** -
trunk/src/user32/new/win32class.cpp
r4 r300 1 /* $Id: win32class.cpp,v 1.1 1999-05-24 20:20:04 ktk Exp $ */ 2 1 /* $Id: win32class.cpp,v 1.2 1999-07-14 08:35:36 sandervl Exp $ */ 3 2 /* 4 3 * Win32 Window Class Managment Code for OS/2 5 4 * 6 5 * 7 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) 8 7 * 9 8 */ 10 9 #include <os2win.h> 10 #include <stdio.h> 11 #include <stdlib.h> 12 #include <string.h> 11 13 #include <stdarg.h> 12 14 #include <assert.h> 13 #include "misc.h" 14 #include "user32.h" 15 #include "win32class.h" 16 #include "win32wnd.h" 15 #include <misc.h> 16 #include <win32class.h> 17 #include <win32wnd.h> 17 18 18 19 //****************************************************************************** 19 20 //Win32WndClass methods: 20 21 //****************************************************************************** 21 Win32WndClass::Win32WndClass(WNDCLASSEXA wndclass, BOOL isUnicode) 22 { 23 //Insert it in front of the rest 24 next = wndclasses; 25 wndclasses = this; 26 if((ULONG)wndclass->lpszClassName >> 16 != 0) { 27 className = (char *) malloc(strlen(wndclass->lpszClassName)+1); 28 classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR)); 29 if(className == NULL || classNameW == NULL) { 30 dprintf(("Win32Class ctr; className/classNameW == NULL")); 22 Win32WndClass::Win32WndClass(WNDCLASSEXA *wndclass, BOOL isUnicode) : GenericObject(&wndclasses, OBJTYPE_CLASS) 23 { 24 if(HIWORD(wndclass->lpszClassName)) { 25 if(isUnicode) { 26 classNameA = (PCHAR)malloc(lstrlenW((LPWSTR)wndclass->lpszClassName)+1); 27 classNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)wndclass->lpszClassName)+1)*sizeof(WCHAR)); 28 } 29 else { 30 classNameA = (PCHAR)malloc(strlen(wndclass->lpszClassName)+1); 31 classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR)); 32 } 33 if(classNameA == NULL || classNameW == NULL) { 34 dprintf(("Win32Class ctr; classNameA/classNameW == NULL")); 31 35 exit(1); 32 36 } 33 strcpy(className, wndclass->lpszClassName); 34 AsciiToUnicode(className, classNameW); 35 classAtom = GlobalAddAtom(className); 37 if(isUnicode) { 38 lstrcpyW(classNameW, (LPWSTR)wndclass->lpszClassName); 39 UnicodeToAscii(classNameW, classNameA); 40 } 41 else { 42 strcpy((char *)classNameA, wndclass->lpszClassName); 43 AsciiToUnicode(classNameA, classNameW); 44 } 45 classAtom = GlobalAddAtomA(classNameA); 36 46 } 37 47 else { 38 className = NULL;48 classNameA = NULL; 39 49 classNameW = NULL; 40 50 classAtom = (DWORD)wndclass->lpszClassName; … … 51 61 dprintf(("USER32: wndclass->hCursor %X\n", wndclass->hCursor)); 52 62 dprintf(("USER32: wndclass->hbrBackground %X\n", wndclass->hbrBackground)); 53 if( (ULONG)wndclass->lpszClassName >> 16 == 0)63 if(HIWORD(wndclass->lpszClassName)) 54 64 dprintf(("USER32: wndclass->lpszClassName %X\n", wndclass->lpszClassName)); 55 65 else dprintf(("USER32: wndclass->lpszClassName %s\n", wndclass->lpszClassName)); 56 66 57 if( (ULONG)wc.lpszMenuName >> 16 != 0) {//convert string name identifier to numeric id67 if(HIWORD(wndclass->lpszMenuName)) {//convert string name identifier to numeric id 58 68 dprintf(("USER32: lpszMenuName %s\n", wndclass->lpszMenuName)); 59 69 } … … 62 72 nrExtraClassWords = wndclass->cbClsExtra; 63 73 nrExtraWindowWords = wndclass->cbWndExtra; 64 backgroundBrush = wndclass->hbrBack Ground; //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL74 backgroundBrush = wndclass->hbrBackground; //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL 65 75 hCursor = wndclass->hCursor; 66 76 hIcon = wndclass->hIcon; 67 77 hInstance = wndclass->hInstance; 68 if(wndclass->lpszMenuName && (ULONG)wndclass->lpszMenuName >> 16) { 69 menuName = (ULONG)malloc(strlen(wndclass->lpszMenuName)+1); 70 menuNameW = (ULONG)malloc((strlen(wndclass->lpszMenuName)+1)*sizeof(WCHAR)); 71 if(menuName == NULL || menuNameW == NULL) { 72 dprintf(("Win32Class ctr; menuName/menuNameW == NULL")); 73 exit(1); 74 } 75 strcpy((char *)menuName, wndclass->lpszMenuName); 76 AsciiToUnicode(menuName, menuNameW); 77 } 78 else { 79 menuName = (ULONG)wndclass->lpszMenuName; 80 menuNameW = (ULONG)wndclass->lpszMenuName; 81 } 78 79 menuNameA = 0; 80 menuNameW = 0; 81 setMenuName((LPSTR)wndclass->lpszMenuName); 82 82 83 83 windowStyle = wndclass->style; … … 95 95 else userClassLong = NULL; 96 96 97 hIconSm = wndclass->hIconSm; 98 99 dprintf(("Win32WndClass::Win32WndClass %d\n", id)); 97 cWindows = 0; 98 hIconSm = wndclass->hIconSm; 100 99 } 101 100 //****************************************************************************** … … 103 102 Win32WndClass::~Win32WndClass() 104 103 { 105 Win32WndClass *wndclass = Win32WndClass::wndclasses;106 107 if(wndclass == this) {108 wndclasses = next;109 }110 else {111 while(wndclass->next != NULL) {112 if(wndclass->next == this) {113 wndclass->next = next;114 break;115 }116 wndclass = wndclass->next;117 }118 }119 104 if(userClassLong) free(userClassLong); 120 if(className ) free(className);105 if(classNameA) free(classNameA); 121 106 if(classNameW) free(classNameW); 122 if(menuName && (ULONG)menuName >> 16) {123 free(menuName )107 if(menuNameA && HIWORD(menuNameA)) { 108 free(menuNameA); 124 109 assert(menuNameW); 125 110 free(menuNameW); … … 130 115 Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPSTR id) 131 116 { 132 Win32WndClass *wndclass = wndclasses;117 Win32WndClass *wndclass = (Win32WndClass *)wndclasses; 133 118 134 119 if(wndclass == NULL) return(NULL); 135 120 136 if( (ULONG)id >> 16!= 0) {137 if(stricmp(wndclass->className , id) == 0 && wndclass->hInstance == hInstance) {121 if(HIWORD(id) != 0) { 122 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 138 123 return(wndclass); 139 124 } 140 125 else { 141 wndclass = wndclass->next;126 wndclass = (Win32WndClass *)wndclass->GetNext(); 142 127 while(wndclass != NULL) { 143 if(stricmp(wndclass->className , id) == 0 && wndclass->hInstance == hInstance) {128 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 144 129 return(wndclass); 145 130 } 146 wndclass = wndclass->next;131 wndclass = (Win32WndClass *)wndclass->GetNext(); 147 132 } 148 133 } … … 153 138 } 154 139 else { 155 wndclass = wndclass->next;140 wndclass = (Win32WndClass *)wndclass->GetNext(); 156 141 while(wndclass != NULL) { 157 142 if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) { 158 143 return(wndclass); 159 144 } 160 wndclass = wndclass->next;145 wndclass = (Win32WndClass *)wndclass->GetNext(); 161 146 } 162 147 } 163 148 } 164 dprintf(("Class %X (inst %X) not found!", id, hInstance) ;149 dprintf(("Class %X (inst %X) not found!", id, hInstance)); 165 150 return(NULL); 166 151 } … … 171 156 wndclass->cbClsExtra = nrExtraClassWords; 172 157 wndclass->cbWndExtra = nrExtraWindowWords; 173 wndclass->hbrBack Ground = backgroundBrush;158 wndclass->hbrBackground = backgroundBrush; 174 159 wndclass->hCursor = hCursor; 175 160 wndclass->hIcon = hIcon; 176 161 wndclass->hInstance = hInstance; 177 wndclass->lpszMenuName = (LPCTSTR)menuName ;178 wndclass->lpszClassName = (className ) ? (LPCTSTR)className: (LPCTSTR)classAtom;162 wndclass->lpszMenuName = (LPCTSTR)menuNameA; 163 wndclass->lpszClassName = (classNameA) ? (LPCTSTR)classNameA : (LPCTSTR)classAtom; 179 164 wndclass->style = windowStyle; 180 165 wndclass->lpfnWndProc = windowProc; … … 188 173 wndclass->cbClsExtra = nrExtraClassWords; 189 174 wndclass->cbWndExtra = nrExtraWindowWords; 190 wndclass->hbrBack Ground = backgroundBrush;175 wndclass->hbrBackground = backgroundBrush; 191 176 wndclass->hCursor = hCursor; 192 177 wndclass->hIcon = hIcon; … … 203 188 ULONG Win32WndClass::getClassName(LPSTR lpszClassName, ULONG cchClassName) 204 189 { 205 if( (ULONG)className >> 16 != 0) {206 strncpy(lpszClassName, className , cchClassName-1);190 if(HIWORD(classNameA)) { 191 strncpy(lpszClassName, classNameA, cchClassName-1); 207 192 return strlen(lpszClassName); 208 193 } … … 216 201 ULONG len; 217 202 218 if((ULONG)classNameW >> 16 != 0) { 219 len = min(UniStrLen((UniChar*)classNameW)+1, cchClassName); 220 memcpy(lpszClassName, classNameW, len*sizeof(WCHAR)); 221 return len; 203 if(HIWORD(classNameW)) { 204 lstrcpyW(lpszClassName, classNameW); 205 return lstrlenW(lpszClassName)*sizeof(WCHAR); 222 206 } 223 207 *(ULONG *)lpszClassName = classAtom; 224 208 return(sizeof(ULONG)); 209 } 210 //****************************************************************************** 211 //****************************************************************************** 212 void Win32WndClass::setMenuName(LPSTR newMenuName) 213 { 214 if(HIWORD(menuNameA)) { 215 free(menuNameA); 216 free(menuNameW); 217 menuNameA = 0; 218 menuNameW = 0; 219 } 220 if(HIWORD(newMenuName)) { 221 if(isUnicode) { 222 menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1); 223 menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR)); 224 } 225 else { 226 menuNameA = (PCHAR)malloc(strlen(newMenuName)+1); 227 menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR)); 228 } 229 if(menuNameA == NULL || menuNameW == NULL) { 230 dprintf(("Win32Class ctr; menuName/menuNameW == NULL")); 231 exit(1); 232 } 233 if(isUnicode) { 234 lstrcpyW(menuNameW, (LPWSTR)newMenuName); 235 UnicodeToAscii(menuNameW, menuNameA); 236 } 237 else { 238 strcpy((char *)menuNameA, newMenuName); 239 AsciiToUnicode(menuNameA, menuNameW); 240 } 241 } 242 else {//id 243 menuNameA = (PCHAR)newMenuName; 244 menuNameW = (WCHAR *)newMenuName; 245 } 225 246 } 226 247 //****************************************************************************** … … 242 263 return hInstance; 243 264 case GCL_MENUNAME: 244 return (isUnicode) ? menuNameW : menuName;265 return (isUnicode) ? (ULONG)menuNameW : (ULONG)menuNameA; 245 266 case GCL_STYLE: 246 267 return windowStyle; 247 268 case GCL_WNDPROC: 248 return windowProc;269 return (ULONG)windowProc; 249 270 case GCW_ATOM: //TODO: does this really happen in windows? 250 271 SetLastError(ERROR_INVALID_PARAMETER); … … 260 281 //****************************************************************************** 261 282 //****************************************************************************** 262 WORD Win32WndClass::getClassWord(int index) ;283 WORD Win32WndClass::getClassWord(int index) 263 284 { 264 285 switch(index) { … … 276 297 //TODO: What effects what immediately? 277 298 //****************************************************************************** 278 ULONG Win32WndClass::setClassLong (int index, LONG lNewVal, BOOL isUnicode);299 ULONG Win32WndClass::setClassLongA(int index, LONG lNewVal, BOOL isUnicode) 279 300 { 280 301 ULONG rc; … … 306 327 break; 307 328 case GCL_MENUNAME: 308 if(isUnicode) { 309 rc = menuNameW; 310 menuNameW = lNewVal; //FIXME 311 } 312 else { 313 rc = menuName; 314 menuName = lNewVal; //FIXME 315 } 329 rc = 0; //old value is meaningless (according to Wine) 330 setMenuName((LPSTR)lNewVal); 316 331 break; 317 332 case GCL_STYLE: … … 320 335 break; 321 336 case GCL_WNDPROC: 322 rc = windowProc;323 windowProc = lNewVal;337 rc = (ULONG)windowProc; 338 windowProc = (WNDPROC)lNewVal; 324 339 break; 325 340 case GCW_ATOM: //TODO: does this really happen in windows? … … 339 354 //****************************************************************************** 340 355 //****************************************************************************** 341 WORD Win32WndClass::setClassWord(int index, WORD wNewVal) ;356 WORD Win32WndClass::setClassWord(int index, WORD wNewVal) 342 357 { 343 358 WORD rc; … … 375 390 //****************************************************************************** 376 391 //****************************************************************************** 377 Win32WndClass *Win32WndClass::wndclasses = NULL; 378 379 //****************************************************************************** 380 //SvL: 18-7-'98: Moved here from user32.cpp 381 //****************************************************************************** 382 ATOM WIN32API OS2RegisterClassA(WNDCLASS *lpWndClass) 383 { 384 WNDCLASSEXA wc; 385 Win32Class *wclass; 386 387 memcpy(&wc, lpWndClass, sizeof(WNDCLASS)); 388 wc.hIconSm = 0; 389 390 wclass = new Win32Class(&wc); 391 if(wclass == NULL) { 392 dprintf(("RegisterClassA wclass == NULL!")); 393 return(0); 394 } 395 return(wclass->getAtom()); 396 } 397 //****************************************************************************** 398 //SvL: 18-7-'98: Moved here from user32.cpp 399 //****************************************************************************** 400 ATOM WIN32API OS2RegisterClassExA(WNDCLASSEXA *lpWndClass) 401 { 402 Win32Class *wclass; 403 404 wclass = new Win32Class(lpWndClass); 405 if(wclass == NULL) { 406 dprintf(("RegisterClassExA wclass == NULL!")); 407 return(0); 408 } 409 return(wclass->getAtom()); 410 } 411 //****************************************************************************** 412 //****************************************************************************** 413 WORD WIN32API OS2RegisterClassW(WNDCLASSW *lpwc) 414 { 415 ATOM rc; 416 WNDCLASSEX wclass; 417 418 dprintf(("RegisterClassW\n")); 419 memcpy(&wclass, lpwc, sizeof(WNDCLASS)); 420 if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) { 421 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName); 422 } 423 if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) { 424 wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName); 425 } 426 rc = OS2RegisterClassA(&wclass); 427 428 if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) { 429 FreeAsciiString((char *)wclass.lpszMenuName); 430 } 431 if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) { 432 FreeAsciiString((char *)wclass.lpszClassName); 433 } 434 return(rc); 435 } 436 //****************************************************************************** 437 //****************************************************************************** 438 ATOM WIN32API OS2RegisterClassExW(CONST WNDCLASSEXW *lpwc) 439 { 440 ATOM rc; 441 WNDCLASSEXA wclass; 442 443 dprintf(("RegisterClassExW\n")); 444 memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA)); 445 if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) { 446 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName); 447 } 448 if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) { 449 wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName); 450 } 451 rc = OS2RegisterClassExA(&wclass); 452 453 if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) { 454 FreeAsciiString((char *)wclass.lpszMenuName); 455 } 456 if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) { 457 FreeAsciiString((char *)wclass.lpszClassName); 458 } 459 return(rc); 460 } 461 //****************************************************************************** 462 //****************************************************************************** 463 BOOL WIN32API OS2UnregisterClassA(LPCSTR lpszClassName, HINSTANCE hinst) 464 { 465 dprintf(("USER32: OS2UnregisterClassA\n")); 466 Win32WndClass::UnregisterClass(hinst, (LPSTR)lpszClassName); 467 468 //Spintest returns FALSE in dll termination, so pretend it succeeded 469 return(TRUE); 470 } 471 //****************************************************************************** 472 //****************************************************************************** 473 BOOL WIN32API OS2UnregisterClassW(LPWSTR lpszClassName, HINSTANCE hinst) 474 { 475 char *astring = NULL; 476 477 dprintf(("USER32: OS2UnregisterClassW\n")); 478 if((ULONG)lpszClassName >> 16 != 0) { 479 astring = UnicodeToAsciiString(lpszClassName); 480 } 481 else astring = (char *)lpszClassName; 482 483 Win32WndClass::UnregisterClass(hinst, (LPSTR)astring); 484 if(astring >> 16 != 0) 485 FreeAsciiString((char *)astring); 486 //Spintest returns FALSE in dll termination, so pretend it succeeded 487 return(TRUE); 488 } 489 //****************************************************************************** 490 //****************************************************************************** 491 BOOL WIN32API OS2GetClassInfoA(HINSTANCE hInstance, LPCSTR lpszClass, PWNDCLASSA lpwc) 492 { 493 WNDCLASSEXA wc; 494 BOOL rc; 495 Win32WndClass *wndclass; 496 497 dprintf(("USER32: OS2GetClassInfoA\n")); 498 499 wndclass = FindClass(hInstance, lpszClass); 500 if(wndclass) { 501 wndclass->getClassInfo(&wc); 502 memcpy(lpwc, &wc, sizeof(WNDCLASSA)); 503 return(TRUE); 504 } 505 return(FALSE); 506 } 507 //****************************************************************************** 508 //****************************************************************************** 509 BOOL WIN32API OS2GetClassInfoW(HINSTANCE hinst, LPWSTR lpszClass, PWNDCLASSW lpwc) 510 { 511 WNDCLASSEXW wc; 512 BOOL rc; 513 Win32WndClass *wndclass; 514 char *astring = NULL; 515 516 dprintf(("USER32: OS2GetClassInfoW\n")); 517 518 if((ULONG)lpszClass >> 16 != 0) { 519 astring = UnicodeToAsciiString(lpszClass); 520 } 521 else astring = (char *)lpszClass; 522 523 wndclass = FindClass(hInstance, astring); 524 if((ULONG)astring >> 16 != 0) 525 FreeAsciiString((char *)astring); 526 if(wndclass) { 527 wndclass->getClassInfo(&wc); 528 memcpy(lpwc, &wc, sizeof(WNDCLASSW)); 529 return(TRUE); 530 } 531 return(FALSE); 532 } 533 /**************************************************************************** 534 * Name : BOOL WIN32API OS2GetClassInfoExA 535 * Purpose : The GetClassInfoEx function retrieves information about a window 536 * class, including the handle of the small icon associated with the 537 * window class. GetClassInfo does not retrieve the handle of the small icon. 538 * Parameters: HINSTANCE hinst handle of application instance 539 * LPCTSTR lpszClass address of class name string 540 * LPWNDCLASSEX lpwcx address of structure for class data 541 * Variables : 542 * Result : If the function finds a matching class and successfully copies 543 * the data, the return value is TRUE; 544 * otherwise, it is FALSE. 545 * To get extended error information, call GetLastError. 546 * Remark : PH: does not obtain handle of the small icon 547 *****************************************************************************/ 548 BOOL WIN32API OS2GetClassInfoExA(HINSTANCE hInstance, 549 LPCTSTR lpszClass, 550 LPWNDCLASSEXA lpwcx) 551 { 552 BOOL rc; 553 Win32WndClass *wndclass; 554 555 dprintf(("USER32:GetClassInfoExA (%08xh,%x,%08x).\n", 556 hInstance, 557 lpszClass, 558 lpwcx)); 559 560 wndclass = FindClass(hInstance, lpszClass); 561 if(wndclass) { 562 wndclass->getClassInfo(lpwcx); 563 return(TRUE); 564 } 565 return(FALSE); 566 } 567 /***************************************************************************** 568 * Name : BOOL WIN32API OS2GetClassInfoExW 569 * Purpose : The GetClassInfoEx function retrieves information about a window 570 * class, including the handle of the small icon associated with the 571 * window class. GetClassInfo does not retrieve the handle of the small icon. 572 * Parameters: HINSTANCE hinst handle of application instance 573 * LPCWSTR lpszClass address of class name string 574 * LPWNDCLASSEX lpwcx address of structure for class data 575 * Variables : 576 * Result : If the function finds a matching class and successfully copies 577 * the data, the return value is TRUE; 578 * otherwise, it is FALSE. 579 * To get extended error information, call GetLastError. 580 * Remark : does not obtain handle of the small icon 581 * 582 *****************************************************************************/ 583 BOOL WIN32API OS2GetClassInfoExW(HINSTANCE hInstance, 584 LPCWSTR lpszClass, 585 LPWNDCLASSEXW lpwcx) 586 { 587 BOOL rc; 588 Win32WndClass *wndclass; 589 char *astring = NULL; 590 591 dprintf(("USER32: OS2GetClassInfoExW\n")); 592 593 if((ULONG)lpszClass >> 16 != 0) { 594 astring = UnicodeToAsciiString(lpszClass); 595 } 596 else astring = (char *)lpszClass; 597 598 wndclass = FindClass(hInstance, astring); 599 if((ULONG)astring >> 16 != 0) 600 FreeAsciiString((char *)astring); 601 if(wndclass) { 602 wndclass->getClassInfo(lpwcx); 603 return(TRUE); 604 } 605 return(FALSE); 606 } 607 //****************************************************************************** 608 //****************************************************************************** 609 int WIN32API OS2GetClassNameA(HWND hwnd, LPSTR lpszClassName, int cchClassName) 610 { 611 Win32Window *wnd; 612 613 dprintf(("USER32: OS2GetClassNameA\n")); 614 wnd = WIN2OS2HWND(hwnd); 615 if(wnd == NULL) { 616 dprintf(("GetClassNameA wnd == NULL")); 617 return(0); 618 } 619 return (wnd->getClass())->getClassName(lpszClassName, cchClassName); 620 } 621 //****************************************************************************** 622 //****************************************************************************** 623 int WIN32API OS2GetClassNameW(HWND hwnd, LPWSTR lpszClassName, int cchClassName) 624 { 625 Win32Window *wnd; 626 627 dprintf(("USER32: OS2GetClassNameW\n")); 628 wnd = WIN2OS2HWND(hwnd); 629 if(wnd == NULL) { 630 dprintf(("GetClassNameA wnd == NULL")); 631 return(0); 632 } 633 return (wnd->getClass())->getClassName(lpszClassName, cchClassName); 634 } 635 //****************************************************************************** 636 //****************************************************************************** 637 DWORD WIN32API OS2SetClassLongA(HWND hwnd, int nIndex, LONG lNewVal) 638 { 639 Win32Window *wnd; 640 641 dprintf(("USER32: OS2SetClassLongA\n")); 642 wnd = WIN2OS2HWND(hwnd); 643 if(wnd == NULL) { 644 dprintf(("SetClassLongA wnd == NULL")); 645 return(0); 646 } 647 return (wnd->getClass())->setClassLongA(nIndex, lNewVal); 648 } 649 //****************************************************************************** 650 //****************************************************************************** 651 DWORD WIN32API OS2SetClassLongW(HWND hwnd, int nIndex, LONG lNewVal) 652 { 653 Win32Window *wnd; 654 655 dprintf(("USER32: OS2SetClassLongW\n")); 656 wnd = WIN2OS2HWND(hwnd); 657 if(wnd == NULL) { 658 dprintf(("SetClassLongW wnd == NULL")); 659 return(0); 660 } 661 return (wnd->getClass())->setClassLongW(nIndex, lNewVal); 662 } 663 //****************************************************************************** 664 //****************************************************************************** 665 WORD WIN32API OS2SetClassWord(HWND hwnd, int nIndex, WORD wNewVal) 666 { 667 Win32Window *wnd; 668 669 dprintf(("USER32: OS2SetClassWordA\n")); 670 wnd = WIN2OS2HWND(hwnd); 671 if(wnd == NULL) { 672 dprintf(("SetClassWordA wnd == NULL")); 673 return(0); 674 } 675 return (wnd->getClass())->setClassWord(nIndex, wNewVal); 676 } 677 //****************************************************************************** 678 //****************************************************************************** 679 WORD WIN32API OS2GetClassWord(HWND hwnd, int nIndex) 680 { 681 Win32Window *wnd; 682 683 dprintf(("USER32: OS2GetClassWordA\n")); 684 wnd = WIN2OS2HWND(hwnd); 685 if(wnd == NULL) { 686 dprintf(("GetClassWordA wnd == NULL")); 687 return(0); 688 } 689 return (wnd->getClass())->getClassWord(nIndex); 690 } 691 //****************************************************************************** 692 //****************************************************************************** 693 DWORD WIN32API OS2GetClassLongA(HWND hwnd, int nIndex) 694 { 695 Win32Window *wnd; 696 697 dprintf(("USER32: OS2GetClassLongA\n")); 698 wnd = WIN2OS2HWND(hwnd); 699 if(wnd == NULL) { 700 dprintf(("OS2GetClassLongA wnd == NULL")); 701 return(0); 702 } 703 return (wnd->getClass())->getClassLongA(nIndex); 704 } 705 //****************************************************************************** 706 //****************************************************************************** 707 DWORD WIN32API OS2GetClassLongW(HWND hwnd, int nIndex) 708 { 709 Win32Window *wnd; 710 711 dprintf(("USER32: OS2GetClassLongW\n")); 712 wnd = WIN2OS2HWND(hwnd); 713 if(wnd == NULL) { 714 dprintf(("OS2GetClassLongW wnd == NULL")); 715 return(0); 716 } 717 return (wnd->getClass())->getClassLongW(nIndex); 718 } 719 //****************************************************************************** 720 //****************************************************************************** 392 GenericObject *Win32WndClass::wndclasses = NULL; 393 -
trunk/src/user32/new/win32class.h
r4 r300 1 /* $Id: win32class.h,v 1.1 1999-05-24 20:20:04 ktk Exp $ */ 2 1 /* $Id: win32class.h,v 1.2 1999-07-14 08:35:37 sandervl Exp $ */ 2 /* 3 * Win32 Window Class Managment Code for OS/2 4 * 5 * 6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 8 */ 3 9 #ifndef __WIN32CLASS_H__ 4 10 #define __WIN32CLASS_H__ 5 11 6 //SvL: 18-7-'98, Registers system window classes (button, listbox etc etc) 7 extern "C" { 8 void RegisterSystemClasses(ULONG hModule); 9 } 12 #include <gen_object.h> 10 13 11 class Win32WndClass 14 class Win32WndClass : public GenericObject 12 15 { 13 16 public: 14 Win32WndClass(WNDCLASSEXA wndclass, BOOL isUnicode);17 Win32WndClass(WNDCLASSEXA *wndclass, BOOL isUnicode = FALSE); 15 18 ~Win32WndClass(); 16 19 … … 36 39 ULONG getClassName(LPWSTR lpszClassName, ULONG cchClassName); 37 40 41 WNDPROC getWindowProc() { return windowProc; }; 42 LPSTR getMenuNameA() { return menuNameA; }; 43 DWORD getExtraWndWords() { return nrExtraWindowWords; }; 44 45 void setMenuName(LPSTR newMenuName); 46 47 void IncreaseWindowCount() { cWindows++; }; 48 void DecreaseWindowCount() { cWindows--; }; 49 DWORD GetWindowCount() { return cWindows; }; 50 38 51 static void UnregisterClassA(HINSTANCE hinst, LPSTR id); 39 52 … … 50 63 HICON hIcon; //GCL_HICON 51 64 HINSTANCE hInstance; //GCL_HMODULE 52 ULONG menuName; //GCL_MENUNAME53 ULONGmenuNameW; //GCL_MENUNAME65 PCHAR menuNameA; //GCL_MENUNAME 66 WCHAR *menuNameW; //GCL_MENUNAME 54 67 ULONG windowStyle; //GCL_STYLE 55 W INWNDPROCwindowProc; //GCL_WNDPROC68 WNDPROC windowProc; //GCL_WNDPROC 56 69 ULONG classAtom; //GCW_ATOM 57 70 58 ULONG className;59 ULONGclassNameW;71 PCHAR classNameA; 72 WCHAR *classNameW; 60 73 HICON hIconSm; 61 74 62 75 //User data class words/longs 63 76 ULONG *userClassLong; 77 78 //nr of windows created with this class 79 ULONG cWindows; 64 80 65 static Win32WndClass *wndclasses; 66 Win32WndClass *next; 81 static GenericObject *wndclasses; 67 82 }; 68 83 -
trunk/src/user32/new/win32dlg.h
r4 r300 1 /* $Id: win32dlg.h,v 1.1 1999-05-24 20:20:04 ktk Exp $ */ 2 1 /* $Id: win32dlg.h,v 1.2 1999-07-14 08:35:37 sandervl Exp $ */ 2 /* 3 * Win32 Dialog Code for OS/2 4 * 5 * 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 8 * 9 * Project Odin Software License can be found in LICENSE.TXT 10 * 11 */ 3 12 #ifndef __WIN32DLG_H__ 4 13 #define __WIN32DLG_H__ 5 14 6 #include "win32wnd.h"15 #include <win32wnd.h> 7 16 8 17 #ifdef __cplusplus 9 18 10 class Win32Dialog : Win32Window19 class Win32Dialog : public Win32Window 11 20 { 12 21 public: 13 Win32Dialog( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);22 Win32Dialog(); 14 23 virtual ~Win32Dialog(); 15 24 16 MRESULT ProcessDlgMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);25 virtual ULONG MsgOS2Create(HWND hwndOS2, ULONG initParam); 17 26 18 virtual BOOL SetWindowLong(int index, ULONG value);19 virtual ULONG GetWindowLong (int index);27 virtual LONG SetWindowLongA(int index, ULONG value); 28 virtual ULONG GetWindowLongA(int index); 20 29 21 30 protected: 22 31 // values normally contained in the standard dialog words 23 WINDLGPROC Win32DlgProc; //DWL_WNDPROC32 DLGPROC Win32DlgProc; //DWL_WNDPROC 24 33 ULONG msgResult; //DWL_MSGRESULT 25 34 ULONG userDlgData; //DWL_USER 26 35 27 36 private: 28 29 30 37 }; 31 38 -
trunk/src/user32/new/win32wnd.h
r4 r300 1 /* $Id: win32wnd.h,v 1.1 1999-05-24 20:20:05 ktk Exp $ */ 2 1 /* $Id: win32wnd.h,v 1.2 1999-07-14 08:35:37 sandervl Exp $ */ 2 /* 3 * Win32 Window Code for OS/2 4 * 5 * 6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 8 * 9 * Project Odin Software License can be found in LICENSE.TXT 10 * 11 */ 3 12 #ifndef __WIN32WND_H__ 4 13 #define __WIN32WND_H__ … … 6 15 #ifdef __cplusplus 7 16 8 #include "win32class.h" 17 #include <win32class.h> 18 #include <gen_object.h> 9 19 10 #define WIN2OS2HWND(a) (a^a) 20 class Win32Window; 21 22 #define WIN2OS2HWND(a) (Win32Window*)(a^a) 11 23 #define OS22WINHWND(a) (a^a) 12 24 13 //Win32 window message handler 14 typedef LRESULT (* WIN32API WINWNDPROC) ( HWND, UINT, WPARAM, LPARAM ); 25 #define OFFSET_WIN32WNDPTR 0 26 #define OFFSET_WIN32PM_MAGIC 4 15 27 16 class Win32Window 28 #define WIN32PM_MAGIC 0x12345678 29 30 typedef struct { 31 USHORT cb; 32 Win32Window *win32wnd; 33 ULONG win32CreateStruct; //or dialog create dword 34 } CUSTOMWNDDATA; 35 36 class Win32Window : public GenericObject 17 37 { 18 38 public: 19 Win32Window(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 39 DWORD magic; 40 41 Win32Window(DWORD objType); 42 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode); 20 43 virtual ~Win32Window(); 21 44 22 MRESULT ProcessMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 45 virtual ULONG MsgCreate(HWND hwndOS2, ULONG initParam); 46 ULONG MsgQuit(); 47 ULONG MsgClose(); 48 ULONG MsgDestroy(); 49 ULONG MsgEnable(BOOL fEnable); 50 ULONG MsgShow(BOOL fShow); 51 ULONG MsgMove(ULONG xScreen, ULONG yScreen, ULONG xParent, ULONG yParent); 52 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize); 53 ULONG MsgActivate(BOOL fActivate, HWND hwnd); 54 ULONG MsgSetFocus(HWND hwnd); 55 ULONG MsgKillFocus(HWND hwnd); 56 ULONG MsgButton(ULONG msg, ULONG x, ULONG y); 57 ULONG MsgPaint(ULONG tmp1, ULONG tmp2); 58 ULONG MsgEraseBackGround(ULONG hps); 23 59 24 virtual BOOL SetWindowLong(int index, ULONG value); 25 virtual ULONG GetWindowLong(int index); 60 virtual LONG SetWindowLongA(int index, ULONG value); 61 virtual ULONG GetWindowLongA(int index); 62 virtual WORD SetWindowWord(int index, WORD value); 63 virtual WORD GetWindowWord(int index); 26 64 27 BOOL PostMessageA(HWND hwnd, ULONG msg, WPARAM wParam, LPARAM lParam); 28 BOOL PostMessageW(HWND hwnd, ULONG msg, WPARAM wParam, LPARAM lParam); 65 DWORD getStyle() { return dwStyle; }; 66 DWORD getExStyle() { return dwExStyle; }; 67 HWND getWindowHandle() { return Win32Hwnd; }; 68 HWND getOS2WindowHandle() { return OS2Hwnd; }; 69 Win32Window *getParent() { return parent; }; 70 void setParent(Win32Window *pwindow) { parent = pwindow; }; 71 WNDPROC getWindowProc() { return win32wndproc; }; 72 void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; }; 73 DWORD getWindowId() { return windowId; }; 74 void setWindowId(DWORD id) { windowId = id; }; 75 76 LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); 77 LRESULT SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam); 78 LRESULT DefWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 79 LRESULT DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 80 81 void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam); 29 82 30 83 Win32WndClass *getClass() { return windowClass; }; 31 84 32 85 protected: 86 void Init(); 87 88 33 89 HWND OS2Hwnd; 34 90 HWND Win32Hwnd; … … 38 94 39 95 // values normally contained in the standard window words 40 ULONG ExtendedWindowStyle; //GWL_EXSTYLE 41 ULONG WindowStyle; //GWL_STYLE 42 //ptr to WINWNDPROC in windowClass 43 WINWNDPROC *win32wndproc; //GWL_WNDPROC 96 ULONG dwExStyle; //GWL_EXSTYLE 97 ULONG dwStyle; //GWL_STYLE 98 WNDPROC win32wndproc; //GWL_WNDPROC 44 99 ULONG hInstance; //GWL_HINSTANCE 45 HWND hwndParent;//GWL_HWNDPARENT100 Win32Window *parent; //GWL_HWNDPARENT 46 101 ULONG windowId; //GWL_ID 47 102 ULONG userData; //GWL_USERDATA 103 104 HWND hwndLinkAfter; 105 DWORD flags; 106 107 Win32Window *owner; 108 109 char *windowName; 110 ULONG wndNameLength; 48 111 49 112 char *windowText; 50 113 ULONG wndTextLength; 51 114 52 ULONG * UserWindowLong;115 ULONG *userWindowLong; 53 116 ULONG nrUserWindowLong; 54 117 55 118 Win32WndClass *windowClass; 56 119 57 Win32Window *parent; 58 Win32Window *child; 59 Win32Window *nextchild; 120 static GenericObject *windows; 60 121 61 122 private: 123 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom); 124 125 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); 126 }; 62 127 63 128 64 }; 65 129 #define BUTTON_LEFTDOWN 0 130 #define BUTTON_LEFTUP 1 131 #define BUTTON_LEFTDBLCLICK 2 132 #define BUTTON_RIGHTUP 3 133 #define BUTTON_RIGHTDOWN 4 134 #define BUTTON_RIGHTDBLCLICK 5 66 135 67 136 #endif //__cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.