fltk/app/
opts.rs

1use fltk_sys::fl;
2
3/// global FLTK options
4#[repr(i32)]
5#[non_exhaustive]
6#[derive(Debug, Copy, Clone, PartialEq, Eq)]
7pub enum Options {
8    /// When switched on, moving the text cursor beyond the start or end of
9    /// a text in a text widget will change focus to the next text widget.
10    /// (This is considered 'old' behavior)
11    ///
12    /// When switched off (default), the cursor will stop at the end of the text.
13    /// Pressing Tab or Ctrl-Tab will advance the keyboard focus.
14    ArrowFocus = 0,
15    /// If visible focus is switched on (default), FLTK will draw a dotted rectangle
16    /// inside the widget that will receive the next keystroke. If switched
17    /// off, no such indicator will be drawn and keyboard navigation
18    /// is disabled.
19    VisibleFocus,
20    /// If text drag-and-drop is enabled (default), the user can select and drag text
21    /// from any text widget. If disabled, no dragging is possible, however
22    /// dropping text from other applications still works.
23    DndText,
24    /// If tooltips are enabled (default), hovering the mouse over a widget with a
25    /// tooltip text will open a little tooltip window until the mouse leaves
26    /// the widget. If disabled, no tooltip is shown.
27    ShowTooltips,
28    /// When switched on (default), `Fl_Native_File_Chooser` runs GTK file dialogs
29    /// if the GTK library is available on the platform (linux/unix only).
30    /// When switched off, GTK file dialogs aren't used even if the GTK library is available.
31    FnfcUsesGtk,
32    /// When switched on (default), `Fl_Printer` runs the GTK printer dialog
33    /// if the GTK library is available on the platform (linux/unix only).
34    /// When switched off, the GTK printer dialog isn't used even if the GTK library is available.
35    PrinterUsesGtk,
36    /// When switched on (default), the library shows in a transient yellow window the zoom factor
37    /// value.
38    /// When switched off, no such window gets displayed.
39    ShowScaling,
40    /// Meaningful for the Wayland/X11 platform only. When switched on (default), the library uses a Zenity-based file dialog.
41    /// When switched off, the GTK file dialog is used instead.
42    FnfcUsesZenity,
43}
44
45/// Get the option's value
46pub fn option(opt: Options) -> bool {
47    unsafe { fl::Fl_option(opt as i32) != 0 }
48}
49
50/// Set the option's value
51pub fn set_option(opt: Options, val: bool) {
52    unsafe { fl::Fl_set_option(opt as i32, i32::from(val)) }
53}