334
334
<H3>Setting the Icon of a Window</H3>
336
<P>FLTK currently supports setting a window's icon *before* it
336
<P>FLTK currently supports setting a window's icon <b>before</b> it
337
337
is shown using the <TT>Fl_Window::icon()</TT> method.
339
339
<H4>void Fl_Window::icon(char *)</H4>
341
341
<P>Sets the icon for the window to the passed pointer. You will
342
342
need to cast the icon <TT>Pixmap</TT> to a <TT>char *</TT> when
343
calling this method. To set the icon using a bitmap compiled
343
calling this method. To set a monochrome icon using a bitmap compiled
344
344
with your application use:
347
347
#include "icon.xbm"
349
fl_open_display(); // needed if display has not been previously opened
349
351
Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
350
352
icon_bits, icon_width, icon_height);
352
354
window->icon((char *)p);
357
<P>To use a multi-colored icon, the XPM format and library
358
should be used as follows:
361
#include <X11/xpm.h>
362
#include "icon.xpm"
364
fl_opendisplay(); // needed if display has not been previously opened
368
XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display),
369
icon_xpm, &p, &mask, NULL);
371
window->icon((char *)p);
374
<p>When using the Xpm library, be sure to include it in the list
375
of libraries that are used to link the application (usually
355
378
<CENTER><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc">