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:
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.
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.
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.
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).
Fl_Window(int,int,int,int, const char * = 0);
Fl_Window(int,int, const char * = 0);
boxtype() is set to FL_FLAT_BOX. If you plan to completely fill the window with children objects you should change this to FL_NO_BOX. If you want to turn the border off you may want to change this to FL_UP_BOX.
int Fl::x();
int Fl::y();
int Fl::w();
int Fl::h();
Return the size and position of the screen/root/desktop. In all current implementations x() and y() return zero. w() and h() will cause the display to be opened if it is not opened yet. These are useful for setting the size and position of windows.
virtual ~Fl_Window();
virtual void show();
If the window is already shown then it is deiconized and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits.
int Fl_Window::show(int argc, char **argv, int i);
void Fl_Window::show(int argc, char **argv);
Used to show() the first or "main" window. See Initialization for a description.
virtual void hide();
int shown() const ;
(w->shown() && !w->visible())
.
void iconize();
Fl_Window *Fl::first();
Fl_Window *Fl_Window::nextwindow();
int other_windows();
void resize(int,int,int,int);
You can also call the Fl_Object methods size(x,y) and position(w,h), which are inline wrappers for this virtual function.
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;
A string used to tell the system what type of window this is. Mostly this identifies the picture to draw in the icon. Under X, this is turned into a XA_WM_CLASS pair by truncating at the first non-alphanumeric character and capitalizing the first character, and the second one if the first is 'x'. Thus "foo" turns into "foo, Foo", and "xprog.1" turns into "xprog, XProg". This only works if called before calling show().
void make_current();
static Fl_Window *current();
Under X this only works for the base Fl_Window class, not for Fl_Double_Window or Fl_Overlay_Window! OpenGL windows have an identically-named function to serve the same purpose, but this is not a virtual function.
ulong xid() const;
Fl_Window* Fl_Window::find(ulong xid)
Return the Fl_Window that corresponds to the given X window ID, or null if not found. This uses a cache so it is slightly faster than iterating through the windows yourself.