mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
* Source/win32/w32_create.m: (-decodeWM_CREATEParams:::) add
code to load and set the HICON into the window. Currently, an .ico file with the same name as the image specified in NSIcon or CFBundleIconName needs to be provided in the resources. NOTE: An enhancement to generate this from the app icon will follow shortly. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@29396 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2a93b165fb
commit
817a5d654f
2 changed files with 45 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
2010-01-25 04:13-EST Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Source/win32/w32_create.m: (-decodeWM_CREATEParams:::) add
|
||||
code to load and set the HICON into the window. Currently,
|
||||
an .ico file with the same name as the image specified in
|
||||
NSIcon or CFBundleIconName needs to be provided in the
|
||||
resources.
|
||||
|
||||
2010-01-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/x11/XWindowBuffer.m (+windowBufferForWindow:depthInfo:)
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
|
||||
#include "win32/WIN32Server.h"
|
||||
#include "win32/WIN32Geometry.h"
|
||||
|
||||
|
@ -44,6 +46,9 @@
|
|||
{
|
||||
WIN_INTERN *win;
|
||||
NSBackingStoreType type = (NSBackingStoreType)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSString *iconName = nil;
|
||||
NSString *iconPath = nil;
|
||||
|
||||
// Initialize the window.
|
||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "CREATE", hwnd);
|
||||
|
@ -76,6 +81,38 @@
|
|||
win->useHDC = NO;
|
||||
}
|
||||
|
||||
// Find the icon file, assume it has the same name as the "icon" which
|
||||
// was specified in the bundle's dictionary...
|
||||
iconName = [[bundle infoDictionary] objectForKey: @"NSIcon"];
|
||||
if(iconName == nil)
|
||||
{
|
||||
iconName = [[bundle infoDictionary]
|
||||
objectForKey: @"CFBundleIconFile"];
|
||||
}
|
||||
|
||||
// If the icon name is set, get the path...
|
||||
if(iconName != nil)
|
||||
{
|
||||
iconName = [iconName stringByDeletingPathExtension];
|
||||
iconPath = [[NSBundle mainBundle] pathForResource: iconName
|
||||
ofType: @"ico"];
|
||||
iconPath = [iconPath stringByStandardizingPath];
|
||||
}
|
||||
|
||||
// If the path is set, load the icon file and set it as the
|
||||
// icon on the window.
|
||||
if(iconPath != nil)
|
||||
{
|
||||
HICON icon = NULL;
|
||||
const char *cpath = [iconPath cString];
|
||||
|
||||
icon = LoadImage(NULL,
|
||||
cpath,
|
||||
IMAGE_ICON,0,0,
|
||||
LR_DEFAULTCOLOR|LR_LOADFROMFILE);
|
||||
SetClassLongPtr(hwnd,GCLP_HICON,(LONG_PTR)icon);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue