Fl_Window produces an actual window that can be a main window with borders and title bar, or a subwindow inside another window. Once created, add child widgets usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fltk/fltk/llms.txt
Use this file to discover all available pages before exploring further.
window->add(child).
The window’s callback is called when the user tries to close the window. The default callback calls hide().
Constructors
Width and height of the window in pixels
Position of the window (for positioned constructor)
Window title bar text (optional)
- The (w, h) form creates a top-level window and asks the window manager to position it.
- The (x, y, w, h) form creates a window at the specified location.
Display Methods
show()
Displays the window on screen.Command-line argument count
Command-line argument vector
show()displays the window. If already shown, it is restored and raised to top.show(argc, argv)is used for top-level windows and parses command-line arguments.
hide()
Removes the window from the screen.shown()
Checks if window has been shown.show() has been called (but not hide())
Note: You can tell if a window is iconified with (w->shown() && !w->visible()).
iconize()
Iconifies the window.show() to restore it.
Size and Position
resize()
Changes window size and/or position.New position
New size
position()
Sets window position.New window position
resize(X, Y, w(), h()).
hotspot()
Positions window with mouse at specified point.Position where mouse should point
Widget to center mouse on
Allow window to extend offscreen if non-zero
size_range()
Sets minimum and maximum window size.Minimum width and height
Maximum width and height (0 = unlimited)
Width and height step increments
Flag to keep aspect ratio
Fullscreen
fullscreen()
Makes window fullscreen.fullscreen_off()
Returns from fullscreen mode.Window dimensions to restore to (optional)
fullscreen_active()
Checks if fullscreen is active.fullscreen_screens()
Sets which screens to use in fullscreen.Screen indices for each edge
Maximize
maximize()
Maximizes the window.un_maximize()
Restores window from maximized state.maximize_active()
Checks if window is maximized.Window Properties
label()
Gets or sets window title.Window title bar text
Text for iconified window
iconlabel()
Gets or sets icon label.Label for iconified window
xclass()
Gets or sets X11 class hint.X11 window class name
Window Icons
icon()
Sets the window icon.Image to use as window icon
icons()
Sets multiple window icons.Array of icon images at different sizes
Number of images in array
Window Borders
border()
Gets or sets window border.1 to show border, 0 to hide
show().
clear_border()
Turns off window border.show() is called.
set_override()
Activates override redirect.Modal Windows
modal()
Checks if window is modal.set_modal()
Makes window modal.non_modal()
Checks if window is non-modal.set_non_modal()
Makes window non-modal.clear_modal_states()
Clears modal and non-modal flags.hide() first, then change state, then show().
Special Window Types
set_menu_window()
Marks window as a menu window.show().
menu_window()
Checks if window is a menu window.set_tooltip_window()
Marks window as a tooltip window.show().
tooltip_window()
Checks if window is a tooltip window.Rendering
make_current()
Sets this window as the current drawing context.current()
Gets the current window.flush()
Forces window to redraw.Screen Information
screen_num()
Gets or sets which screen the window is on.Screen number to use
decorated_w(), decorated_h()
Gets window size including decorations.w() or h() if window is not yet mapped.
Position Helper
x_root(), y_root()
Gets absolute screen position.Cursor
cursor()
Sets the cursor for this window.Standard cursor type (FL_CURSOR_ARROW, FL_CURSOR_WAIT, etc.)
Custom cursor image
Hot spot coordinates for custom cursor
default_cursor()
Sets the default cursor.Default cursor to use
Window Callbacks
default_callback()
Default callback for windows.Window receiving callback
User data
hide() on the window.
Type Checking
as_window()
Returns this as an Fl_Window pointer.Example
Related
- Fl (Global Namespace) - Event loop and global functions
- Fl_Widget - Base widget class
- Fl_Group - Container base class