ferroui-native 0.1.0-preview.2

The macOS platform of FerroUI: windows, input, clipboard, drag and drop, menus and Metal and OpenGL graphics over a native library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::interop::*;

/// Answers a yes/no question of native code (is a menu item enabled?).
pub(crate) struct PredicateCallback {
    predicate: Box<dyn Fn() -> bool>,
}

impl PredicateCallback {
    pub(crate) fn new(predicate: impl Fn() -> bool + 'static) -> Self {
        Self { predicate: Box::new(predicate) }
    }
}

impl IFrnPredicateCallbackImpl for PredicateCallback {
    fn evaluate(&self) -> bool {
        crate::callback_base::guard(false, || (self.predicate)())
    }
}