Module fltk::app

source ·
Expand description

Application related methods and functions

Structs

Basic Application struct, used to instantiate, set the scheme and run the event loop
Represents global state
Creates a receiver struct
An available screen
Creates a sender struct

Enums

Types of Clipboard contents
The event clipboard type
Defines Mouse buttons
Event direction with Mousewheel event
Set the app scheme

Functions

Gets FLTK ABI version
Register a callback whenever there is a change to the selection buffer or the clipboard. The clipboard is source 1 and the selection buffer is source 0
Register a callback whenever there is a change to the selection buffer or the clipboard. The clipboard is source 1 and the selection buffer is source 0. A callback via closure cannot be removed!
Register a callback whenever there is a change to the selection buffer or the clipboard. The clipboard is source 1 and the selection buffer is source 0. A callback via closure cannot be removed!
Adds a custom handler for unhandled events
add_idleDeprecated
Add an idle callback to run within the event loop. Calls to WidgetExt::redraw within the callback require an explicit sleep
Add an idle callback to run within the event loop. Calls to WidgetExt::redraw within the callback require an explicit sleep
Add an idle callback to run within the event loop. This function returns a handle that can be used for future interaction with the callback. Calls to WidgetExt::redraw within the callback require an explicit sleep
Add a new symbol, that can be accessed using the @ prefix
Add a system handler
add_timeoutDeprecated
Adds a one-shot timeout callback. The timeout duration tm is indicated in seconds Example:
Adds a one-shot timeout callback. The timeout duration tm is indicated in seconds Example:
Adds a one-shot timeout callback. The timeout duration tm is indicated in seconds This function returns a handle that can be use for future interaction with the timeout Example:
Gets FLTK API version
Trigger event loop handling in the main thread
Registers a function that will be called by the main thread during the next message handling cycle
Set the background color
Set the background color for input and text widgets
Gets the widget that is below the mouse cursor. This returns an Option which can be specified in the function call
Creates a channel returning a Sender and Receiver structs (mpsc: multiple producer single consumer).
Calling this during a big calculation will keep the screen up to date and the interface responsive.
Check the contents of the clipboard
Close the current display
Text editing widget should call this for each FL_KEYBOARD event.
Reset the length of bytes of app::compose()
Return the length of bytes written in app::compose()
Copy text to the clipboard
Copy text to the selection buffer
Gets FLTK crate version
Returns whether any of the widgets were damaged
Deletes widgets and their children.
Disables wayland when building with use-wayland. Needs to be called before showing the first window
Gets the display global variable, fl_display. _XDisplay on X11, HINSTANCE on Windows.
Initiate dnd action
Determines if the currently drawn box is active or inactive
Enable locks. This is called automatically in the beginning of the app initialization
Returns the latest captured event
Returns the captured button event. 1 for left key, 2 for middle, 3 for right
Returns false for a single click and true for more
Returns the number of clicks - 1
Get the clipboard content type
Get the clipboard content if it’s an image
Returns the x and y coordinates of the captured event
The event dispatch function is called after native events are converted to FLTK events, but before they are handled by FLTK. If the dispatch function handler is set, it is up to the dispatch function to call app::handle_raw(Event, WindowPtr) or to ignore the event.
Returns the current horizontal mouse scrolling associated with the Mousewheel event. Returns MouseWheel::None, Right or Left
Returns the current horizontal mouse scrolling associated with the Mousewheel event. Returns MouseWheel::None, Up or Down. Doesn’t indicate scrolling direction which depends on system preferences
Returns whether an event occurred within a region
Returns whether an event occurred within a widget
Determines whether an event was a click
Returns the pressed key
Returns whether the key is pressed or held down during the last event
Returns the duration of an event
Returns the captured button event
Returns the original key
Returns the state of the event
Returns a textual representation of the latest event
Gets the x coordinate of the mouse in the window
Gets the x coordinate of the mouse in the screen
Gets the y coordinate of the mouse in the window
Gets the y coordinate of the mouse in the screen
Returns the first window of the application
Causes all the windows that need it to be redrawn and graphics forced out through the pipes.
Gets the widget which has focus
Gets the number of loaded fonts
Finds the index of a font through its name
Gets the name of a font through its index
Get the app’s font size
Gets a Vector of loaded fonts
Set the foreground color
Get the max border radius for frame types
Fl::box_color. Gets the current frame color within box/frame drawing mode
Get the shadow width for frames types with shadows
Get the app’s frame type
Get the font’s name
Get the font’s name
Returns a list of available fonts to the application
Get a font’s sizes
Gets the mouse coordinates relative to the screen
Gets the system colors
Get the grabbed window
Get the graphics context, fl_gc
Send a signal to a window. Integral values from 0 to 30 are reserved. Returns Ok(true) if the event was handled. Returns Ok(false) if the event was not handled. Returns Err on error or in use of one of the reserved values.
Send a signal to the main window. Integral values from 0 to 30 are reserved. Returns Ok(true) if the event was handled. Returns Ok(false) if the event was not handled.
Send a signal to a window pointer from event_dispatch. Returns true if the event was handled. Returns false if the event was not handled or ignored.
has_idleDeprecated
Checks whether an idle function is installed
Checks whether an idle function is installed
Checks whether the idle function, associated with the handle, is installed
has_timeoutDeprecated
Check whether a timeout is installed
Check whether a timeout is installed
Check whether the timeout, associated with the handle, is installed
Inits all styles, fonts and images available to FLTK. Also initializes global locking
Returns whether the event is a alt key press
Returns whether the event is a command key press
Returns whether the event is a control key press
Returns whether the event is a shift press
Check if fltk-rs was initialized
Controls the possibility to scale all windows by ctrl/+/-/0/ or cmd/+/-/0/
Locks the main UI thread
Get the default menu line-spacing
Returns the last modal window of the application
Returns the next window in order
Open the current display
Makes FLTK use its own colormap. This may make FLTK display better
Pastes content from the clipboard
Pastes image content from the clipboard
Pastes image content from the selection buffer
Pastes textual content from the clipboard
Pastes textual content from the selection buffer
Determines whether a program should quit
Gets the widget which was pushed
Quit the app
This is similar to app::check() except this does not call app::flush() or any callbacks, which is useful if your program is in a state where such callbacks are illegal.
Redraws everything
releaseDeprecated
Unset the currently grabbed window
Reload the app scheme
Stop calling the specified callback when there are changes to the selection buffer or the clipboard. The clipboard is source 1 and the selection buffer is source 0
Stop calling the specified callback when there are changes to the selection buffer or the clipboard. The clipboard is source 1 and the selection buffer is source 0
remove_idleDeprecated
Remove an idle function
Remove an idle function
Remove the idle function associated with the handle
Add a system handler
remove_timeoutDeprecated
Removes a timeout callback
Removes a timeout callback
Removes the timeout callback associated with the handle
repeat_timeoutDeprecated
Repeats a timeout callback from the expiration of the previous timeout. You may only call this method inside a timeout callback. The timeout duration tm is indicated in seconds Example:
Repeats a timeout callback from the expiration of the previous timeout. You may only call this method inside a timeout callback. The timeout duration tm is indicated in seconds Example:
Repeats the timeout callback, associated with the hadle, from the expiration of the previous timeout. You may only call this method inside a timeout callback. The timeout duration tm is indicated in seconds Example:
Runs the event loop
Gets the scheme of the application
Returns a pair of the x & y coords of the screen
Returns the screen count
Returns a screen’s (vertical, horizontal) dpi resolution
Returns the screen number of a screen that contains the specified position
Returns the screen number for the screen which intersects the most with the provided rectangle
Returns the screen scale
Returns whether scaling the screen is supported
Returns a pair of the width and height of the screen
Get a screen’s working area
Get a screen’s xywh
Get the app’s scrollbar size
Set the background color for input and text widgets
Set the background color
Sets the callback of a widget
Swap a color with a custom RGB value
Swap a color with a custom RGBA value
Sets the damage to true or false, eliciting a redraw by the application
Sets the widget which has focus at the start of the application
Set the app’s font
Set the app’s font size
Initializes loaded fonts of a certain pattern name Returns the number of fonts found. For safety purposes, the name can be queried using get_font_name(unsafe { transmute(index) })
Set the foreground color
Set the max border radius for frame types
Fl::set_box_color. Sets the current frame color within box/frame drawing mode
Set the shadow width for frames types with shadows
Set the app’s default frame type
Set the app’s default frame type without storing the old type
Set the app’s default frame type
Sets the OpenGL visual mode of the application
Set the current grab
Sets the app’s default selection color
Set the menu line-spacing
Set a widget callback using a C style API
sets the scheme of the application
Sets the screen scale
Set the application’s scrollbar size
Sets the app’s default selection color
Show focus around widgets
Sets the visual mode of the application
Returns whether a quit signal was sent
Put the thread to sleep for dur seconds
Swap the default frame type with a new frame type
Unlocks the main UI thread
Gets FLTK version
Gets FLTK version string
Return whether visible focus is shown
Starts waiting for events. Calls to redraw within wait require an explicit sleep
Waits a maximum of dur seconds or until “something happens”. Returns true if an event happened (always true on windows). Returns false if nothing happened.
Returns the apps windows.

Type Definitions

Alias Scheme to AppScheme
The display global variable, fl_display. _XDisplay on X11, HINSTANCE on Windows.
The current graphics context of the app, fl_gc. *mut c_void to HDC on Windows, CGContextRef on macOS, _XGC on X11
Handle object for interacting with idle callbacks
Handle object for interacting with timeouts
Alias Widget ptr
Alias Window ptr