#![allow(unused_imports)]
use crate::app::screen_size;
use crate::enums::{
Align, CallbackTrigger, Color, Cursor, Damage, Event, Font, FrameType, LabelType, Mode,
};
use crate::image::Image;
use crate::prelude::*;
use crate::utils::FlString;
use crate::widget::Widget;
use fltk_sys::window::*;
#[cfg(feature = "raw-window-handle")]
use raw_window_handle::*;
#[cfg(feature = "rwh05")]
use rwh05::*;
use std::{
ffi::{CStr, CString},
mem,
ops::{Deref, DerefMut},
os::raw,
};
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android",
feature = "use-wayland"
))]
pub type RawHandle = *mut raw::c_void;
#[cfg(all(
not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android",
feature = "use-wayland"
)),
any(
target_arch = "arm",
target_arch = "mips",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "wasm32",
target_arch = "x86",
)
))]
pub type RawHandle = u32;
#[cfg(all(
not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android",
feature = "use-wayland"
)),
any(
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "powerpc64",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "x86_64",
)
))]
pub type RawHandle = u64;
pub type Window = DoubleWindow;
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum WindowType {
Normal = 240,
Double = 241,
}
impl WindowType {
pub const Single: WindowType = WindowType::Normal;
}
crate::macros::widget::impl_widget_type!(WindowType);
#[derive(Debug)]
pub struct SingleWindow {
inner: *mut Fl_Single_Window,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
is_derived: bool,
}
crate::macros::widget::impl_widget_ext!(SingleWindow, Fl_Single_Window);
crate::macros::widget::impl_widget_base!(SingleWindow, Fl_Single_Window);
crate::macros::group::impl_group_ext!(SingleWindow, Fl_Single_Window);
crate::macros::window::impl_window_ext!(SingleWindow, Fl_Single_Window);
impl Default for SingleWindow {
fn default() -> Self {
assert!(crate::app::is_ui_thread());
let mut win = SingleWindow::new(0, 0, 0, 0, None);
win.free_position();
win
}
}
impl SingleWindow {
pub unsafe fn find_by_handle(handle: RawHandle) -> Option<impl WindowExt> {
let ptr = Fl_Window_find_by_handle(&handle as *const _ as *mut _);
if ptr.is_null() {
None
} else {
Some(Window::from_widget_ptr(
ptr as *mut fltk_sys::widget::Fl_Widget,
))
}
}
pub fn show_with_env_args(&mut self) {
assert!(!self.was_deleted());
unsafe {
let args: Vec<String> = std::env::args().collect();
let len = args.len() as i32;
let mut v: Vec<*mut raw::c_char> = vec![];
for arg in args {
let c = CString::safe_new(arg.as_str());
v.push(c.into_raw() as *mut raw::c_char);
}
let mut v = mem::ManuallyDrop::new(v);
Fl_Window_show_with_args(self.inner as *mut Fl_Window, len, v.as_mut_ptr())
}
}
pub fn show_with_args(&mut self, args: &[&str]) {
assert!(!self.was_deleted());
unsafe {
let mut temp = vec![""];
temp.extend(args);
let len = temp.len() as i32;
let mut v: Vec<*mut raw::c_char> = vec![];
for arg in temp {
let c = CString::safe_new(arg);
v.push(c.into_raw() as *mut raw::c_char);
}
let mut v = mem::ManuallyDrop::new(v);
Fl_Window_show_with_args(self.inner as *mut Fl_Window, len, v.as_mut_ptr())
}
}
pub fn pixels_per_unit(&self) -> f32 {
assert!(!self.was_deleted());
#[allow(unused_mut)]
let mut factor = 1.0;
#[cfg(target_os = "macos")]
{
extern "C" {
pub fn cfltk_getScalingFactor(handle: *mut raw::c_void) -> f64;
}
let mac_version = unsafe { fltk_sys::fl::Fl_mac_os_version() };
if mac_version >= 100700 {
factor = unsafe { cfltk_getScalingFactor(self.raw_handle()) };
}
}
let s = crate::app::screen_scale(self.screen_num());
s * factor as f32
}
pub fn pixel_w(&self) -> i32 {
(self.pixels_per_unit() * self.w() as f32) as i32
}
pub fn pixel_h(&self) -> i32 {
(self.pixels_per_unit() * self.h() as f32) as i32
}
pub fn default_xclass() -> Option<String> {
unsafe {
let ptr = Fl_Single_Window_default_xclass();
if ptr.is_null() {
None
} else {
Some(CStr::from_ptr(ptr).to_string_lossy().to_string())
}
}
}
pub fn set_default_xclass(s: &str) {
let s = CString::safe_new(s);
unsafe { Fl_Single_Window_set_default_xclass(s.as_ptr()) }
}
pub fn set_on_top(&self) {
#[cfg(target_os = "macos")]
{
extern "C" {
pub fn cfltk_setOnTop(handle: *mut raw::c_void);
}
assert!(self.border());
unsafe {
cfltk_setOnTop(self.raw_handle());
}
}
}
}
#[derive(Debug)]
pub struct DoubleWindow {
inner: *mut Fl_Double_Window,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
is_derived: bool,
}
crate::macros::widget::impl_widget_ext!(DoubleWindow, Fl_Double_Window);
crate::macros::widget::impl_widget_base!(DoubleWindow, Fl_Double_Window);
crate::macros::group::impl_group_ext!(DoubleWindow, Fl_Double_Window);
crate::macros::window::impl_window_ext!(DoubleWindow, Fl_Double_Window);
impl Default for DoubleWindow {
fn default() -> Self {
assert!(crate::app::is_ui_thread());
let mut win = DoubleWindow::new(0, 0, 0, 0, None);
win.free_position();
win
}
}
impl DoubleWindow {
pub unsafe fn find_by_handle(handle: RawHandle) -> Option<impl WindowExt> {
let ptr = Fl_Window_find_by_handle(&handle as *const _ as *mut _);
if ptr.is_null() {
None
} else {
Some(Window::from_widget_ptr(
ptr as *mut fltk_sys::widget::Fl_Widget,
))
}
}
pub fn show_with_env_args(&mut self) {
assert!(!self.was_deleted());
unsafe {
let args: Vec<String> = std::env::args().collect();
let len = args.len() as i32;
let mut v: Vec<*mut raw::c_char> = vec![];
for arg in args {
let c = CString::safe_new(arg.as_str());
v.push(c.into_raw() as *mut raw::c_char);
}
let mut v = mem::ManuallyDrop::new(v);
Fl_Window_show_with_args(self.inner as *mut Fl_Window, len, v.as_mut_ptr())
}
}
pub fn show_with_args(&mut self, args: &[&str]) {
assert!(!self.was_deleted());
unsafe {
let mut temp = vec![""];
temp.extend(args);
let len = temp.len() as i32;
let mut v: Vec<*mut raw::c_char> = vec![];
for arg in temp {
let c = CString::safe_new(arg);
v.push(c.into_raw() as *mut raw::c_char);
}
let mut v = mem::ManuallyDrop::new(v);
Fl_Window_show_with_args(self.inner as *mut Fl_Window, len, v.as_mut_ptr())
}
}
pub fn flush(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Double_Window_flush(self.inner) }
}
pub fn pixels_per_unit(&self) -> f32 {
assert!(!self.was_deleted());
#[allow(unused_mut)]
let mut factor = 1.0;
#[cfg(target_os = "macos")]
{
extern "C" {
pub fn cfltk_getScalingFactor(handle: *mut raw::c_void) -> f64;
}
let mac_version = unsafe { fltk_sys::fl::Fl_mac_os_version() };
if mac_version >= 100700 {
factor = unsafe { cfltk_getScalingFactor(self.raw_handle()) };
}
}
let s = crate::app::screen_scale(self.screen_num());
s * factor as f32
}
pub fn pixel_w(&self) -> i32 {
(self.pixels_per_unit() * self.w() as f32) as i32
}
pub fn pixel_h(&self) -> i32 {
(self.pixels_per_unit() * self.h() as f32) as i32
}
pub fn platform_show(&self) {
#[allow(unused_unsafe)]
unsafe {
#[cfg(target_os = "windows")]
{
extern "system" {
fn ShowWindow(hwnd: *mut raw::c_void, nCmdShow: raw::c_int) -> raw::c_int;
}
ShowWindow(self.raw_handle(), 9);
}
#[cfg(target_os = "macos")]
{
extern "C" {
fn cfltk_winShow(xid: *mut raw::c_void);
}
cfltk_winShow(self.raw_handle());
}
#[cfg(not(any(
target_os = "macos",
target_os = "android",
target_os = "windows",
feature = "use-wayland"
)))]
{
enum Display {}
extern "C" {
fn XMapWindow(display: *mut Display, win: u64);
}
XMapWindow(crate::app::display() as _, self.raw_handle() as _);
crate::app::flush();
}
#[cfg(feature = "use-wayland")]
{
Fl_Double_Window_show(self.inner);
}
}
}
pub fn platform_hide(&self) {
#[allow(unused_unsafe)]
unsafe {
#[cfg(target_os = "windows")]
{
extern "system" {
fn ShowWindow(hwnd: *mut raw::c_void, nCmdShow: raw::c_int) -> raw::c_int;
}
ShowWindow(self.raw_handle(), 0);
}
#[cfg(target_os = "macos")]
{
extern "C" {
fn cfltk_winHide(xid: *mut raw::c_void);
}
cfltk_winHide(self.raw_handle());
}
#[cfg(not(any(target_os = "macos", target_os = "android", target_os = "windows",)))]
{
#[cfg(not(feature = "use-wayland"))]
{
enum Display {}
extern "C" {
fn XUnmapWindow(display: *mut Display, win: u64);
}
XUnmapWindow(crate::app::display() as _, self.raw_handle() as _);
crate::app::flush();
}
#[cfg(feature = "use-wayland")]
{
extern "C" {
fn wl_proxy_marshal(proxy: *mut raw::c_void, opcode: u32, ...);
}
wl_proxy_marshal(
self.raw_handle() as _,
1,
std::ptr::null_mut() as *mut raw::c_void,
0,
0,
); wl_proxy_marshal(self.raw_handle() as _, 6); }
}
}
}
pub fn default_xclass() -> Option<String> {
unsafe {
let ptr = Fl_Double_Window_default_xclass();
if ptr.is_null() {
None
} else {
Some(CStr::from_ptr(ptr).to_string_lossy().to_string())
}
}
}
pub fn set_default_xclass(s: &str) {
let s = CString::safe_new(s);
unsafe { Fl_Double_Window_set_default_xclass(s.as_ptr()) }
}
#[cfg(target_os = "macos")]
pub fn set_on_top(&mut self) {
assert!(!self.border());
extern "C" {
pub fn cfltk_setOnTop(handle: *mut raw::c_void);
}
unsafe {
cfltk_setOnTop(self.raw_handle());
}
}
}
#[derive(Debug)]
pub struct MenuWindow {
inner: *mut Fl_Menu_Window,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
is_derived: bool,
}
crate::macros::widget::impl_widget_ext!(MenuWindow, Fl_Menu_Window);
crate::macros::widget::impl_widget_base!(MenuWindow, Fl_Menu_Window);
crate::macros::group::impl_group_ext!(MenuWindow, Fl_Menu_Window);
crate::macros::window::impl_window_ext!(MenuWindow, Fl_Menu_Window);
impl Default for MenuWindow {
fn default() -> Self {
assert!(crate::app::is_ui_thread());
let mut win = MenuWindow::new(0, 0, 0, 0, None);
win.free_position();
win
}
}
#[derive(Debug)]
pub struct OverlayWindow {
inner: *mut Fl_Overlay_Window,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
is_derived: bool,
}
crate::macros::widget::impl_widget_ext!(OverlayWindow, Fl_Overlay_Window);
crate::macros::widget::impl_widget_base!(OverlayWindow, Fl_Overlay_Window);
crate::macros::group::impl_group_ext!(OverlayWindow, Fl_Overlay_Window);
crate::macros::window::impl_window_ext!(OverlayWindow, Fl_Overlay_Window);
impl Default for OverlayWindow {
fn default() -> Self {
assert!(crate::app::is_ui_thread());
let mut win = OverlayWindow::new(0, 0, 0, 0, None);
win.free_position();
win
}
}
impl OverlayWindow {
pub unsafe fn find_by_handle(handle: RawHandle) -> Option<impl WindowExt> {
let ptr = Fl_Window_find_by_handle(&handle as *const _ as *mut _);
if ptr.is_null() {
None
} else {
Some(Window::from_widget_ptr(
ptr as *mut fltk_sys::widget::Fl_Widget,
))
}
}
pub fn show_with_env_args(&mut self) {
assert!(!self.was_deleted());
unsafe {
let args: Vec<String> = std::env::args().collect();
let len = args.len() as i32;
let mut v: Vec<*mut raw::c_char> = vec![];
for arg in args {
let c = CString::safe_new(arg.as_str());
v.push(c.into_raw() as *mut raw::c_char);
}
let mut v = mem::ManuallyDrop::new(v);
Fl_Window_show_with_args(self.inner as *mut Fl_Window, len, v.as_mut_ptr())
}
}
pub fn show_with_args(&mut self, args: &[&str]) {
assert!(!self.was_deleted());
unsafe {
let mut temp = vec![""];
temp.extend(args);
let len = temp.len() as i32;
let mut v: Vec<*mut raw::c_char> = vec![];
for arg in temp {
let c = CString::safe_new(arg);
v.push(c.into_raw() as *mut raw::c_char);
}
let mut v = mem::ManuallyDrop::new(v);
Fl_Window_show_with_args(self.inner as *mut Fl_Window, len, v.as_mut_ptr())
}
}
pub fn flush(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Double_Window_flush(self.inner as _) }
}
pub fn draw_overlay<F: FnMut(&mut Self) + 'static>(&mut self, cb: F) {
assert!(!self.was_deleted());
assert!(self.is_derived);
unsafe {
unsafe extern "C" fn shim(wid: *mut Fl_Widget, data: *mut raw::c_void) {
let mut wid = OverlayWindow::from_widget_ptr(wid as *mut _);
let a: *mut Box<dyn FnMut(&mut OverlayWindow)> =
data as *mut Box<dyn FnMut(&mut OverlayWindow)>;
let f: &mut (dyn FnMut(&mut OverlayWindow)) = &mut **a;
let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| f(&mut wid)));
}
let mut _old_data = None;
if self.is_derived {
_old_data = self.draw_data();
}
let a: *mut Box<dyn FnMut(&mut Self)> = Box::into_raw(Box::new(Box::new(cb)));
let data: *mut raw::c_void = a as *mut raw::c_void;
let callback: custom_draw_callback = Some(shim);
Fl_Overlay_Window_draw_overlay(self.inner, callback, data);
}
}
pub fn redraw_overlay(&self) {
assert!(!self.was_deleted());
unsafe { Fl_Overlay_Window_redraw_overlay(self.inner) }
}
pub fn can_do_overlay(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Overlay_Window_can_do_overlay(self.inner) != 0 }
}
}
pub type GlContext = *mut raw::c_void;
#[cfg(feature = "enable-glwindow")]
#[derive(Debug)]
pub struct GlutWindow {
inner: *mut Fl_Glut_Window,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
is_derived: bool,
}
#[cfg(feature = "enable-glwindow")]
crate::macros::widget::impl_widget_ext!(GlutWindow, Fl_Glut_Window);
#[cfg(feature = "enable-glwindow")]
crate::macros::widget::impl_widget_base!(GlutWindow, Fl_Glut_Window);
#[cfg(feature = "enable-glwindow")]
crate::macros::widget::impl_widget_default!(GlutWindow);
#[cfg(feature = "enable-glwindow")]
crate::macros::group::impl_group_ext!(GlutWindow, Fl_Glut_Window);
#[cfg(feature = "enable-glwindow")]
crate::macros::window::impl_window_ext!(GlutWindow, Fl_Glut_Window);
#[cfg(feature = "enable-glwindow")]
impl GlutWindow {
pub fn default() -> GlutWindow {
assert!(crate::app::is_ui_thread());
let mut win = <GlutWindow as Default>::default();
win.free_position();
win
}
pub fn get_proc_address(&self, s: &str) -> *const raw::c_void {
extern "C" {
pub fn get_proc(name: *const raw::c_char) -> *mut raw::c_void;
}
let s = CString::safe_new(s);
let ret = unsafe { get_proc(s.as_ptr() as _) };
if !ret.is_null() {
ret as *const _
} else {
unsafe { Fl_Glut_Window_get_proc_address(self.inner, s.as_ptr()) as *const _ }
}
}
pub fn flush(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_flush(self.inner) }
}
pub fn valid(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_valid(self.inner) != 0 }
}
pub fn set_valid(&mut self, v: bool) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_set_valid(self.inner, v as raw::c_char) }
}
pub fn context_valid(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_context_valid(self.inner) != 0 }
}
pub fn set_context_valid(&mut self, v: bool) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_set_context_valid(self.inner, v as raw::c_char) }
}
pub fn context(&self) -> Option<GlContext> {
assert!(!self.was_deleted());
unsafe {
let ctx = Fl_Glut_Window_context(self.inner);
if ctx.is_null() {
None
} else {
Some(ctx)
}
}
}
pub fn set_context(&mut self, ctx: GlContext, destroy_flag: bool) {
assert!(!self.was_deleted());
assert!(!ctx.is_null());
unsafe { Fl_Glut_Window_set_context(self.inner, ctx, destroy_flag as i32) }
}
pub fn swap_buffers(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_swap_buffers(self.inner) }
}
pub fn ortho(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_ortho(self.inner) }
}
pub fn can_do_overlay(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_can_do_overlay(self.inner) != 0 }
}
pub fn redraw_overlay(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_redraw_overlay(self.inner) }
}
pub fn hide_overlay(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_hide_overlay(self.inner) }
}
pub fn make_overlay_current(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_make_overlay_current(self.inner) }
}
pub fn pixels_per_unit(&self) -> f32 {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_pixels_per_unit(self.inner) }
}
pub fn pixel_w(&self) -> i32 {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_pixel_w(self.inner) }
}
pub fn pixel_h(&self) -> i32 {
assert!(!self.was_deleted());
unsafe { Fl_Glut_Window_pixel_h(self.inner) }
}
pub fn mode(&self) -> Mode {
assert!(!self.was_deleted());
unsafe { mem::transmute(Fl_Glut_Window_mode(self.inner)) }
}
pub fn set_mode(&mut self, mode: Mode) {
assert!(!self.was_deleted());
unsafe {
Fl_Glut_Window_set_mode(self.inner, mode.bits());
}
}
}
#[cfg(feature = "enable-glwindow")]
pub type GlWindow = GlutWindow;
#[doc(hidden)]
pub mod experimental {
use super::*;
#[cfg(feature = "enable-glwindow")]
#[derive(Debug)]
pub struct GlWidgetWindow {
inner: *mut Fl_Gl_Window,
tracker: *mut fltk_sys::fl::Fl_Widget_Tracker,
is_derived: bool,
}
#[cfg(feature = "enable-glwindow")]
crate::macros::widget::impl_widget_ext!(GlWidgetWindow, Fl_Gl_Window);
#[cfg(feature = "enable-glwindow")]
crate::macros::widget::impl_widget_base!(GlWidgetWindow, Fl_Gl_Window);
#[cfg(feature = "enable-glwindow")]
crate::macros::widget::impl_widget_default!(GlWidgetWindow);
#[cfg(feature = "enable-glwindow")]
crate::macros::group::impl_group_ext!(GlWidgetWindow, Fl_Gl_Window);
#[cfg(feature = "enable-glwindow")]
crate::macros::window::impl_window_ext!(GlWidgetWindow, Fl_Gl_Window);
#[cfg(feature = "enable-glwindow")]
impl GlWidgetWindow {
pub fn default() -> GlWidgetWindow {
assert!(crate::app::is_ui_thread());
let mut win = <GlWidgetWindow as Default>::default();
win.free_position();
win.set_frame(FrameType::FlatBox);
win.begin();
win
}
pub fn new<T: Into<Option<&'static str>>>(
x: i32,
y: i32,
w: i32,
h: i32,
label: T,
) -> GlWidgetWindow {
let mut win = <GlWidgetWindow as WidgetBase>::new(x, y, w, h, label);
win.set_frame(FrameType::FlatBox);
win.begin();
win
}
pub fn get_proc_address(&self, s: &str) -> *const raw::c_void {
extern "C" {
pub fn get_proc(name: *const raw::c_char) -> *mut raw::c_void;
}
let s = CString::safe_new(s);
let ret = unsafe { get_proc(s.as_ptr() as _) };
if !ret.is_null() {
ret as *const _
} else {
unsafe { Fl_Gl_Window_get_proc_address(self.inner, s.as_ptr()) as *const _ }
}
}
pub fn flush(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_flush(self.inner) }
}
pub fn valid(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_valid(self.inner) != 0 }
}
pub fn set_valid(&mut self, v: bool) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_set_valid(self.inner, v as raw::c_char) }
}
pub fn context_valid(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_context_valid(self.inner) != 0 }
}
pub fn set_context_valid(&mut self, v: bool) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_set_context_valid(self.inner, v as raw::c_char) }
}
pub fn context(&self) -> Option<GlContext> {
assert!(!self.was_deleted());
unsafe {
let ctx = Fl_Gl_Window_context(self.inner);
if ctx.is_null() {
None
} else {
Some(ctx)
}
}
}
pub fn set_context(&mut self, ctx: GlContext, destroy_flag: bool) {
assert!(!self.was_deleted());
assert!(!ctx.is_null());
unsafe { Fl_Gl_Window_set_context(self.inner, ctx, destroy_flag as i32) }
}
pub fn swap_buffers(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_swap_buffers(self.inner) }
}
pub fn ortho(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_ortho(self.inner) }
}
pub fn can_do_overlay(&self) -> bool {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_can_do_overlay(self.inner) != 0 }
}
pub fn redraw_overlay(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_redraw_overlay(self.inner) }
}
pub fn hide_overlay(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_hide_overlay(self.inner) }
}
pub fn make_overlay_current(&mut self) {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_make_overlay_current(self.inner) }
}
pub fn pixels_per_unit(&self) -> f32 {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_pixels_per_unit(self.inner) }
}
pub fn pixel_w(&self) -> i32 {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_pixel_w(self.inner) }
}
pub fn pixel_h(&self) -> i32 {
assert!(!self.was_deleted());
unsafe { Fl_Gl_Window_pixel_h(self.inner) }
}
pub fn mode(&self) -> Mode {
assert!(!self.was_deleted());
unsafe { mem::transmute(Fl_Gl_Window_mode(self.inner)) }
}
pub fn set_mode(&mut self, mode: Mode) {
assert!(!self.was_deleted());
unsafe {
Fl_Gl_Window_set_mode(self.inner, mode.bits());
}
}
}
}
pub struct AndroidWindow {
win: Window,
}
impl Default for AndroidWindow {
fn default() -> Self {
let (w, h) = screen_size();
let mut w = AndroidWindow {
win: Window::new(0, 30, w as i32, h as i32 - 30, ""),
};
w.win.set_color(Color::White);
w
}
}
crate::widget_extends!(AndroidWindow, Window, win);