> I suggest to file another STR when you have a concrete proposal for an
> extension - maybe after a short discussion in
> fltk.development or even in
> fltk.general, asking for input from users what they did
> already, and what
> they would like to have...
Well, on that basis, here's the code I use... Note that I set the OSX
icons via the bundle, so they don't really appear here.
I don't know any other way of doing that in OSX, but from Mike's
comments I take it that there is an API to set them programmatically, so
that might be a way of making it more consistent with the other host OS
styles.
- in the headers I have...
// Application icon setting
#ifdef WIN32
# include "media/win32icon.h"
#elif !defined(__APPLE__) /* Not Apple and not win32 - assume Xlib
applies */
# include <X11/xpm.h>
# include "media/x_icon.xpm" /* XPM file with transparent mask */
#endif // !WIN32
- then in the main code on creating the first window I have...
// Set basic icon for window before we show it (MacOS uses app bundle
for icon...)
#ifdef WIN32
main_window->icon((char *)LoadIcon(fl_display,
MAKEINTRESOURCE(IDI_ICON)));
#elif !defined(__APPLE__) /* Not Apple and not win32 - assume Xlib */
fl_open_display(); // Make sure the display is available before we
try and change it!
Pixmap pixmap, mask; // create pixmaps to hold the icon image and
its mask
// load the XPM and prepare the mask
XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display),
x_icon_xpm_data, &pixmap, &mask, 0);
// assign to the fltk main window
// note that the fltk icon handling DOES NOT honour transparency,
// so we fix that AFTER the window is shown (see below)
main_window->icon((char*)pixmap);
#endif // WIN32
main_window->show();
#ifdef WIN32
// The fltk icon code above only loads the default icon.
// Here, once the window is shown, we can assign
// additional icons, just to make things a bit nicer.
{
HANDLE bigicon = LoadImage(GetModuleHandle(0),
MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 32, 32, 0);
SendMessage(fl_xid(main_window), WM_SETICON, ICON_BIG,
(LPARAM)bigicon);
HANDLE smallicon = LoadImage(GetModuleHandle(0),
MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
SendMessage(fl_xid(main_window), WM_SETICON, ICON_SMALL,
(LPARAM)smallicon);
}
#elif !defined(__APPLE__) /* Not Apple and not win32 - assume Xlib */
// The fltk icon code doesn't handle XPM transparency, work around that
here...
{
// read in the current window hints, then modify them to allow icon
transparency
XWMHints* hints = XGetWMHints(fl_display, fl_xid(main_window));
hints->flags |= IconMaskHint; // ensure transparency mask is enabled
for the XPM icon
hints->icon_mask = mask; // set the transparency mask
XSetWMHints(fl_display, fl_xid(main_window), hints);
XFree(hints);
}
#endif // !WIN32
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev