| 1 | /* $Id: winaccel.cpp,v 1.2 1999-10-24 12:30:29 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Win32 accelartor key functions for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright 1999 Sander van Leeuwen | 
|---|
| 6 | * | 
|---|
| 7 | * | 
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 9 | * | 
|---|
| 10 | */ | 
|---|
| 11 | #include <os2win.h> | 
|---|
| 12 | #include <misc.h> | 
|---|
| 13 | #include <win32wbase.h> | 
|---|
| 14 |  | 
|---|
| 15 | //****************************************************************************** | 
|---|
| 16 | //****************************************************************************** | 
|---|
| 17 | HACCEL WIN32API LoadAcceleratorsA(HINSTANCE hinst, LPCSTR lpszAcc) | 
|---|
| 18 | { | 
|---|
| 19 | HACCEL rc; | 
|---|
| 20 |  | 
|---|
| 21 | rc = (HACCEL)FindResourceA(hinst, lpszAcc, RT_ACCELERATORA); | 
|---|
| 22 |  | 
|---|
| 23 | dprintf(("LoadAcceleratorsA returned %d\n", rc)); | 
|---|
| 24 | return(rc); | 
|---|
| 25 | } | 
|---|
| 26 | //****************************************************************************** | 
|---|
| 27 | //****************************************************************************** | 
|---|
| 28 | HACCEL WIN32API LoadAcceleratorsW(HINSTANCE hinst, LPCWSTR lpszAccel) | 
|---|
| 29 | { | 
|---|
| 30 | HACCEL rc; | 
|---|
| 31 |  | 
|---|
| 32 | rc = (HACCEL)FindResourceW(hinst, lpszAccel, RT_ACCELERATORW); | 
|---|
| 33 |  | 
|---|
| 34 | dprintf(("LoadAcceleratorsW returned %d\n", rc)); | 
|---|
| 35 | return(rc); | 
|---|
| 36 | } | 
|---|
| 37 | //****************************************************************************** | 
|---|
| 38 | //****************************************************************************** | 
|---|
| 39 | BOOL WIN32API DestroyAcceleratorTable( HACCEL haccel) | 
|---|
| 40 | { | 
|---|
| 41 | Win32Resource *winres; | 
|---|
| 42 |  | 
|---|
| 43 | if(HIWORD(haccel) == 0) { | 
|---|
| 44 | dprintf(("DestroyAcceleratorTable: invalid haccel %x", haccel)); | 
|---|
| 45 | SetLastError(ERROR_INVALID_PARAMETER); | 
|---|
| 46 | return FALSE; | 
|---|
| 47 | } | 
|---|
| 48 | dprintf(("DestroyAcceleratorTable %x\n", haccel)); | 
|---|
| 49 | winres = (Win32Resource *)haccel; | 
|---|
| 50 | delete winres; | 
|---|
| 51 | return TRUE; | 
|---|
| 52 | } | 
|---|
| 53 | //****************************************************************************** | 
|---|
| 54 | //TODO: Do more than just return? | 
|---|
| 55 | //****************************************************************************** | 
|---|
| 56 | int WIN32API TranslateAcceleratorA(HWND hwnd, HACCEL haccel, LPMSG lpmsg) | 
|---|
| 57 | { | 
|---|
| 58 | Win32BaseWindow *window; | 
|---|
| 59 |  | 
|---|
| 60 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 61 | if(!window) { | 
|---|
| 62 | //Msg for (non-client) child of our frame window | 
|---|
| 63 | //      dprintf(("TranslateAcceleratorA, window %x not found", hwnd)); | 
|---|
| 64 | return FALSE; | 
|---|
| 65 | } | 
|---|
| 66 | if(window->GetAccelTable() != haccel) { | 
|---|
| 67 | dprintf(("TranslateAcceleratorA %X %X %X", hwnd, haccel, lpmsg->hwnd)); | 
|---|
| 68 | window->SetAccelTable(haccel); | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | //SvL: OS/2 automatically translates accelerator keys | 
|---|
| 72 | return FALSE; | 
|---|
| 73 | } | 
|---|
| 74 | //****************************************************************************** | 
|---|
| 75 | //****************************************************************************** | 
|---|
| 76 | int WIN32API TranslateAcceleratorW( HWND hwnd, HACCEL hAccel, LPMSG lpMsg) | 
|---|
| 77 | { | 
|---|
| 78 | return TranslateAcceleratorA(hwnd, hAccel, lpMsg); | 
|---|
| 79 | } | 
|---|
| 80 | //****************************************************************************** | 
|---|
| 81 | //****************************************************************************** | 
|---|
| 82 | BOOL WIN32API TranslateMDISysAccel( HWND arg1, LPMSG  arg2) | 
|---|
| 83 | { | 
|---|
| 84 | #ifdef DEBUG | 
|---|
| 85 | ////    WriteLog("USER32:  TranslateMDISysAccel\n"); | 
|---|
| 86 | #endif | 
|---|
| 87 | return O32_TranslateMDISysAccel(arg1, arg2); | 
|---|
| 88 | } | 
|---|
| 89 | //****************************************************************************** | 
|---|
| 90 | //****************************************************************************** | 
|---|
| 91 | HACCEL WIN32API CreateAcceleratorTableA( LPACCEL arg1, int  arg2) | 
|---|
| 92 | { | 
|---|
| 93 | #ifdef DEBUG | 
|---|
| 94 | WriteLog("USER32:  CreateAcceleratorTableA\n"); | 
|---|
| 95 | #endif | 
|---|
| 96 | return O32_CreateAcceleratorTable(arg1, arg2); | 
|---|
| 97 | } | 
|---|
| 98 | //****************************************************************************** | 
|---|
| 99 | //****************************************************************************** | 
|---|
| 100 | HACCEL WIN32API CreateAcceleratorTableW( LPACCEL arg1, int  arg2) | 
|---|
| 101 | { | 
|---|
| 102 | #ifdef DEBUG | 
|---|
| 103 | WriteLog("USER32:  CreateAcceleratorTableW\n"); | 
|---|
| 104 | #endif | 
|---|
| 105 | // NOTE: This will not work as is (needs UNICODE support) | 
|---|
| 106 | return O32_CreateAcceleratorTable(arg1, arg2); | 
|---|
| 107 | } | 
|---|
| 108 | //****************************************************************************** | 
|---|
| 109 | //****************************************************************************** | 
|---|
| 110 | int WIN32API CopyAcceleratorTableA(HACCEL hAccelSrc, LPACCEL lpAccelDest, | 
|---|
| 111 | int cAccelEntries) | 
|---|
| 112 | { | 
|---|
| 113 | #ifdef DEBUG | 
|---|
| 114 | WriteLog("USER32:  CopyAcceleratorTableA, not implemented\n"); | 
|---|
| 115 | #endif | 
|---|
| 116 | return(0); | 
|---|
| 117 | } | 
|---|
| 118 | //****************************************************************************** | 
|---|
| 119 | //TODO: | 
|---|
| 120 | //****************************************************************************** | 
|---|
| 121 | int WIN32API CopyAcceleratorTableW(HACCEL hAccelSrc, LPACCEL lpAccelDest, | 
|---|
| 122 | int cAccelEntries) | 
|---|
| 123 | { | 
|---|
| 124 | #ifdef DEBUG | 
|---|
| 125 | WriteLog("USER32:  CopyAcceleratorTableW, not implemented\n"); | 
|---|
| 126 | #endif | 
|---|
| 127 | return(0); | 
|---|
| 128 | } | 
|---|
| 129 | //****************************************************************************** | 
|---|
| 130 | //****************************************************************************** | 
|---|