A window containing other widgets.
Inherits from Group
border | modal | shown | ||
iconlabel | non_modal | xclass | ||
free_position | fullscreen_off | hotspot | set_modal | show |
fullscreen | hide | iconize | set_non_modal | size_range |
type | name | summary |
boolean | border | Use window manager border around window? |
string | iconlabel | Window icon label |
type | name | summary |
void | show() | Show this window |
void | hide() | Hide this window |
void | iconize() | Iconify window |
void | set_modal() | Make window modal |
void | set_non_modal() | Make window non-modal |
This widget is an actual 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. In normal programming, it usually makes much more sense to use a Group instead of a subwindow unless you need to set a specific visual or request double buffering, or similar low-level requests.
Once you create a window, you usually add child Widgets to it. As with all Groups, upon creation a Window becomes the current group, the group widgets are added to upon creation. You may also add widgets using window:add(child) for each new widget. See Group for more information on how to add and remove children.
Top level Windows should be created using only two coordinates, with the constructor Window{integer width, integer height}. (You can add a label or properties, like Window{200,200, "label"; box=Boxtype.up}). A Window created this way is hidden, has no parent, and allows the window manager to choose a location to display the window. You can force a position by calling position(x,y) or hotspot() before calling show().
See size_range() for a description of how window resizing is handled. In most cases, you should be able to get reasonable behavior by setting the resizable property. See Group for more detail on resizable.
There are several subclasses of Window that provide double-buffering, overlay, menu, and OpenGL support. They are not currently used in Lua FLTK.
The window's callback is performed if the user tries to close a window using the window manager and Fl.modal is nil or equal to the window. Window has a default callback that calls Window:hide() and calls exit(0) if this is the last top-level window.
Gets or sets whether or not the window manager border is around the window. The default value is true. Under most X window managers this does not work after show() has been called, although SGI's 4DWM does work.
Check the value of border after setting it to determine
whether it really changed.
A "modal" window, when shown(), will prevent any events from
being delivered to other windows in the same program, and will also
remain on top of the other windows (if the X window manager supports
the "transient for" property). Several modal windows may be shown at
once, in which case only the last one shown gets events. You can see
which window (if any) is modal by the value of
Fl.modal.
True if this window is modal. See set_modal() for more information on modal windows.
A "non-modal" window (terminology borrowed from Microsoft Windows)
acts like a modal one in that it remains on top, but it has
no effect on event delivery. There are three states for a
window: modal, non-modal, and normal.
True if this window is non-modal. See set_non_modal() for
more information on non-modal windows.
May also be called as hotspot(Widget w, [boolean offscreen]).
Undoes the effect of a previous resize() or show()
so that the next time show() is called the window manager is
free to position the window.
Set the allowable range the user can resize this window to. This only
works for top-level windows.
The label used for this window's icon. Ignored by some window managers.
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().
Under Microsoft Windows this string is used as the name of the
WNDCLASS structure, though it is not clear if this can have any
visible effect. Returns true if show() has been called (but not
hide()). You can tell if a window is iconified with
w.shown and not w.visible.
Put the window on the screen. (Usually this has the side effect of
opening the X display.)
If the window is already shown then it is restored 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. Remove the window from the screen. If the window is already hidden
or has not been shown then this does nothing and is harmless.
Note that the normal Fl:run() loop will terminate if there
are no shown windows on screen.
Makes the window completely fill the screen, without any window
manager border visible. You must use fullscreen_off() to undo
this. This may not work with all window managers.
Turns off any side effects of fullscreen() and performs
resize(x,y,w,h).
Iconifies the window. If you call this when shown is
false it will show() it as an icon. If the window is already
iconified this does nothing.
Call show() to restore the window. When a window is iconified/restored (either by these calls or by
the user) the Window receives Event.hide and
Event.show events and visible is turned on or
off. There is no way to control what is drawn in the icon except with
the string in xclass. You should not rely on window managers
displaying the icons. set_modal(): void
modal: readonly boolean
set_non_modal(): void
non_modal: readonly boolean
hotspot(integer x, integer y, boolean offscreen = nil): void
free_position(): void
size_range(integer minw, integer minh, integer maxw=0, integer maxh=0, integer dw=0, integer dh=0, boolean aspect=nil): void
If this function is not called, FLTK tries to figure out the range
from the setting of resizeable
:
It is undefined what happens if the current size does not fit in the
constraints passed to size_range().
iconlabel: string
xclass: string
shown: readonly boolean
show(): void
hide(): void
fullscreen(): void
fullscreen_off(integer x, integer y, integer w, integer h): void
iconize(): void
doctool generated at Sun Aug 12 22:23:17 2001