| 1 | /*
|
|---|
| 2 | * Native resource management (dialogs, bitmaps, ...)
|
|---|
| 3 | *
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) 1999 Christoph Bratschi (cbratschi@datacomm.ch)
|
|---|
| 6 | *
|
|---|
| 7 | *
|
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #include <os2win.h>
|
|---|
| 13 | #include "user32.h"
|
|---|
| 14 | #include "wndproc.h"
|
|---|
| 15 | #include "wndclass.h"
|
|---|
| 16 |
|
|---|
| 17 | //******************************************************************************
|
|---|
| 18 | // CB: Loads and starts a native OS/2 dialog with Win32 DlgProc
|
|---|
| 19 | // (used in COMCTL32)
|
|---|
| 20 | // full name: NativeDialogBoxIndirectParam
|
|---|
| 21 | //******************************************************************************
|
|---|
| 22 | INT WINAPI NativeDlgBoxIP(HMODULE hmodule,
|
|---|
| 23 | HINSTANCE hinst, LPCSTR lpszName,
|
|---|
| 24 | HWND hwndParent, DLGPROC dlgproc,
|
|---|
| 25 | LPARAM lParamInit)
|
|---|
| 26 | {
|
|---|
| 27 | BOOL rc;
|
|---|
| 28 | DLGTEMPLATE *os2dlg;
|
|---|
| 29 | HRSRC hRes;
|
|---|
| 30 | /* //CB: synchronize with new dialog.cpp code
|
|---|
| 31 | dprintf(("NativeDlgBoxIP"));
|
|---|
| 32 |
|
|---|
| 33 | hRes = O32_FindResource(hmodule,lpszName,RT_DIALOGA);
|
|---|
| 34 | if (hRes == 0) return (INT)-1;
|
|---|
| 35 |
|
|---|
| 36 | dprintf((" hRes = %d",hRes));
|
|---|
| 37 |
|
|---|
| 38 | os2dlg = (DLGTEMPLATE*)O32_LoadResource(hmodule,hRes);
|
|---|
| 39 | if (os2dlg == NULL) return (INT)-1;
|
|---|
| 40 |
|
|---|
| 41 | dprintf((" os2dlg = %d",os2dlg));
|
|---|
| 42 |
|
|---|
| 43 | Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)dlgproc,os2dlg);
|
|---|
| 44 | rc = O32_DialogBoxIndirectParam(hinst,os2dlg,hwndParent,(DLGPROC_O32)dialog->GetOS2Callback(),lParamInit);
|
|---|
| 45 | //dialog already destroyed when this returns
|
|---|
| 46 | dprintf(("NativeDlgBoxIP returned %X\n", rc));
|
|---|
| 47 | */
|
|---|
| 48 | return rc;
|
|---|
| 49 | }
|
|---|
| 50 | //******************************************************************************
|
|---|
| 51 | // CB: Loads and starts a native OS/2 dialog with Win32 DlgProc
|
|---|
| 52 | // (used in COMCTL32)
|
|---|
| 53 | // full name: NativeCreateDialogIndirectParam
|
|---|
| 54 | //******************************************************************************
|
|---|
| 55 | INT WINAPI NativeCreateDlgIP(HMODULE hmodule,
|
|---|
| 56 | HINSTANCE hinst, LPCSTR lpszName,
|
|---|
| 57 | HWND hwndParent, DLGPROC dlgproc,
|
|---|
| 58 | LPARAM lParamInit)
|
|---|
| 59 | {
|
|---|
| 60 | BOOL rc;
|
|---|
| 61 | DLGTEMPLATE *os2dlg;
|
|---|
| 62 | HRSRC hRes;
|
|---|
| 63 | /* //CB: synchronize with new dialog.cpp code
|
|---|
| 64 | dprintf(("NativeCreateDlgBoxIP"));
|
|---|
| 65 |
|
|---|
| 66 | hRes = O32_FindResource(hmodule,lpszName,RT_DIALOGA);
|
|---|
| 67 | if (hRes == 0) return (INT)-1;
|
|---|
| 68 |
|
|---|
| 69 | dprintf((" hRes = %d",hRes));
|
|---|
| 70 |
|
|---|
| 71 | os2dlg = (DLGTEMPLATE*)O32_LoadResource(hmodule,hRes);
|
|---|
| 72 | if (os2dlg == NULL) return (INT)-1;
|
|---|
| 73 |
|
|---|
| 74 | dprintf((" os2dlg = %d",os2dlg));
|
|---|
| 75 |
|
|---|
| 76 | Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)dlgproc,os2dlg);
|
|---|
| 77 | rc = O32_CreateDialogIndirectParam(hinst,os2dlg,hwndParent,(DLGPROC_O32)dialog->GetOS2Callback(),lParamInit);
|
|---|
| 78 | //dialog already destroyed when this returns
|
|---|
| 79 | dprintf(("NativeDlgBoxIP returned %X\n", rc));
|
|---|
| 80 | */
|
|---|
| 81 | return rc;
|
|---|
| 82 | }
|
|---|
| 83 | //******************************************************************************
|
|---|
| 84 | // CB: loads OS/2 bitmaps
|
|---|
| 85 | //******************************************************************************
|
|---|
| 86 | HBITMAP WINAPI NativeLoadBitmap(HINSTANCE hInstance,LPCTSTR lpBitmapName)
|
|---|
| 87 | {
|
|---|
| 88 | return O32_LoadBitmap(hInstance,lpBitmapName);
|
|---|
| 89 | }
|
|---|