Re: The current keyboard icon?
Re: The current keyboard icon?
- Subject: Re: The current keyboard icon?
- From: "Martin" <email@hidden>
- Date: Tue, 04 May 2004 15:28:38 -0700
Hey guys,
To get the current keyboard layout:
OSStatus osErr;
KeyboardLayoutRef keyRef;
osErr = KLGetCurrentKeyboardLayout( &keyRef );
Once you have a keyboard reference, you can get get the icon reference:
IconRef icon;
osErr = KLGetKeyboardLayoutProperty( keyRef, kKLIcon, (void*)(&icon) );
And finally convert it to an NSImage:
IconFamilyHandle fam;
NSData* imgData;
NSImage* img;
osErr = IconRefToIconFamily( icon, kSelectorAllAvailableData, &fam );
imgData = [NSData dataWithBytes:*fam length:GetHandleSize((Handle)fam)];
img = [[NSImage alloc] initWith
Data:imgData];
Hope this helps,
~Martin
On May 04 2004, Ondra Cada <email@hidden> wrote:
>
happens anybody to know how to obtain the icon of the currently
>
selected keybaord?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.