diff --git a/documentation/src/forms.dox b/documentation/src/forms.dox index 3b1ef31b3..ef135981f 100644 --- a/documentation/src/forms.dox +++ b/documentation/src/forms.dox @@ -6,7 +6,7 @@ This appendix describes the Forms compatibility included with FLTK.
|
Warning: The Forms compatility is deprecated and no longer maintained in FLTK1,
diff --git a/documentation/src/osissues.dox b/documentation/src/osissues.dox
index 22d59dac6..0527661ed 100644
--- a/documentation/src/osissues.dox
+++ b/documentation/src/osissues.dox
@@ -40,77 +40,77 @@ state information and data structures.
\subsection osissues_x_events Handling Other X Events
-
void Fl::add_handler(int (*f)(int))
+\par
Installs a function to parse unrecognized events. If FLTK
cannot figure out what to do with an event, it calls each of
these functions (most recent first) until one of them returns
non-zero. If none of them returns non-zero then the event is
ignored.
+\par
FLTK calls this for any X events it does not recognize, or X
events with a window ID that FLTK does not recognize. You can
-look at the X event in the
-fl_xevent variable.
+look at the X event in the \c fl_xevent variable.
+\par
The argument is the FLTK event type that was not handled, or
zero for unrecognized X events. These handlers are also called
for global shortcuts and some other events that the widget they
were passed to did not handle, for example
-FL_SHORTCUT.
+\c FL_SHORTCUT.
-
-extern XEvent *fl_xvent
+extern XEvent *fl_xevent
+\par
This variable contains the most recent X event.
-
extern ulong fl_event_time
+\par
This variable contains the time stamp from the most recent X
event that reported it; not all events do. Many X calls like cut
and paste need this value.
-
Window fl_xid(const Fl_Window *)
-Returns the XID for a window, or zero if not shown().
+\par
+Returns the XID for a window, or zero if not \c shown().
-
Fl_Window *fl_find(ulong xid)
-Returns the Fl_Window that corresponds to the given
-XID, or NULL if not found. This function uses a cache
+\par
+Returns the Fl_Window that corresponds to the given
+XID, or \c NULL if not found. This function uses a cache
so it is slightly faster than iterating through the windows
yourself.
-
int fl_handle(const XEvent &)
+\par
This call allows you to supply the X events to FLTK, which
may allow FLTK to cooperate with another toolkit or library. The
return value is non-zero if FLTK understood the event. If the
-window does not belong to FLTK and the add_handler()
+window does not belong to FLTK and the \c add_handler()
functions all return 0, this function will return false.
-Besides feeding events your code should call
-Fl::flush()
+\par
+Besides feeding events your code should call Fl::flush()
periodically so that FLTK redraws its windows.
+\par
This function will call the callback functions. It will not
return until they complete. In particular, if a callback pops up
a modal window by calling
-fl_ask(),
+fl_ask(),
for instance, it will not return until the modal function
returns.
\subsection osissues_drawing_xlib Drawing using Xlib
The following global variables are set before
-Fl_Widget::draw()
-is called, or by
-Fl_Window::make_current():
+Fl_Widget::draw() is called, or by Fl_Window::make_current():
\code
extern Display *fl_display;
@@ -129,44 +129,44 @@ XDrawSomething(fl_display, fl_window, fl_gc, ...);
\endcode
Other information such as the position or size of the X
-window can be found by looking at
-Fl_Window::current(),
-which returns a pointer to the Fl_Window being drawn.
+window can be found by looking at Fl_Window::current(),
+which returns a pointer to the Fl_Window being drawn.
-
unsigned long fl_xpixel(Fl_Color i) unsigned long fl_xpixel(uchar r, uchar g, uchar b) +\par Returns the X pixel number used to draw the given FLTK color index or RGB color. This is the X pixel that -fl_color() would use. +\ref drawing_colors "fl_color()" +would use. - int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) +\par Convert a name into the red, green, and blue values of a color -by parsing the X11 color names. On other systems, fl_parse_color +by parsing the X11 color names. On other systems, \c fl_parse_color() can only convert names in hexadecimal encoding, for example \#ff8083. - extern XFontStruct *fl_xfont +\par Points to the font selected by the most recent -fl_font(). -This is not necessarily the current font of fl_gc, +\ref ssect_Fonts "fl_font()". +This is not necessarily the current font of \c fl_gc, which is not set until -fl_draw() -is called. If FLTK was compiled with Xft support, fl_xfont -will usually be 0 and fl_xftfont will contain a pointer -to the XftFont structure instead. +\ref ssect_Text "fl_draw()" +is called. If FLTK was compiled with Xft support, \c fl_xfont +will usually be 0 and \c fl_xftfont will contain a pointer +to the \c XftFont structure instead. - extern void *fl_xftfont -If FLTK was compiled with Xft support enabled, fl_xftfont -Points to the xft font selected by the most recent -fl_font(). -Otherwise it will be 0. fl_xftfont should be cast to +\par +If FLTK was compiled with Xft support enabled, \c fl_xftfont +points to the xft font selected by the most recent +\ref ssect_Fonts "fl_font()". +Otherwise it will be 0. \c fl_xftfont should be cast to XftFont*. \subsection osissues_xvisual Changing the Display, Screen, or X Visual @@ -174,69 +174,67 @@ Otherwise it will be 0. fl_xftfont should be cast to FLTK uses only a single display, screen, X visual, and X colormap. This greatly simplifies its internal structure and makes it much smaller and faster. You can change which it uses -by setting global variables before the first -Fl_Window::show() is called. You may also want to call -Fl::visual(), -which is a portable interface to get a full color and/or double buffered -visual. +by setting global variables + +before the first Fl_Window::show() is called. + +You may also want to call Fl::visual(), which is a portable interface +to get a full color and/or double buffered visual. - int Fl::display(const char *) +\par Set which X display to use. This actually does putenv("DISPLAY=...") so that child programs -will display on the same screen if called with exec(). +will display on the same screen if called with \c exec(). This must be done before the display is opened. This call is provided under MacOS and WIN32 but it has no effect. - extern Display *fl_display +\par The open X display. This is needed as an argument to most -Xlib calls. Don't attempt to change it! This is NULL +Xlib calls. Don't attempt to change it! This is \c NULL before the display is opened. - void fl_open_display() +\par Opens the display. Does nothing if it is already open. This -will make sure fl_display is non-zero. You should call +will make sure \c fl_display is non-zero. You should call this if you wish to do X calls and there is a chance that your -code will be called before the first show() of a -window. +code will be called before the first \c show() of a window. -This may call Fl::abort() if there is an error -opening the display. +\par +This may call Fl::abort() if there is an error opening the display. - void fl_close_display() -This closes the X connection. You do not need to call +\par +This closes the X connection. You do \e not need to call this to exit, and in fact it is faster to not do so! It may be useful to call this if you want your program to continue without the X connection. You cannot open the display again, and probably cannot call any FLTK functions. - extern int fl_screen +\par Which screen number to use. This is set by -fl_open_display() to the default screen. You can change +\c fl_open_display() to the default screen. You can change it by setting this to a different value immediately afterwards. It can also be set by changing the last number in the -Fl::display() string to "host:0.#". +Fl::display() string to "host:0.#". - extern XVisualInfo *fl_visual - extern Colormap fl_colormap +\par The visual and colormap that FLTK will use for all windows. -These are set by fl_open_display() to the default +These are set by \c fl_open_display() to the default visual and colormap. You can change them before calling -show() on the first window. Typical code for changing +\c show() on the first window. Typical code for changing the default visual is: - \code Fl::args(argc, argv); // do this first so $DISPLAY is set fl_open_display(); @@ -251,7 +249,7 @@ window->show(argc, argv); FLTK can manage an X window on a different screen, visual and/or colormap, you just can't use FLTK's drawing routines to -draw into it. But you can write your own draw() method +draw into it. But you can write your own \c draw() method that uses Xlib (and/or OpenGL) calls only. FLTK can also manage XID's provided by other libraries or @@ -259,19 +257,19 @@ programs, and call those libraries when the window needs to be redrawn. To do this, you need to make a subclass of -Fl_Window +Fl_Window and override some of these virtual functions: virtual void Fl_Window::show() -If the window is already shown() this must cause it -to be raised, this can usually be done by calling -Fl_Window::show(). If not shown() your -implementation must call either Fl_X::set_xid() or -Fl_X::make_xid(). +\par +If the window is already \c shown() this must cause it +to be raised, this can usually be done by calling Fl_Window::show(). +If not \c shown() your implementation must call either +Fl_X::set_xid() or Fl_X::make_xid(). +\par An example: - \code void MyWindow::show() { if (shown()) {Fl_Window::show(); return;} // you must do this! @@ -288,44 +286,47 @@ void MyWindow::show() { } \endcode -Fl_X *Fl_X::set_xid(Fl_Window *, Window xid) +Fl_X *Fl_X::set_xid(Fl_Window*, Window xid) -Allocate a hidden structure called an Fl_X, put the -XID into it, and set a pointer to it from the -Fl_Window. This causes Fl_Window::shown() to -return true. +\par +Allocate a hidden structure called an Fl_X, put the +XID into it, and set a pointer to it from the Fl_Window. +This causes Fl_Window::shown()to return true. -void Fl_X::make_xid(Fl_Window *, XVisualInfo *= fl_visual, Colormap = fl_colormap) +void Fl_X::make_xid(Fl_Window*, XVisualInfo* = fl_visual, Colormap = fl_colormap) +\par This static method does the most onerous parts of creating an X window, including setting the label, resize limitations, etc. -It then does Fl_X::set_xid() with this new window and -maps the window. +It then does Fl_X::set_xid() with this new window and maps the window. virtual void Fl_Window::flush() -This virtual function is called by Fl::flush() to +\par +This virtual function is called by Fl::flush() to update the window. For FLTK's own windows it does this by -setting the global variables fl_window and -fl_gc and then calling the draw() method. For +setting the global variables \c fl_window and \c fl_gc +and then calling the \c draw() method. For your own windows you might just want to put all the drawing code in here. -The X region that is a combination of all damage() +\par +The X region that is a combination of all \c damage() calls done so far is in Fl_X::i(this)->region. If -NULL then you should redraw the entire window. The -undocumented function fl_clip_region(XRegion) will -initialize the FLTK clip stack with a region or NULL -for no clipping. You must set region to NULL afterwards -as fl_clip_region() will own and delete it when +\c NULL then you should redraw the entire window. The +undocumented function \c fl_clip_region(XRegion) will +initialize the FLTK clip stack with a region or \c NULL +for no clipping. You must set region to \c NULL afterwards +as \c fl_clip_region() will own and delete it when done. +\par If damage() & FL_DAMAGE_EXPOSE then only X expose events have happened. This may be useful if you have an undamaged image (such as a backing buffer) around. +\par Here is a sample where an undamaged image is kept somewhere: - \code void MyWindow::flush() { fl_clip_region(Fl_X::i(this)->region); @@ -337,12 +338,12 @@ void MyWindow::flush() { virtual void Fl_Window::hide() +\par Destroy the window server copy of the window. Usually you will destroy contexts, pixmaps, or other resources used by the -window, and then call Fl_Window::hide() to get rid of -the main window identified by xid(). If you override +window, and then call Fl_Window::hide() to get rid of +the main window identified by \c xid(). If you override this, you must also override the destructor as shown: - \code void MyWindow::hide() { if (mypixmap) { @@ -355,10 +356,10 @@ void MyWindow::hide() { virtual void Fl_Window::~Fl_Window() -Because of the way C++ works, if you override hide() -you must override the destructor as well (otherwise only -the base class hide() is called): - +\par +Because of the way C++ works, if you override \c hide() +you \e must override the destructor as well (otherwise only +the base class \c hide() is called): \code MyWindow::~MyWindow() { hide(); @@ -367,16 +368,16 @@ MyWindow::~MyWindow() { \subsection osissues_x_icon Setting the Icon of a Window -FLTK currently supports setting a window's icon before it -is shown using the Fl_Window::icon() method. +FLTK currently supports setting a window's icon \b before it +is shown using the Fl_Window::icon() method. void Fl_Window::icon(char *) +\par Sets the icon for the window to the passed pointer. You will -need to cast the icon Pixmap to a char * when +need to cast the icon \c Pixmap to a \c char* when calling this method. To set a monochrome icon using a bitmap compiled with your application use: - \code #include "icon.xbm" @@ -388,9 +389,9 @@ Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), window->icon((char *)p); \endcode +\par To use a multi-colored icon, the XPM format and library should be used as follows: - \code #include NOTE:
- You must call Fl_Window::show(argc,
- argv) for the icon to be used. The
- Fl_Window::show() method does not bind the icon
- to the window.
+ You must call Fl_Window::show(int argc, char** argv)
+ for the icon to be used. The Fl_Window::show() method
+ does not bind the icon to the window.
|
NOTE:
- You must call Fl_Window::show(argc,
- argv) for the icon to be used. The
- Fl_Window::show() method does not bind the icon
- to the window.
+ You must call Fl_Window::show(int argc, char** argv)
+ for the icon to be used. The Fl_Window::show() method
+ does not bind the icon to the window.
|
|
|---|