source: trunk/src/kernel32/winres.cpp@ 6482

Last change on this file since 6482 was 6482, checked in by sandervl, 24 years ago

put back icon (group) conversion code

File size: 4.3 KB
Line 
1/* $Id: winres.cpp,v 1.30 2001-08-07 21:34:16 sandervl Exp $ */
2
3/*
4 * Win32 resource class
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 *
12 */
13#define INCL_BASE
14#define INCL_WIN
15#define INCL_GPIBITMAPS
16#define INCL_BITMAPFILEFORMAT
17#define INCL_DOSMODULEMGR
18#include <os2wrap.h> //Odin32 OS/2 api wrappers
19#include <stdarg.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#define INCL_WINRES
24#include <win32type.h>
25#include <win32api.h>
26#include <winconst.h>
27#include <winres.h>
28#include <misc.h>
29#include <winimagebase.h>
30#include <winexebase.h>
31#include <windllbase.h>
32#include "cvtresource.h"
33
34#define DBG_LOCALLOG DBG_winres
35#include "dbglocal.h"
36
37#if 0
38//******************************************************************************
39//******************************************************************************
40PVOID WIN32API ConvertResourceToOS2(HINSTANCE hInstance, LPSTR restype, HRSRC hResource)
41{
42 PIMAGE_RESOURCE_DATA_ENTRY pData = (PIMAGE_RESOURCE_DATA_ENTRY)hResource;
43 Win32ImageBase *module;
44 char *resdata;
45 int ressize, cvtressize;
46
47 if(hInstance == 0 || hInstance == -1 || (WinExe && hInstance == WinExe->getInstanceHandle())) {
48 module = (Win32ImageBase *)WinExe;
49 }
50 else {
51 module = (Win32ImageBase *)Win32DllBase::findModule(hInstance);
52 }
53 resdata = (char *)LockResource(LoadResource(hInstance, hResource));
54 ressize = SizeofResource(hInstance, hResource);
55
56 switch((int)restype) {
57 case NTRT_CURSOR:
58 return ConvertCursor((CursorComponent *)resdata, ressize, &cvtressize);
59
60 case NTRT_GROUP_CURSOR:
61 return ConvertCursorGroup((CursorHeader *)resdata, ressize, module);
62
63 case NTRT_NEWMENU:
64 case NTRT_MENU:
65 case NTRT_NEWDIALOG:
66 case NTRT_DIALOG:
67 case NTRT_FONTDIR:
68 case NTRT_FONT:
69 case NTRT_MESSAGETABLE:
70 case NTRT_RCDATA:
71 case NTRT_VERSION:
72 case NTRT_STRING:
73 break;
74
75 default:
76 break;
77 }
78 dprintf(("ConvertResourceToOS2: Can't convert resource %x (inst %x)", hResource, hInstance));
79 return 0;
80}
81//******************************************************************************
82//******************************************************************************
83PVOID WIN32API ConvertCursorToOS2(LPVOID lpWinResData)
84{
85 int ressize, cvtressize;
86
87 ressize = QueryConvertedCursorSize((CursorComponent *)lpWinResData, 0);
88
89 return ConvertCursor((CursorComponent *)lpWinResData, ressize, &cvtressize);
90}
91//******************************************************************************
92//******************************************************************************
93VOID WIN32API FreeOS2Resource(LPVOID lpResource)
94{
95 free(lpResource);
96}
97#endif
98//******************************************************************************
99//******************************************************************************
100ULONG WIN32API QueryConvertedResourceSize(HINSTANCE hInstance, LPSTR restype, HRSRC hResource)
101{
102 PIMAGE_RESOURCE_DATA_ENTRY pData = (PIMAGE_RESOURCE_DATA_ENTRY)hResource;
103 Win32ImageBase *module;
104 char *resdata;
105 int ressize, cvtressize;
106
107 if(hInstance == 0 || hInstance == -1 || (WinExe && hInstance == WinExe->getInstanceHandle())) {
108 module = (Win32ImageBase *)WinExe;
109 }
110 else {
111 module = (Win32ImageBase *)Win32DllBase::findModule(hInstance);
112 }
113 resdata = (char *)LockResource(LoadResource(hInstance, hResource));
114 ressize = SizeofResource(hInstance, hResource);
115
116 switch((int)restype) {
117 case NTRT_ICON:
118 return QueryConvertedIconSize((WINBITMAPINFOHEADER *)resdata, ressize);
119
120// case NTRT_CURSOR:
121// return QueryConvertedCursorSize((CursorComponent *)resdata, ressize);
122
123 case NTRT_GROUP_ICON:
124 case NTRT_GROUP_CURSOR:
125 case NTRT_ACCELERATORS:
126 case NTRT_NEWMENU:
127 case NTRT_MENU:
128 case NTRT_NEWDIALOG:
129 case NTRT_DIALOG:
130 case NTRT_FONTDIR:
131 case NTRT_FONT:
132 case NTRT_MESSAGETABLE:
133 case NTRT_RCDATA:
134 case NTRT_VERSION:
135 case NTRT_STRING:
136 default:
137 dprintf(("Win32Resource::getOS2Size SHOULDN'T BE CALLED for this resource type (%d) (NOT IMPLEMENTED)!!", restype));
138 break;
139 }
140 return 0;
141}
142//******************************************************************************
143//******************************************************************************
Note: See TracBrowser for help on using the repository browser.