Browse Source

Finish changes to FLUID chapter...

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2010 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/168/head
Michael R Sweet 23 years ago
parent
commit
1d451aada0
  1. BIN
      documentation/cubeview.gif
  2. 190
      documentation/fluid.html

BIN
documentation/cubeview.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 11 KiB

190
documentation/fluid.html

@ -864,6 +864,17 @@ you want the window to hide and then reappear at a new position,
you should have your program set the hotspot itself just before you should have your program set the hotspot itself just before
<tt>show()</tt>. <tt>show()</tt>.
<P>The <B>Border</B> button turns the window manager border on
or off. On most window managers you will have to close the
window and reopen it to see the effect.
<H4>X Class (text field)</H4>
<P>The string typed into here is passed to the X window manager
as the class. This can change the icon or window decorations.
On most (all?) window managers you will have to close the window
and reopen it to see the effect.
<P ALIGN="CENTER"><IMG src="fluid_widget_style.gif" ALT="The FLUID widget Style attributes."><BR> <P ALIGN="CENTER"><IMG src="fluid_widget_style.gif" ALT="The FLUID widget Style attributes."><BR>
<I>Figure 9-9: The FLUID widget Style attributes.</I></P> <I>Figure 9-9: The FLUID widget Style attributes.</I></P>
@ -1103,126 +1114,113 @@ different.</P>
it) is almost identical to the panel for any other Fl_Widget. it) is almost identical to the panel for any other Fl_Widget.
There are three extra items:</P> There are three extra items:</P>
<H4>Border</H4> <H3><A name="images">Images</A></H3>
<P>This button turns the window manager border on or off. On
most window managers you will have to close the window and
reopen it to see the effect.
<H4>xclass</H4>
<P>The string typed into here is passed to the X window manager <P>The <I>contents</I> of the image files in the <B>Image</B>
as the class. This can change the icon or window decorations. and <B>Inactive</B> text fields are written to the <TT>.cxx</TT>
On most (all?) window managers you will have to close the window file. If many widgets share the same image then only one copy is
and reopen it to see the effect. written. Since the image data is embedded in the generated
source code, you need only distribute the C++ code and not the
<H3><A name="images">Image Labels</A></H3> image files themselves.</P>
<P>Selecting &quot;Image...&quot; off the label style pull-down
menu will bring up a file chooser from which you pick the image
file. If an image has already been chosen, you can change the
image used by picking &quot;Image...&quot; again. The name of
the image will appear in the &quot;label&quot; field, but you
can't edit it.</P>
<P>The <I>contents</I> of the image file are written to the
<TT>.cxx</TT> file, so if you wish to distribute the C code, you
only need to copy the <TT>.cxx</TT> file, not the images. If
many widgets share the same image then only one copy is
written.</P>
<P>However the <I>file name</I> is stored in the <TT>.fl</TT> <P>However, the <I>filenames</I> are stored in the <TT>.fl</TT>
file, so to read the <TT>.fl</TT> file you need the image files file so you will need the image files as well to read the
as well. Filenames are relative to the location the <TT>.fl</TT> file. Filenames are relative to the location of the
<TT>.fl</TT> file is (not necessarily the current directory). I <TT>.fl</TT> file and not necessarily the current directory. We
recommend you either put the images in the same directory as the recommend you either put the images in the same directory as the
<TT>.fl</TT> file, or use absolute path names.</P> <TT>.fl</TT> file, or use absolute path names.</P>
<H4>Notes for all image types</H4> <H4>Notes for All Image Types</H4>
<P>FLUID runs using the default visual of your X server. This <P>FLUID runs using the default visual of your X server. This
may be 8 bits, which will give you dithered images. You may get may be 8 bits, which will give you dithered images. You may get
better results in your actual program by adding the code better results in your actual program by adding the code
&quot;Fl::visual(FL_RGB)&quot; to your code right before the &quot;Fl::visual(FL_RGB)&quot; to your code right before the
first window is displayed. first window is displayed.
<P>All widgets with the same image on them share the same code <P>All widgets with the same image on them share the same code
and source X pixmap. Thus once you have put an image on a and source X pixmap. Thus once you have put an image on a
widget, it is nearly free to put the same image on many other widget, it is nearly free to put the same image on many other
widgets.</P> widgets.</P>
<P>If you are using a painting program to edit an image: the <P>If you edit an image at the same time you are using it in FLUID,
only way to convince FLUID to read the image file again is to the only way to convince FLUID to read the image file again is to
remove the image from all widgets that are using it (including remove the image from all widgets that are using it or re-load the
ones in closed windows), which will cause it to free its <TT>.fl</TT> file.</P>
internal copy, and then set the image again. You may find it
easier to exit FLUID and run it again.</P>
<P>Don't rely on how FLTK crops images that are outside the <P>Don't rely on how FLTK crops images that are outside the
widget, as this may change in future versions! The cropping of widget, as this may change in future versions! The cropping of
inside labels will probably be unchanged.</P> inside labels will probably be unchanged.</P>
<P>To more accurately place images, make a new &quot;box&quot; <P>To more accurately place images, make a new &quot;box&quot;
widget and put the image in that as the label. This is also how widget and put the image in that as the label.</P>
you can put both an image and text label on the same widget. If
your widget is a button, and you want the image inside it, you
must change the button's boxtype to <TT>FL_UP_FRAME</TT> (or
another frame), otherwise when it is pushed it will erase the
image.</P>
<H4>XBM (X bitmap files)</H4> <H4>XBM (X Bitmap) Files</H4>
<P>FLUID will read X bitmap files. These files have C source <P>FLUID reads X bitmap files which use C source code to define
code to define a bitmap. Sometimes they are stored with the a bitmap. Sometimes they are stored with the &quot;.h&quot; or
&quot;.h&quot; or &quot;.bm&quot; extension rather than the &quot;.bm&quot; extension rather than the standard
standard &quot;.xbm&quot;. &quot;.xbm&quot; extension.
<P>FLUID will output code to construct an Fl_Bitmap widget and <P>FLUID writes code to construct an Fl_Bitmap image and use it
use it to label the widget. The '1' bits in the bitmap are to label the widget. The '1' bits in the bitmap are drawn using
drawn using the label color of the widget. You can change the the label color of the widget. You can change this color in the
color in FLUID. The '0' bits are transparent.</P> FLUID widget attributes panel. The '0' bits are transparent.</P>
<P>The program &quot;bitmap&quot; on the X distribution does an <P>The program &quot;bitmap&quot; on the X distribution does an
ok job of editing bitmaps.</P> adequate job of editing bitmaps.</P>
<H4>XPM (X pixmap files)</H4> <H4>XPM (X Pixmap) Files</H4>
<P>FLUID will read X pixmap files as used by the libxpm library. <P>FLUID reads X pixmap files as used by the <TT>libxpm</TT>
These files have C source code to define a pixmap. The library. These files use C source code to define a pixmap. The
filenames usually have a &quot;.xpm&quot; extension. filenames usually have the &quot;.xpm&quot; extension.
<P>FLUID will output code to construct an Fl_Pixmap widget and <P>FLUID writes code to construct an Fl_Pixmap image and use it
use it to label the widget. The label color of the widget is to label the widget. The label color of the widget is ignored,
ignored, even for 2-color images that could be a bitmap.</P> even for 2-color images that could be a bitmap. XPM files can
mark a single color as being transparent, and FLTK uses this
<P>XPM files can mark a single color as being transparent. information to generate a transparency mask for the image.</P>
Currently FLTK and FLUID simulate this transparency rather
badly. It will use the color() of the widget as the background, <P>We have not found any good editors for small iconic pictures.
and all widgets using the same pixmap are assumed to have the For pixmaps we have used <A
same color. This may be fixed in the future or on non-X href="http://home.worldonline.dk/~torsten/xpaint/index.html">XPaint</A>
systems.</P> and the KDE icon editor.</P>
<P>I have not found any good editors for small iconic pictures. <H4>BMP Files</H4>
For pixmaps I have used <A
href="http://home.worldonline.dk/~torsten/xpaint/index.html">XPaint</A>. <P>FLUID reads Windows BMP image files which are often used in
This (and most other) painting programs are designed for large WIN32 applications for icons. FLUID converts BMP files into
full color images and are difficult to use to edit an image of (modified) XPM format and uses a Fl_BMP_Image image to label the
small size and few colors.</P> widget. Transparency is handled the same as for XPM files. All
image data is uncompressed when written to the source file, so
<H4>GIF files</H4> the code may be much bigger than the <TT>.bmp</TT> file.</P>
<P>FLUID will also read GIF image files. These files are often <H4>GIF Files</H4>
used on html documents to make icons. This lets you use nice
icons that you steal off the net in your user interface. <P>FLUID reads GIF image files which are often used in HTML
documents to make icons. FLUID converts GIF files into
<P>FLUID converts these into (modified) XPM format and uses an (modified) XPM format and uses a Fl_GIF_Image image to label the
Fl_Pixmap widget to label the widget. Transparency is handled widget. Transparency is handled the same as for XPM files. All
the same as for XPM files. Notice that the conversion removes image data is uncompressed when written to the source file, so
the compression, so the code may be much bigger than the .gif the code may be much bigger than the <TT>.gif</TT> file. Only
file. Only the first image of an animated gif file is used.</P> the first image of an animated GIF file is used.</P>
<P>Behavior and performance with large .gif files is not <H4>JPEG Files</H4>
guaranteed! </P>
<P>If FLTK is compiled with JPEG support, FLUID can read JPEG
image files which are often used for digital photos. FLUID uses
a Fl_JPEG_Image image to label the widget, and writes
uncompressed RGB or grayscale data to the source file.
<H4>PNG (Portable Network Graphics) Files</H4>
<P>If FLTK is compiled with PNG support, FLUID can read PNG
image files which are often used in HTML documents. FLUID uses a
Fl_PNG_Image image to label the widget, and writes uncompressed
RGB or grayscale data to the source file. PNG images can provide
a full alpha channel for partial transparency, and FLTK supports
this as best as possible on each platform.
<H2><A NAME="I18N">Internationalization with FLUID</A></H2> <H2><A NAME="I18N">Internationalization with FLUID</A></H2>

Loading…
Cancel
Save