- Timestamp:
- Jul 20, 1999, 5:46:54 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/icon.cpp
r300 r345 1 /* $Id: icon.cpp,v 1. 1 1999-07-14 08:35:34sandervl Exp $ */1 /* $Id: icon.cpp,v 1.2 1999-07-20 15:46:53 sandervl Exp $ */ 2 2 3 /*4 *5 * Project Odin Software License can be found in LICENSE.TXT6 *7 */8 3 /* 9 4 * Win32 icon conversion functions for OS/2 10 5 * 11 6 * Copyright 1998 Sander van Leeuwen 7 * 8 * 9 * Project Odin Software License can be found in LICENSE.TXT 12 10 * 13 11 */ -
trunk/src/user32/new/loadres.cpp
r342 r345 1 /* $Id: loadres.cpp,v 1. 3 1999-07-20 07:42:35sandervl Exp $ */1 /* $Id: loadres.cpp,v 1.4 1999-07-20 15:46:53 sandervl Exp $ */ 2 2 3 3 /* … … 37 37 HICON rc; 38 38 39 if((int)lpszIcon >> 16 != 0) {//convert string name identifier to numeric id 40 dprintf(("LoadIcon %s\n", lpszIcon)); 41 lpszIcon = (LPCSTR)ConvertNameId(hinst, (char *)lpszIcon); 42 } 43 else dprintf(("LoadIcon %d\n", (int)lpszIcon)); 39 rc = (HICON)FindResourceA(hinst, lpszIcon, RT_ICONA); 40 dprintf(("LoadIconA (%X) returned %d\n", hinst, rc)); 41 return(rc); 42 } 43 //****************************************************************************** 44 //****************************************************************************** 45 HICON WIN32API LoadIconW(HINSTANCE hinst, LPCWSTR lpszIcon) 46 { 47 HICON rc; 44 48 45 rc = O32_LoadIcon(hinst, lpszIcon); 46 47 dprintf(("LoadIcon returned %d\n", rc)); 49 rc = (HICON)FindResourceW(hinst, lpszIcon, RT_ICONW); 50 dprintf(("LoadIconW (%X) returned %d\n", hinst, rc)); 48 51 return(rc); 49 52 } … … 134 137 } 135 138 //****************************************************************************** 136 //******************************************************************************137 HICON WIN32API LoadIconW(HINSTANCE hinst, LPCWSTR lpszIcon)138 {139 char *astring = NULL;140 HICON rc;141 142 if((int)lpszIcon >> 16 != 0) {//convert string name identifier to numeric id143 astring = UnicodeToAsciiString((LPWSTR)lpszIcon);144 145 dprintf(("lpszIcon %s\n", astring));146 lpszIcon = (LPWSTR)ConvertNameId(hinst, (char *)astring);147 }148 else dprintf(("lpszIcon %d\n", (int)lpszIcon));149 150 rc = O32_LoadIcon(hinst, (char *)lpszIcon);151 if(astring)152 FreeAsciiString(astring);153 154 dprintf(("LoadIconW returned %d\n", rc));155 return(rc);156 }157 //******************************************************************************158 //******************************************************************************159 //******************************************************************************160 139 //TODO: Far from complete, but works for loading resources from exe 161 140 //fuLoad flag ignored -
trunk/src/user32/new/makefile
r342 r345 1 # $Id: makefile,v 1.1 3 1999-07-20 07:42:35sandervl Exp $1 # $Id: makefile,v 1.14 1999-07-20 15:46:53 sandervl Exp $ 2 2 3 3 # … … 31 31 controls.obj button.obj oslibutil.obj oslibmsg.obj windlg.obj \ 32 32 winprop.obj wingdi.obj oslibgdi.obj winaccel.obj winscrollbar.obj \ 33 nativerc.obj 33 nativerc.obj oslibres.obj 34 34 35 35 … … 91 91 pmwindow.obj: pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h oslibgdi.h 92 92 win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h 93 win32wnd.obj: win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h $(PDWIN32_INCLUDE)\winres.h 93 win32wnd.obj: win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h $(PDWIN32_INCLUDE)\winres.h oslibres.h 94 94 win32dlg.obj: win32dlg.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h 95 95 win32wndchild.obj: win32wndchild.cpp win32wndchild.h … … 99 99 oslibmsg.obj: oslibmsg.cpp oslibmsg.h 100 100 oslibgdi.obj: oslibgdi.cpp oslibgdi.h 101 oslibres.obj: oslibres.cpp oslibwin.h oslibres.h 101 102 102 103 clean: -
trunk/src/user32/new/oslibwin.cpp
r342 r345 1 /* $Id: oslibwin.cpp,v 1.1 7 1999-07-20 07:42:35sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.18 1999-07-20 15:46:53 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 143 143 //****************************************************************************** 144 144 //****************************************************************************** 145 HWND OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate)146 {147 return WinCreateMenu(hwndParent, menutemplate);148 }149 //******************************************************************************150 //******************************************************************************151 BOOL OSLibWinSetAccelTable(HWND hwnd, PVOID acceltemplate)152 {153 HACCEL haccel;154 HAB hab = WinQueryAnchorBlock(hwnd);155 156 haccel = WinCreateAccelTable(hab, (PACCELTABLE)acceltemplate);157 if(haccel == 0) {158 dprintf(("OSLibWinSetAccelTable: WinCreateAccelTable returned 0"));159 return FALSE;160 }161 return WinSetAccelTable(hab, haccel, hwnd);162 }163 145 //****************************************************************************** 164 146 //****************************************************************************** -
trunk/src/user32/new/oslibwin.h
r342 r345 1 /* $Id: oslibwin.h,v 1.1 5 1999-07-20 07:42:36sandervl Exp $ */1 /* $Id: oslibwin.h,v 1.16 1999-07-20 15:46:53 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 26 26 27 27 BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam); 28 29 HWND OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate);30 BOOL OSLibWinSetAccelTable(HWND hwnd, PVOID acceltemplate);31 28 32 29 #define WAOS_WARNING 0 -
trunk/src/user32/new/win32class.h
r300 r345 1 /* $Id: win32class.h,v 1. 2 1999-07-14 08:35:37sandervl Exp $ */1 /* $Id: win32class.h,v 1.3 1999-07-20 15:46:53 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 43 43 DWORD getExtraWndWords() { return nrExtraWindowWords; }; 44 44 45 HICON getIcon() { return hIcon; }; 46 45 47 void setMenuName(LPSTR newMenuName); 46 48 -
trunk/src/user32/new/win32wnd.cpp
r342 r345 1 /* $Id: win32wnd.cpp,v 1.1 7 1999-07-20 07:42:36sandervl Exp $ */1 /* $Id: win32wnd.cpp,v 1.18 1999-07-20 15:46:54 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 29 29 #include <oslibutil.h> 30 30 #include <oslibgdi.h> 31 #include <oslibres.h> 31 32 #include <winres.h> 32 33 … … 102 103 acceltableResource = NULL; 103 104 menuResource = NULL; 104 } 105 //****************************************************************************** 105 iconResource = NULL; 106 } 107 //****************************************************************************** 108 //todo get rid of resources (menu, accel, icon etc) 106 109 //****************************************************************************** 107 110 Win32Window::~Win32Window() … … 389 392 else windowId = (UINT)cs->hMenu; 390 393 394 //Set icon from class 395 if(windowClass->getIcon()) 396 SetIcon(windowClass->getIcon()); 397 391 398 /* Send the WM_CREATE message 392 399 * Perhaps we shouldn't allow width/height changes as well. … … 416 423 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); 417 424 #endif 425 SetLastError(0); 418 426 return TRUE; 419 427 } … … 1056 1064 //****************************************************************************** 1057 1065 //****************************************************************************** 1058 BOOL Win32Window::SetMenu( ULONGhMenu)1066 BOOL Win32Window::SetMenu(HMENU hMenu) 1059 1067 { 1060 1068 PVOID menutemplate; … … 1082 1090 //****************************************************************************** 1083 1091 //****************************************************************************** 1084 BOOL Win32Window::SetAccelTable( ULONGhAccel)1092 BOOL Win32Window::SetAccelTable(HACCEL hAccel) 1085 1093 { 1086 1094 Win32Resource *winres = (Win32Resource *)hAccel; 1095 HANDLE accelhandle; 1087 1096 1088 1097 if(HIWORD(hAccel) == 0) { 1089 1098 dprintf(("SetAccelTable: hAccel %x invalid", hAccel)); 1090 1091 1099 SetLastError(ERROR_INVALID_PARAMETER); 1100 return FALSE; 1092 1101 } 1093 1102 acceltableResource = winres; 1094 return OSLibWinSetAccelTable(OS2HwndFrame, winres->lockOS2Resource()); 1103 accelhandle = OSLibWinSetAccelTable(OS2HwndFrame, winres->getOS2Handle(), winres->lockOS2Resource()); 1104 winres->setOS2Handle(accelhandle); 1105 return(accelhandle != 0); 1106 } 1107 //****************************************************************************** 1108 //****************************************************************************** 1109 BOOL Win32Window::SetIcon(HICON hIcon) 1110 { 1111 Win32Resource *winres = (Win32Resource *)hIcon; 1112 HANDLE iconhandle; 1113 1114 if(HIWORD(hIcon) == 0) { 1115 dprintf(("SetIcon: hIcon %x invalid", hIcon)); 1116 SetLastError(ERROR_INVALID_PARAMETER); 1117 return FALSE; 1118 } 1119 dprintf(("Win32Window::SetIcon %x", hIcon)); 1120 iconResource = winres; 1121 iconhandle = OSLibWinSetIcon(OS2HwndFrame, winres->getOS2Handle(), winres->lockOS2Resource()); 1122 winres->setOS2Handle(iconhandle); 1123 return(iconhandle != 0); 1095 1124 } 1096 1125 //****************************************************************************** -
trunk/src/user32/new/win32wnd.h
r342 r345 1 /* $Id: win32wnd.h,v 1.1 6 1999-07-20 07:42:36sandervl Exp $ */1 /* $Id: win32wnd.h,v 1.17 1999-07-20 15:46:54 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 93 93 void setFlags(DWORD newflags) { flags = newflags; }; 94 94 95 ULONG GetAccelTable() { return (ULONG) acceltableResource; };95 HACCEL GetAccelTable() { return (HACCEL) acceltableResource; }; 96 96 BOOL SetAccelTable(ULONG hAccel); 97 97 98 ULONG GetMenu() { return (ULONG) menuResource; };98 HMENU GetMenu() { return (HMENU) menuResource; }; 99 99 BOOL SetMenu(ULONG hMenu); 100 101 BOOL SetIcon(HICON hIcon); 102 HICON GetIcon() { return (HICON) iconResource; }; 100 103 101 104 BOOL ShowWindow(ULONG nCmdShow); … … 191 194 Win32Resource *acceltableResource; 192 195 Win32Resource *menuResource; 196 Win32Resource *iconResource; 193 197 194 198 char *windowName;
Note:
See TracChangeset
for help on using the changeset viewer.