class Fl_Window : public Fl_Group

This object produces an actual X window. This can either be a main window, with a border and title and all the window management controls, or a "subwindow" inside a window. This is controlled by whether or not the window has a parent().

Once you create a window, you usually add children Fl_Objects to it by using window->add(child) for each new object. See Fl_Group for more information on how to add and remove children.

It is an unfortunate feature of X that what type of drawing you plan to do must be decided before you create the window. The default Fl_Window is set up so the routines in <FL/fl_draw.H> work. The visual, depth, and colormap are the server's default and are shared by all windows. If you need more capabilities you will have to use one of the window subclasses:

Subwindows

If the Fl_Window has a parent then it is a "subwindow". I tried to make subwindows act as much like a normal Fl_Object as possible. The only concievable reason I can think of to use subwindows is to allow a part of the window to have a different graphics capabilities under X. Subwindows will not be supported on systems where this is unnecessary.

It is your responsibility to show() all subwindows immediately after you show() the parent window. You will have to repeat this if you hide() the parent and try to show() it again.

The rest of this documentation describes normal windows where parent() is null.

Close behavior

For normal windows if the user tries to close a window using the window manager the Fl::atclose() function is called. You can change this with Fl::set_atclose(). The default version will close the window, and exit the program when the last one is closed.

If a modal() window is up, then any attempt to close any other window (including lower modal() windows) will be ignored. Attempting to close the top modal() window will cause it's callback() to be done. FL is written so that it is ok for the callback() to delete the object.

Iconizing

iconize() will cause the window to be iconized. show() will de-iconize if. Fl is written so that you can call iconize() immediately after show() and the window will appear on the screen initially iconized.

When a window is iconized/deiconized the handle() method is called with FL_HIDE/FL_SHOW and visible() is turned on and off.

There is no way to control what is drawn in the icon except with the string passed to Fl_Window::xclass(). You should not rely on window managers displaying the icons, anyway.

Resize behavior

You can control the size range of a window by calling Fl_Object::size_range() on it. If you don't do this, by default FL does this:

If resizeable() is NULL (this is the default) then the window cannot be resized and the resize border and max-size control will disappear in a MWM-style window manager.

If either dimension of resizeable() is less than 100, then that is considered the minimum size. Otherwise the resizeable() has a minimum size of 100.

If either dimension of resizeable() is zero, then that is also the maximum size (so the window cannot resize in that direction).

Methods

Fl_Window(int,int,int,int, const char * = 0);
Fl_Window(int,int, const char * = 0);

int Fl::x();
int Fl::y();
int Fl::w();
int Fl::h();

virtual ~Fl_Window();

virtual void show();

int Fl_Window::show(int argc, char **argv, int i);
void Fl_Window::show(int argc, char **argv);

virtual void hide();

int shown() const ;

void iconize();

Fl_Window *Fl::first();
Fl_Window *Fl_Window::nextwindow();

int other_windows();

void resize(int,int,int,int);

void free_position();

void hotspot(int x, int y, int offscreen = 0);
void hotspot(const Fl_Object*, int offscreen = 0);
void hotspot(const Fl_Object& p, int offscreen = 0);

void fullscreen();

int fullscreen_off(int x,int y,int w,int h);

int border(int);
void clear_border();
uchar border() const;

void set_modal();
uchar modal() const;

void label(const char *);
void iconlabel(const char *);
void label(const char *label, const char *iconlabel);
const char *label() const;
const char *iconlabel() const;

void Fl_Window::xclass(const char* name);
const char *xclass() const;

void make_current();
static Fl_Window *current();

ulong xid() const;

Fl_Window* Fl_Window::find(ulong xid)

(back to contents)