comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d @ 46:17310ba3c1bc

Moved all load lib functionality into own module
author Frank Benoit <benoit@tionex.de>
date Fri, 27 Mar 2009 11:10:45 +0100
parents 0ecb2b338560
children 9f4c18c268b2
comparison
equal deleted inserted replaced
45:d5dd1c5b90a9 46:17310ba3c1bc
12 12
13 module org.eclipse.swt.internal.gdip.native; 13 module org.eclipse.swt.internal.gdip.native;
14 14
15 import org.eclipse.swt.internal.win32.WINTYPES; 15 import org.eclipse.swt.internal.win32.WINTYPES;
16 import java.lang.all; 16 import java.lang.all;
17
18 version(Tango){
19 static import tango.sys.SharedLib;
20 } else { // Phobos
21 }
22 17
23 extern(Windows): 18 extern(Windows):
24 19
25 /****************************************************************************** 20 /******************************************************************************
26 21
730 // do nothing in this version 725 // do nothing in this version
731 } 726 }
732 727
733 } 728 }
734 else{ // version(!STATIC_GDIPLUS) 729 else{ // version(!STATIC_GDIPLUS)
730 import java.nonstandard.SharedLib;
735 Status function( uint* token, GdiplusStartupInput* input, GdiplusStartupOutput* output) GdiplusStartup; 731 Status function( uint* token, GdiplusStartupInput* input, GdiplusStartupOutput* output) GdiplusStartup;
736 void function(uint token) GdiplusShutdown; 732 void function(uint token) GdiplusShutdown;
737 Status function(Handle hdc, out Handle graphics) GdipCreateFromHDC; 733 Status function(Handle hdc, out Handle graphics) GdipCreateFromHDC;
738 Status function(Handle hdc, Handle hDevice, out Handle graphics) GdipCreateFromHDC2; 734 Status function(Handle hdc, Handle hDevice, out Handle graphics) GdipCreateFromHDC2;
739 Status function(Handle hwnd, out Handle graphics) GdipCreateFromHWND; 735 Status function(Handle hwnd, out Handle graphics) GdipCreateFromHWND;
1199 Status function( Handle brush, float dx, float dy, MatrixOrder order) GdipTranslateTextureTransform; 1195 Status function( Handle brush, float dx, float dy, MatrixOrder order) GdipTranslateTextureTransform;
1200 Status function(out Handle format) GdipStringFormatGetGenericDefault; 1196 Status function(out Handle format) GdipStringFormatGetGenericDefault;
1201 Status function(out Handle format) GdipStringFormatGetGenericTypographic; 1197 Status function(out Handle format) GdipStringFormatGetGenericTypographic;
1202 Status function(Handle format, int hotkeyPrefix) GdipSetStringFormatHotkeyPrefix; 1198 Status function(Handle format, int hotkeyPrefix) GdipSetStringFormatHotkeyPrefix;
1203 Status function( Handle format, float firstTabOffset, int count, float* tabStops) GdipSetStringFormatTabStops; 1199 Status function( Handle format, float firstTabOffset, int count, float* tabStops) GdipSetStringFormatTabStops;
1204
1205 struct Symbol {
1206 String name;
1207 void** symbol;
1208 }
1209 1200
1210 Symbol[] symbols = [ 1201 Symbol[] symbols = [
1211 { "GdiplusStartup", cast(void**)& GdiplusStartup }, 1202 { "GdiplusStartup", cast(void**)& GdiplusStartup },
1212 { "GdiplusShutdown", cast(void**)& GdiplusShutdown }, 1203 { "GdiplusShutdown", cast(void**)& GdiplusShutdown },
1213 { "GdipCreateFromHDC", cast(void**)& GdipCreateFromHDC }, 1204 { "GdipCreateFromHDC", cast(void**)& GdipCreateFromHDC },
1679 { "GdipSetStringFormatTabStops", cast(void**)& GdipSetStringFormatTabStops }, 1670 { "GdipSetStringFormatTabStops", cast(void**)& GdipSetStringFormatTabStops },
1680 ]; 1671 ];
1681 1672
1682 1673
1683 void loadLib_Gdip(){ 1674 void loadLib_Gdip(){
1684 version(Tango){ 1675 SharedLib.loadLibSymbols( symbols, "gdiplus.dll" );
1685 if (auto lib = tango.sys.SharedLib.SharedLib.load(`gdiplus.dll`)) {
1686 foreach( inout s; symbols ){
1687 *s.symbol = lib.getSymbol( s.name.ptr );
1688 if( s.symbol is null ){
1689 getDwtLogger.error( __FILE__, __LINE__, "gdiplus.dll: Symbol '{}' not found", s.name );
1690 }
1691 }
1692 } else {
1693 getDwtLogger.error( __FILE__, __LINE__, "Could not load the library gdiplus.dll");
1694 }
1695 } else { // Phobos
1696 implMissing( __FILE__, __LINE__ );
1697 }
1698 } 1676 }
1699 1677
1700 } 1678 }
1701 1679
1702 /****************************************************************************** 1680 /******************************************************************************