Changeset 53
- Timestamp:
- 03/14/08 18:30:18 (7 months ago)
- Files:
-
- trunk/win32/dfl/base.d (modified) (1 diff)
- trunk/win32/dfl/control.d (modified) (2 diffs)
- trunk/win32/dfl/drawing.d (modified) (3 diffs)
- trunk/win32/dfl/internal/winapi.d (modified) (1 diff)
- trunk/win32/dfl/listview.d (modified) (1 diff)
- trunk/win32/dfl/resources.d (modified) (6 diffs)
- trunk/win32/dfl/splitter.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/base.d
r51 r53 1222 1222 void dispose() 1223 1223 { 1224 assert(owned); 1224 1225 DestroyCursor(hcur); 1225 1226 hcur = HCURSOR.init; trunk/win32/dfl/control.d
r51 r53 1052 1052 1053 1053 1054 /+ 1054 1055 deprecated void anchor(AnchorStyles a) // setter 1055 1056 { … … 1071 1072 return cast(AnchorStyles)(AnchorStyles.LEFT | AnchorStyles.TOP); 1072 1073 } 1074 +/ 1073 1075 1074 1076 trunk/win32/dfl/drawing.d
r50 r53 1080 1080 void dispose() 1081 1081 { 1082 assert(owned); 1082 1083 DeleteObject(hbm); 1083 1084 hbm = null; … … 2441 2442 void dispose() 2442 2443 { 2444 assert(owned); 2443 2445 DeleteDC(hdc); 2444 2446 hdc = null; … … 2767 2769 void dispose() 2768 2770 { 2771 assert(owned); 2769 2772 DestroyIcon(hi); 2770 2773 hi = null; trunk/win32/dfl/internal/winapi.d
r49 r53 2793 2793 SHORT VkKeyScanW(wchar ch); 2794 2794 HRSRC FindResourceExA(HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage); 2795 HRSRC FindResourceExW(HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage); 2795 2796 HGLOBAL LoadResource(HMODULE hModule, HRSRC hResInfo); 2797 DWORD SizeofResource(HMODULE hModule, HRSRC hResInfo); 2796 2798 BOOL EnableMenuItem(HMENU hMenu, UINT uIDEnableItem, UINT uEnable); 2797 2799 BOOL IsMenu(HMENU hMenu); trunk/win32/dfl/listview.d
r49 r53 2587 2587 { 2588 2588 //return _ins(index, cast(LPARAM)cast(void*)item, item.text, 0); 2589 return _ins(index, cast(LPARAM)cast(void*)item, item.text, 0, item._imgidx); 2589 version(DFL_NO_IMAGELIST) 2590 { 2591 return _ins(index, cast(LPARAM)cast(void*)item, item.text, 0, -1); 2592 } 2593 else 2594 { 2595 return _ins(index, cast(LPARAM)cast(void*)item, item.text, 0, item._imgidx); 2596 } 2590 2597 } 2591 2598 trunk/win32/dfl/resources.d
r5 r53 45 45 void dispose() 46 46 { 47 assert(_owned); 47 48 //if(hinst != Application.getInstance()) // ? 48 49 FreeLibrary(hinst); … … 99 100 } 100 101 101 /+102 102 /// ditto 103 103 final Icon getIcon(int id, int width, int height) … … 132 132 return new Icon(hi, true); // Owned. 133 133 } 134 +/135 134 136 135 deprecated alias getIcon loadIcon; … … 205 204 body 206 205 { 207 HRSRC hrc; 208 hrc = FindResourceExA(hinst, RT_STRING, cast(LPCSTR)cast(WORD)(id / 16 + 1), lang); 209 if(!hrc) 210 return null; 211 HGLOBAL hg; 212 LPCWSTR ws; 213 char[] result = null; 214 hg = LoadResource(hinst, hrc); 215 if(!hg) 216 return null; 217 ws = cast(LPCWSTR)LockResource(hg); 206 // Not casting to wchar[] because a resource isn't guaranteed to be the same size. 207 wchar* ws = cast(wchar*)_getData(cast(LPCWSTR)RT_STRING, cast(LPCWSTR)cast(WORD)(id / 16 + 1)).ptr; 208 char[] result; 218 209 if(ws) 219 210 { … … 224 215 } 225 216 result = utf16stringtoUtf8string((ws + 1)[0 .. cast(size_t)*ws]); 226 //UnlockResource(ws); // Obsolete / stub.227 217 } 228 FreeResource(hg); // Obsolete / stub.229 218 return result; 230 219 } 231 220 232 221 deprecated alias getString loadString; 222 223 224 // Used internally 225 final void[] _getData(LPCWSTR type, LPCWSTR name) // internal 226 { 227 HRSRC hrc; 228 hrc = FindResourceExW(hinst, type, name, lang); 229 if(!hrc) 230 return null; 231 HGLOBAL hg = LoadResource(hinst, hrc); 232 if(!hg) 233 return null; 234 LPVOID pv = LockResource(hg); 235 if(!pv) 236 return null; 237 return pv[0 .. SizeofResource(hinst, hrc)]; 238 } 239 240 /// 241 final void[] getData(int type, int id) 242 in 243 { 244 assert(type >= WORD.min && type <= WORD.max); 245 assert(id >= WORD.min && id <= WORD.max); 246 } 247 body 248 { 249 return _getData(cast(LPCWSTR)type, cast(LPCWSTR)id); 250 } 251 252 /// ditto 253 final void[] getData(char[] type, int id) 254 in 255 { 256 assert(id >= WORD.min && id <= WORD.max); 257 } 258 body 259 { 260 return _getData(utf8stringToUtf16stringz(type), cast(LPCWSTR)id); 261 } 262 263 /// ditto 264 final void[] getData(int type, char[] name) 265 in 266 { 267 assert(type >= WORD.min && type <= WORD.max); 268 } 269 body 270 { 271 return _getData(cast(LPCWSTR)type, utf8stringToUtf16stringz(name)); 272 } 273 274 /// ditto 275 final void[] getData(char[] type, char[] name) 276 { 277 return _getData(utf8stringToUtf16stringz(type), utf8stringToUtf16stringz(name)); 278 } 233 279 234 280 … … 247 293 248 294 249 /+250 295 void _noload(char[] type) 251 296 { 252 297 throw new DflException("Unable to load " ~ type ~ " resource"); 253 298 } 254 +/255 299 } 256 300 trunk/win32/dfl/splitter.d
r49 r53 81 81 82 82 83 /+ 83 84 override void anchor(AnchorStyles a) // setter 84 85 { … … 87 88 88 89 alias Control.anchor anchor; // Overload. 90 +/ 89 91 90 92
