use crate::image::Image;
pub use crate::prelude::*;
use fltk_sys::valuator::*;
use std::{
ffi::{CStr, CString},
mem,
os::raw,
};
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct Slider {
_inner: *mut Fl_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl Slider {
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner, c as i32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct NiceSlider {
_inner: *mut Fl_Nice_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl NiceSlider {
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}
#[repr(i32)]
#[derive(WidgetType, Debug, Copy, Clone, PartialEq)]
pub enum SliderType {
Vertical = 0,
Horizontal = 1,
VerticalFill = 2,
HorizontalFill = 3,
VerticalNice = 4,
HorizontalNice = 5,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct Dial {
_inner: *mut Fl_Dial,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl Dial {
pub fn angles(&self) -> (u16, u16) {
let angle1 = unsafe { Fl_Dial_angle1(self._inner) };
let angle2 = unsafe { Fl_Dial_angle1(self._inner) };
(angle1 as u16, angle2 as u16)
}
pub fn set_angles(&mut self, angle1: u16, angle2: u16) {
if angle1 <= 360 {
unsafe {
Fl_Dial_set_angle1(self._inner, angle1 as _);
}
}
if angle2 <= 360 {
unsafe {
Fl_Dial_set_angle2(self._inner, angle2 as _);
}
}
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct LineDial {
_inner: *mut Fl_Line_Dial,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl LineDial {
pub fn angles(&self) -> (u16, u16) {
let angle1 = unsafe { Fl_Dial_angle1(self._inner as _) };
let angle2 = unsafe { Fl_Dial_angle1(self._inner as _) };
(angle1 as u16, angle2 as u16)
}
pub fn set_angles(&mut self, angle1: u16, angle2: u16) {
if angle1 <= 360 {
unsafe {
Fl_Dial_set_angle1(self._inner as _, angle1 as _);
}
}
if angle2 <= 360 {
unsafe {
Fl_Dial_set_angle2(self._inner as _, angle2 as _);
}
}
}
}
#[repr(i32)]
#[derive(WidgetType, Debug, Copy, Clone, PartialEq)]
pub enum DialType {
Normal = 0,
Line = 1,
Fill = 2,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct Counter {
_inner: *mut Fl_Counter,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[repr(i32)]
#[derive(WidgetType, Debug, Copy, Clone, PartialEq)]
pub enum CounterType {
Normal = 0,
Simple = 1,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct Scrollbar {
_inner: *mut Fl_Scrollbar,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl Scrollbar {
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}
#[repr(i32)]
#[derive(WidgetType, Debug, Copy, Clone, PartialEq)]
pub enum ScrollbarType {
Vertical = 0,
Horizontal = 1,
VerticalFill = 2,
HorizontalFill = 3,
VerticalNice = 4,
HorizontalNice = 5,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct Roller {
_inner: *mut Fl_Roller,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct ValueSlider {
_inner: *mut Fl_Value_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl ValueSlider {
pub fn text_font(&self) -> Font {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Value_Slider_text_font(self._inner)) }
}
pub fn set_text_font(&mut self, f: Font) {
assert!(!self.was_deleted());
unsafe { Fl_Value_Slider_set_text_font(self._inner, f.bits() as i32) }
}
pub fn text_size(&self) -> u32 {
assert!(!self.was_deleted());
unsafe { Fl_Value_Slider_text_size(self._inner) as u32 }
}
pub fn set_text_size(&mut self, s: u32) {
debug_assert!(
s <= std::isize::MAX as u32,
"u32 entries have to be < std::isize::MAX for compatibility!"
);
assert!(!self.was_deleted());
unsafe { Fl_Value_Slider_set_text_size(self._inner, s as i32) }
}
pub fn text_color(&self) -> Color {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Value_Slider_text_color(self._inner)) }
}
pub fn set_text_color(&mut self, color: Color) {
assert!(!self.was_deleted());
unsafe { Fl_Value_Slider_set_text_color(self._inner, color.bits() as u32) }
}
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct Adjuster {
_inner: *mut Fl_Adjuster,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct ValueInput {
_inner: *mut Fl_Value_Input,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl ValueInput {
pub fn text_font(&self) -> Font {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Value_Input_text_font(self._inner)) }
}
pub fn set_text_font(&mut self, f: Font) {
assert!(!self.was_deleted());
unsafe { Fl_Value_Input_set_text_font(self._inner, f.bits() as i32) }
}
pub fn text_size(&self) -> u32 {
assert!(!self.was_deleted());
unsafe { Fl_Value_Input_text_size(self._inner) as u32 }
}
pub fn set_text_size(&mut self, s: u32) {
debug_assert!(
s <= std::isize::MAX as u32,
"u32 entries have to be < std::isize::MAX for compatibility!"
);
assert!(!self.was_deleted());
unsafe { Fl_Value_Input_set_text_size(self._inner, s as i32) }
}
pub fn text_color(&self) -> Color {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Value_Input_text_color(self._inner)) }
}
pub fn set_text_color(&mut self, color: Color) {
assert!(!self.was_deleted());
unsafe { Fl_Value_Input_set_text_color(self._inner, color.bits() as u32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct ValueOutput {
_inner: *mut Fl_Value_Output,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl ValueOutput {
pub fn text_font(&self) -> Font {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Value_Output_text_font(self._inner)) }
}
pub fn set_text_font(&mut self, f: Font) {
assert!(!self.was_deleted());
unsafe { Fl_Value_Output_set_text_font(self._inner, f.bits() as i32) }
}
pub fn text_size(&self) -> u32 {
assert!(!self.was_deleted());
unsafe { Fl_Value_Output_text_size(self._inner) as u32 }
}
pub fn set_text_size(&mut self, s: u32) {
debug_assert!(
s <= std::isize::MAX as u32,
"u32 entries have to be < std::isize::MAX for compatibility!"
);
assert!(!self.was_deleted());
unsafe { Fl_Value_Output_set_text_size(self._inner, s as i32) }
}
pub fn text_color(&self) -> Color {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Value_Output_text_color(self._inner)) }
}
pub fn set_text_color(&mut self, color: Color) {
assert!(!self.was_deleted());
unsafe { Fl_Value_Output_set_text_color(self._inner, color.bits() as u32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct FillSlider {
_inner: *mut Fl_Fill_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct FillDial {
_inner: *mut Fl_Fill_Dial,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl FillDial {
pub fn angles(&self) -> (u16, u16) {
let angle1 = unsafe { Fl_Dial_angle1(self._inner as _) };
let angle2 = unsafe { Fl_Dial_angle1(self._inner as _) };
(angle1 as u16, angle2 as u16)
}
pub fn set_angles(&mut self, angle1: u16, angle2: u16) {
if angle1 <= 360 {
unsafe {
Fl_Dial_set_angle1(self._inner as _, angle1 as _);
}
}
if angle2 <= 360 {
unsafe {
Fl_Dial_set_angle2(self._inner as _, angle2 as _);
}
}
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct HorSlider {
_inner: *mut Fl_Hor_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl HorSlider {
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct HorFillSlider {
_inner: *mut Fl_Hor_Fill_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl HorFillSlider {
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct HorNiceSlider {
_inner: *mut Fl_Hor_Nice_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl HorNiceSlider {
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}
#[derive(WidgetBase, WidgetExt, ValuatorExt, Debug)]
pub struct HorValueSlider {
_inner: *mut Fl_Hor_Value_Slider,
_tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
}
impl HorValueSlider {
pub fn text_font(&self) -> Font {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Hor_Value_Slider_text_font(self._inner)) }
}
pub fn set_text_font(&mut self, f: Font) {
assert!(!self.was_deleted());
unsafe { Fl_Hor_Value_Slider_set_text_font(self._inner, f.bits() as i32) }
}
pub fn text_size(&self) -> u32 {
assert!(!self.was_deleted());
unsafe { Fl_Hor_Value_Slider_text_size(self._inner) as u32 }
}
pub fn set_text_size(&mut self, s: u32) {
debug_assert!(
s <= std::isize::MAX as u32,
"u32 entries have to be < std::isize::MAX for compatibility!"
);
assert!(!self.was_deleted());
unsafe { Fl_Hor_Value_Slider_set_text_size(self._inner, s as i32) }
}
pub fn text_color(&self) -> Color {
assert!(!self.was_deleted());
unsafe { std::mem::transmute(Fl_Hor_Value_Slider_text_color(self._inner)) }
}
pub fn set_text_color(&mut self, color: Color) {
assert!(!self.was_deleted());
unsafe { Fl_Hor_Value_Slider_set_text_color(self._inner, color.bits() as u32) }
}
pub fn slider_size(&self) -> f32 {
unsafe { Fl_Slider_slider_size(self._inner as _) }
}
pub fn set_slider_size(&mut self, v: f32) {
unsafe { Fl_Slider_set_slider_size(self._inner as _, v) }
}
pub fn slider_frame(&self) -> FrameType {
unsafe { mem::transmute(Fl_Slider_slider_box(self._inner as _)) }
}
pub fn set_slider_frame(&mut self, c: FrameType) {
unsafe { Fl_Slider_set_slider_box(self._inner as _, c as i32) }
}
}