| 1 | /* $Id: winres.h,v 1.3 1999-07-20 15:45:47 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 | #ifndef __WINRES_H__ | 
|---|
| 13 | #define __WINRES_H__ | 
|---|
| 14 |  | 
|---|
| 15 | #ifdef INCL_WINRES | 
|---|
| 16 |  | 
|---|
| 17 | typedef struct tagWINBITMAPINFOHEADER{ | 
|---|
| 18 | DWORD      biSize; | 
|---|
| 19 | LONG       biWidth; | 
|---|
| 20 | LONG       biHeight; | 
|---|
| 21 | WORD       biPlanes; | 
|---|
| 22 | WORD       biBitCount; | 
|---|
| 23 | DWORD      biCompression; | 
|---|
| 24 | DWORD      biSizeImage; | 
|---|
| 25 | LONG       biXPelsPerMeter; | 
|---|
| 26 | LONG       biYPelsPerMeter; | 
|---|
| 27 | DWORD      biClrUsed; | 
|---|
| 28 | DWORD      biClrImportant; | 
|---|
| 29 | } WINBITMAPINFOHEADER; | 
|---|
| 30 |  | 
|---|
| 31 | typedef struct | 
|---|
| 32 | { | 
|---|
| 33 | BYTE                      blue; | 
|---|
| 34 | BYTE                      green; | 
|---|
| 35 | BYTE                      red; | 
|---|
| 36 | BYTE                      res; | 
|---|
| 37 | }  RGBQUAD; | 
|---|
| 38 |  | 
|---|
| 39 | /* | 
|---|
| 40 | * Defines for the fVirt field of the Accelerator table structure. | 
|---|
| 41 | */ | 
|---|
| 42 | #define FVIRTKEY  TRUE          /* Assumed to be == TRUE */ | 
|---|
| 43 | #define FNOINVERT 0x02 | 
|---|
| 44 | #define FSHIFT    0x04 | 
|---|
| 45 | #define FCONTROL  0x08 | 
|---|
| 46 | #define FALT      0x10 | 
|---|
| 47 |  | 
|---|
| 48 | //TODO: Aligned at 8 byte boundary or not?? | 
|---|
| 49 | #pragma pack(1) | 
|---|
| 50 | typedef struct tagWINACCEL { | 
|---|
| 51 | BYTE   fVirt;               /* Also called the flags field */ | 
|---|
| 52 | WORD   key; | 
|---|
| 53 | WORD   cmd; | 
|---|
| 54 | BYTE   align[3]; | 
|---|
| 55 | } WINACCEL, *LPWINACCEL; | 
|---|
| 56 | #pragma pack() | 
|---|
| 57 |  | 
|---|
| 58 | #endif | 
|---|
| 59 |  | 
|---|
| 60 | #ifdef __cplusplus | 
|---|
| 61 | class Win32Image; | 
|---|
| 62 |  | 
|---|
| 63 | class Win32Resource | 
|---|
| 64 | { | 
|---|
| 65 | public: | 
|---|
| 66 | // Constructors and destructors | 
|---|
| 67 | Win32Resource(Win32Image *module, HRSRC hRes, ULONG id, ULONG type); | 
|---|
| 68 | Win32Resource(Win32Image *module, ULONG id, ULONG type, | 
|---|
| 69 | ULONG size, char *resdata); | 
|---|
| 70 | virtual       ~Win32Resource(); | 
|---|
| 71 |  | 
|---|
| 72 | virtual  PVOID lockResource();      //get original win32 resource | 
|---|
| 73 | virtual  PVOID lockOS2Resource();   //get converted OS/2 resource | 
|---|
| 74 |  | 
|---|
| 75 | ULONG sizeofResource()             { return ressize; }; | 
|---|
| 76 |  | 
|---|
| 77 | ULONG getOS2Handle()               { return OS2ResHandle; }; | 
|---|
| 78 | void setOS2Handle(ULONG handle)   { OS2ResHandle = handle; }; | 
|---|
| 79 |  | 
|---|
| 80 | static    void destroyAll(Win32Image *module); | 
|---|
| 81 |  | 
|---|
| 82 | protected: | 
|---|
| 83 |  | 
|---|
| 84 | private: | 
|---|
| 85 | PVOID ConvertBitmap(void *bmpdata); | 
|---|
| 86 |  | 
|---|
| 87 | Win32Image *module; | 
|---|
| 88 |  | 
|---|
| 89 | HRSRC hres; | 
|---|
| 90 | ULONG type; | 
|---|
| 91 | ULONG orgos2type; | 
|---|
| 92 | ULONG id; | 
|---|
| 93 |  | 
|---|
| 94 | PVOID os2resdata; | 
|---|
| 95 | PVOID winresdata; | 
|---|
| 96 |  | 
|---|
| 97 | ULONG OS2ResHandle; | 
|---|
| 98 |  | 
|---|
| 99 | ULONG ressize; | 
|---|
| 100 |  | 
|---|
| 101 | // Linked list management | 
|---|
| 102 | Win32Resource*   next;               // Next Resource in module | 
|---|
| 103 |  | 
|---|
| 104 | friend    class Win32Image; | 
|---|
| 105 | }; | 
|---|
| 106 |  | 
|---|
| 107 | #endif // __cplusplus | 
|---|
| 108 |  | 
|---|
| 109 | #define    NTRT_NEWRESOURCE      0x2000 | 
|---|
| 110 | #define    NTRT_ERROR            0x7fff | 
|---|
| 111 | #define    NTRT_CURSOR           1 | 
|---|
| 112 | #define    NTRT_BITMAP           2 | 
|---|
| 113 | #define    NTRT_ICON             3 | 
|---|
| 114 | #define    NTRT_MENU             4 | 
|---|
| 115 | #define    NTRT_DIALOG           5 | 
|---|
| 116 | #define    NTRT_STRING           6 | 
|---|
| 117 | #define    NTRT_FONTDIR          7 | 
|---|
| 118 | #define    NTRT_FONT             8 | 
|---|
| 119 | #define    NTRT_ACCELERATORS     9 | 
|---|
| 120 | #define    NTRT_RCDATA           10 | 
|---|
| 121 | #define    NTRT_MESSAGETABLE     11 | 
|---|
| 122 | #define    NTRT_GROUP_CURSOR     12 | 
|---|
| 123 | #define    NTRT_GROUP_ICON       14 | 
|---|
| 124 | #define    NTRT_VERSION          16 | 
|---|
| 125 | #define    NTRT_NEWBITMAP        (NTRT_BITMAP|NTRT_NEWRESOURCE) | 
|---|
| 126 | #define    NTRT_NEWMENU          (NTRT_MENU|NTRT_NEWRESOURCE) | 
|---|
| 127 | #define    NTRT_NEWDIALOG        (NTRT_DIALOG|NTRT_NEWRESOURCE) | 
|---|
| 128 |  | 
|---|
| 129 |  | 
|---|
| 130 | #endif | 
|---|