fltk_flow/
lib.rs

1#![allow(non_camel_case_types)]
2#![allow(dead_code)]
3
4mod sys;
5use sys::*;
6
7use fltk::{prelude::*, widget::WidgetTracker};
8use fltk::utils::FlString;
9use std::ffi::{CStr, CString};
10
11/// Creates a flow widget
12#[derive(Debug)]
13pub struct Flow {
14    inner: WidgetTracker,
15    is_derived: bool,
16}
17
18fltk::macros::widget::impl_widget_ext!(Flow, Fl_Flow);
19fltk::macros::widget::impl_widget_base!(Flow, Fl_Flow);
20fltk::macros::widget::impl_widget_default!(Flow);
21fltk::macros::group::impl_group_ext!(Flow, Fl_Flow);
22
23impl Flow {
24    /// Set the flow's rule
25    pub fn rule<W: WidgetExt>(&mut self, w: &W, inst: &str) {
26        unsafe {
27            let inst = CString::safe_new(inst);
28            Fl_Flow_rule(self.inner.widget() as _, w.as_widget_ptr() as _, inst.as_ptr());
29        }
30    }
31}