mirror of https://github.com/buggins/dlangui.git
Fix for Windows
This commit is contained in:
parent
b2bcb79621
commit
137cb927f6
|
@ -1241,8 +1241,7 @@ void main()
|
||||||
{
|
{
|
||||||
import dlangui.graphics.iconprovider;
|
import dlangui.graphics.iconprovider;
|
||||||
TableLayout icons = new TableLayout("icons");
|
TableLayout icons = new TableLayout("icons");
|
||||||
icons.layoutHeight(FILL_PARENT);
|
icons.colCount = 6;
|
||||||
icons.colCount = 4;
|
|
||||||
for(StandardIcon icon = StandardIcon.init; icon <= StandardIcon.deviceCameraVideo; ++icon)
|
for(StandardIcon icon = StandardIcon.init; icon <= StandardIcon.deviceCameraVideo; ++icon)
|
||||||
{
|
{
|
||||||
icons.addChild(new TextWidget(to!string(icon), to!dstring(icon)).fontSize(12.pointsToPixels).alignment(Align.Right | Align.VCenter));
|
icons.addChild(new TextWidget(to!string(icon), to!dstring(icon)).fontSize(12.pointsToPixels).alignment(Align.Right | Align.VCenter));
|
||||||
|
@ -1254,6 +1253,7 @@ void main()
|
||||||
}
|
}
|
||||||
icons.addChild(imageWidget).alignment(Align.Left | Align.VCenter);
|
icons.addChild(imageWidget).alignment(Align.Left | Align.VCenter);
|
||||||
}
|
}
|
||||||
|
icons.margins(Rect(10,10,10,10)).layoutWidth(FILL_PARENT);
|
||||||
tabs.addTab(icons, "Icons"d);
|
tabs.addTab(icons, "Icons"d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ version(Windows)
|
||||||
{
|
{
|
||||||
import std.windows.syserror;
|
import std.windows.syserror;
|
||||||
_shell = wenforce(LoadLibraryA("Shell32"), "Could not load Shell32 library");
|
_shell = wenforce(LoadLibraryA("Shell32"), "Could not load Shell32 library");
|
||||||
_SHGetStockIconInfo = cast(typeof(&_dummy_SHGetStockIconInfo))enforce(GetProcAddress(_shell, "SHGetStockIconInfo"));
|
_SHGetStockIconInfo = cast(typeof(&_dummy_SHGetStockIconInfo))wenforce(GetProcAddress(_shell, "SHGetStockIconInfo"), "Could not load SHGetStockIconInfo");
|
||||||
}
|
}
|
||||||
~this()
|
~this()
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ version(Windows)
|
||||||
_cache[id] = DrawBufRef(null); // save the fact that the icon was not found
|
_cache[id] = DrawBufRef(null); // save the fact that the icon was not found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return DrawBufRef(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
override DrawBufRef getStandardIcon(StandardIcon icon)
|
override DrawBufRef getStandardIcon(StandardIcon icon)
|
||||||
|
@ -307,7 +307,7 @@ version(Windows)
|
||||||
return SIID_APPLICATION;
|
return SIID_APPLICATION;
|
||||||
case folder:
|
case folder:
|
||||||
return SIID_FOLDER;
|
return SIID_FOLDER;
|
||||||
case openFolder:
|
case folderOpen:
|
||||||
return SIID_FOLDEROPEN;
|
return SIID_FOLDEROPEN;
|
||||||
case driveFloppy:
|
case driveFloppy:
|
||||||
return SIID_DRIVE35;
|
return SIID_DRIVE35;
|
||||||
|
@ -319,7 +319,7 @@ version(Windows)
|
||||||
return SIID_DRIVECD;
|
return SIID_DRIVECD;
|
||||||
case driveDVD:
|
case driveDVD:
|
||||||
return SIID_DRIVEDVD;
|
return SIID_DRIVEDVD;
|
||||||
case derver:
|
case server:
|
||||||
return SIID_SERVER;
|
return SIID_SERVER;
|
||||||
case printer:
|
case printer:
|
||||||
return SIID_PRINTER;
|
return SIID_PRINTER;
|
||||||
|
@ -351,7 +351,7 @@ version(Windows)
|
||||||
return SIID_VIDEOFILES;
|
return SIID_VIDEOFILES;
|
||||||
case fileZip:
|
case fileZip:
|
||||||
return SIID_ZIPFILE;
|
return SIID_ZIPFILE;
|
||||||
case documentUnknown:
|
case fileUnknown:
|
||||||
return SIID_DOCNOASSOC;
|
return SIID_DOCNOASSOC;
|
||||||
case warning:
|
case warning:
|
||||||
return SIID_WARNING;
|
return SIID_WARNING;
|
||||||
|
@ -389,6 +389,7 @@ version(Windows)
|
||||||
if (_SHGetStockIconInfo(id, SHGSI_ICON, &info) == S_OK) {
|
if (_SHGetStockIconInfo(id, SHGSI_ICON, &info) == S_OK) {
|
||||||
return info.hIcon;
|
return info.hIcon;
|
||||||
}
|
}
|
||||||
|
Log.d("Could not get icon from stock. Id: ", id);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +424,7 @@ version(Windows)
|
||||||
|
|
||||||
if(!GetDIBits(hDC, iconInfo.hbmMask, 0,height,cast(LPVOID)alphaPixels.ptr, &infoheader, DIB_RGB_COLORS))
|
if(!GetDIBits(hDC, iconInfo.hbmMask, 0,height,cast(LPVOID)alphaPixels.ptr, &infoheader, DIB_RGB_COLORS))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
const int lsSrc = width*3;
|
const int lsSrc = width*3;
|
||||||
auto colorDrawBuf = new ColorDrawBuf(width, height);
|
auto colorDrawBuf = new ColorDrawBuf(width, height);
|
||||||
for(int y=0; y<height; y++)
|
for(int y=0; y<height; y++)
|
||||||
|
@ -436,7 +438,7 @@ version(Windows)
|
||||||
const uint red = pixelsIconRGB[currentSrcPos+2];
|
const uint red = pixelsIconRGB[currentSrcPos+2];
|
||||||
const uint green = pixelsIconRGB[currentSrcPos+1];
|
const uint green = pixelsIconRGB[currentSrcPos+1];
|
||||||
const uint blue = pixelsIconRGB[currentSrcPos];
|
const uint blue = pixelsIconRGB[currentSrcPos];
|
||||||
const uint alpha = pixelsIconRGB[currentSrcPos] ? 0 : 255;
|
const uint alpha = alphaPixels[currentSrcPos];
|
||||||
const uint color = (red << 16) | (green << 8) | blue | (alpha << 24);
|
const uint color = (red << 16) | (green << 8) | blue | (alpha << 24);
|
||||||
pixelLine[x] = color;
|
pixelLine[x] = color;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue