diff --git a/Cargo.toml b/Cargo.toml index c2aeb76..f5790bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,3 +15,8 @@ exclude = ["/screenshots", "./examples"] [dependencies] fltk = "1.1.6" +[target.'cfg(target_os = "macos")'.dependencies] +lazy_static = "1.4" + +[target.'cfg(target_os = "macos")'.build-dependencies] +cc = "1" \ No newline at end of file diff --git a/bind.sh b/bind.sh new file mode 100755 index 0000000..84c7ecc --- /dev/null +++ b/bind.sh @@ -0,0 +1 @@ +bindgen src/cocoa_helper.h -o src/cocoa_helper.rs \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..33baff9 --- /dev/null +++ b/build.rs @@ -0,0 +1,9 @@ +#[cfg(target_os = "macos")] +fn main() { + let mut build = cc::Build::new(); + build.file("src/cocoa_helper.m"); + build.compile("cocoa"); +} + +#[cfg(not(target_os = "macos"))] +fn main() {} diff --git a/examples/widget_theme.rs b/examples/widget_theme.rs index 04dd21e..18660ab 100644 --- a/examples/widget_theme.rs +++ b/examples/widget_theme.rs @@ -35,5 +35,6 @@ fn main() { }; theme.apply(); }); + a.run().unwrap(); } diff --git a/src/cocoa_helper.h b/src/cocoa_helper.h new file mode 100644 index 0000000..f22e2a2 --- /dev/null +++ b/src/cocoa_helper.h @@ -0,0 +1,25 @@ +#pragma once + +#ifndef COCOA_COLOR_DEFINITION + +#define COLOR_GET(color) \ + void my_##color(double *r, double *g, double *b, double *a); + +#else + +#define COLOR_GET(color) \ + void my_##color(double *r, double *g, double *b, double *a) { \ + NSColor *i = [NSColor color]; \ + NSColor *c = [i colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]]; \ + [c getRed:r green:g blue:b alpha:a]; \ + } + +#endif + +COLOR_GET(windowBackgroundColor) + +COLOR_GET(labelColor) + +COLOR_GET(controlBackgroundColor) + + diff --git a/src/cocoa_helper.m b/src/cocoa_helper.m new file mode 100644 index 0000000..ec95019 --- /dev/null +++ b/src/cocoa_helper.m @@ -0,0 +1,4 @@ +#import + +#define COCOA_COLOR_DEFINITION +#include "cocoa_helper.h" \ No newline at end of file diff --git a/src/cocoa_helper.rs b/src/cocoa_helper.rs new file mode 100644 index 0000000..78f57bf --- /dev/null +++ b/src/cocoa_helper.rs @@ -0,0 +1,11 @@ +/* automatically generated by rust-bindgen 0.57.0 */ + +extern "C" { + pub fn my_windowBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_labelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_controlBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} diff --git a/src/lib.rs b/src/lib.rs index 1e599ea..76b3db4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,9 +68,11 @@ fn main() { */ use fltk::{app, enums::Color}; +#[cfg(target_os = "macos")] +mod cocoa_helper; pub mod color_themes; -pub mod widget_themes; pub mod widget_schemes; +pub mod widget_themes; /// Color map struct. (index, r, g, b) #[derive(Default, Clone, Debug)] @@ -129,8 +131,11 @@ pub enum ThemeType { Aero, /// Windows 8 Metro, - /// MacOS + /// Classic MacOS Aqua, + #[cfg(target_os = "macos")] + /// Modern MacOS using system colors, supports Dark theme + Aqua2, /// Xfce Greybird, /// Windows 2000 @@ -160,6 +165,8 @@ impl WidgetTheme { ThemeType::Classic => widget_themes::classic::use_classic_theme(), ThemeType::Aero => widget_themes::aero::use_aero_theme(), ThemeType::Aqua => widget_themes::aqua::use_aqua_theme(), + #[cfg(target_os = "macos")] + ThemeType::Aqua2 => widget_themes::aqua2::use_aqua2_theme(), ThemeType::Dark => widget_themes::dark::use_dark_theme(), ThemeType::HighContrast => widget_themes::high_contrast::use_high_contrast_theme(), ThemeType::Blue => widget_themes::blue::use_blue_theme(), diff --git a/src/widget_schemes/svg_based.rs b/src/widget_schemes/svg_based.rs index 5f221ab..60cf166 100644 --- a/src/widget_schemes/svg_based.rs +++ b/src/widget_schemes/svg_based.rs @@ -55,7 +55,6 @@ fn oflat_box(x: i32, y: i32, w: i32, h: i32, c: Color) { image.draw(x, y, w, h); } - pub(crate) fn use_svg_based_scheme() { use fltk::enums::FrameType::*; app::reload_scheme().ok(); diff --git a/src/widget_themes/aqua2.rs b/src/widget_themes/aqua2.rs new file mode 100644 index 0000000..12fb3f3 --- /dev/null +++ b/src/widget_themes/aqua2.rs @@ -0,0 +1,443 @@ +use super::*; +use crate::cocoa_helper::*; +use fltk::{app, enums::Color, misc::Tooltip}; + +fn convert_colors(colors: (f64, f64, f64, f64)) -> (u8, u8, u8, u8) { + let r = (colors.0 * 255.0) as u8; + let g = (colors.1 * 255.0) as u8; + let b = (colors.2 * 255.0) as u8; + let a = (colors.3 * 255.0) as u8; + (r, g, b, a) +} + +macro_rules! get_colors { + ($s:ident) => {{ + let mut r = 1.0; + let mut g = 1.0; + let mut b = 1.0; + let mut a = 1.0; + unsafe { + $s(&mut r, &mut g, &mut b, &mut a); + } + convert_colors((r, g, b, a)) + }}; +} + +lazy_static::lazy_static! { + static ref BG_COL: (u8, u8, u8, u8) = { + get_colors!(my_windowBackgroundColor) + }; + static ref FG_COL: (u8, u8, u8, u8) = { + get_colors!(my_labelColor) + }; + static ref BG2_COL: (u8, u8, u8, u8) = { + if FG_COL.0 > 250 && FG_COL.1 > 250 && FG_COL.2 > 250 { + (0, 0, 0, 255) + } else { + (255, 255, 255, 255) + } + }; + static ref CONTROL_COL: (u8, u8, u8, u8) = { + get_colors!(my_controlBackgroundColor) + }; +} + +fn aqua2_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x9A, 0x9A, 0x9A))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x91, 0x91, 0x91))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x90, 0x90, 0x90))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side top inner borders + set_draw_color(activated_color(Color::from_rgb(0xFC, 0xFC, 0xFC))); + draw_yxline(x + 1, y + 3, y + h / 2 - 1); + draw_yxline(x + w - 2, y + 3, y + h / 2 - 1); + // side bottom inner borders + set_draw_color(activated_color(Color::from_rgb(0xF4, 0xF4, 0xF4))); + draw_yxline(x + 1, y + h / 2 - 1, y + h - 4); + draw_yxline(x + w - 2, y + 3, y + h - 4); + // bottom inner border + set_draw_color(activated_color(Color::from_rgb(0xF3, 0xF2, 0xF0))); + draw_xyline(x + 3, y + h - 2, x + w - 4); + // corners + set_draw_color(activated_color(Color::from_rgb(0xAF, 0xAF, 0xAF))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); +} + +fn aqua2_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + if w >= h { + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xFF, 0xFF, 0xFF), + Color::from_rgb(0xF6, 0xF5, 0xF4), + ); + // bottom fill + set_draw_color(activated_color(Color::from_rgb(0xED, 0xEC, 0xEA))); + draw_rectf(x + 2, y + h / 2, w - 4, h - h / 2 - 3); + // bottom gradient + set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); + draw_xyline(x + 2, y + h - 3, x + w - 3); + } else { + // left gradient + horizontal_gradient( + x + 2, + y + 2, + x + w / 2 - 1, + y + h - 3, + Color::from_rgb(0xFF, 0xFF, 0xFF), + Color::from_rgb(0xF6, 0xF5, 0xF4), + ); + // right fill + set_draw_color(activated_color(Color::from_rgb(0xED, 0xEC, 0xEA))); + draw_rectf(x + w / 2, y + 2, w - w / 2 - 3, h - 4); + // right gradient + set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); + draw_yxline(x + w - 3, y + 2, y + h - 3); + } + aqua2_button_up_frame(x, y, w, h, c); +} + +fn aqua2_panel_thin_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(devalued(c, 0.06751))); + draw_rect(x, y, w, h); +} + +fn aqua2_panel_thin_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 1, y + 1, w - 2, h - 2); + aqua2_panel_thin_up_frame(x, y, w, h, c); +} + +fn aqua2_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top and left borders + set_draw_color(activated_color(Color::from_rgb(0xD6, 0xD6, 0xD6))); + draw_yxline2(x, y + h - 2, y, x + w - 2); + // bottom and right borders + set_draw_color(activated_color(Color::from_rgb(0xF3, 0xF3, 0xF3))); + draw_xyline2(x, y + h - 1, x + w - 1, y); +} + +fn aqua2_spacer_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 1, y + 1, w - 2, h - 2); + aqua2_spacer_thin_down_frame(x, y, w, h, c); +} + +fn aqua2_radio_round_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(devalued(c, 0.42194))); + draw_arc(x, y, w, h, 0.0, 360.0); +} + +fn aqua2_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top edges + set_draw_color(activated_color(Color::from_rgb(0xF6, 0xF6, 0xF6))); + draw_arc(x + 1, y + 1, w - 2, h - 2, 0.0, 180.0); + // bottom edges + set_draw_color(activated_color(Color::from_rgb(0xEB, 0xEB, 0xEB))); + draw_arc(x + 1, y + 1, w - 2, h - 2, 180.0, 360.0); + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xFF, 0xFF, 0xFF), + Color::from_rgb(0xF6, 0xF5, 0xF4), + ); + // bottom fill + set_draw_color(activated_color(Color::from_rgb(0xED, 0xEC, 0xEA))); + draw_rectf(x + 2, y + h / 2, w - 4, h - h / 2 - 3); + // bottom gradient + set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); + draw_xyline(x + 2, y + h - 3, x + w - 3); + aqua2_radio_round_down_frame(x, y, w, h, c); +} + +fn aqua2_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x4C, 0x54, 0xAA))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x49, 0x4C, 0x8F))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x43, 0x46, 0x72))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xBC, 0xD6, 0xEF))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side top inner borders + set_draw_color(activated_color(Color::from_rgb(0x7C, 0xAB, 0xE9))); + draw_yxline(x + 1, y + 3, y + h / 2 - 1); + draw_yxline(x + w - 2, y + 3, y + h / 2 - 1); + // side bottom inner borders + set_draw_color(activated_color(Color::from_rgb(0x5F, 0xA1, 0xEA))); + draw_yxline(x + 1, y + h / 2, y + h - 4); + draw_yxline(x + w - 2, y + h / 2, y + h - 4); + // top corners + set_draw_color(activated_color(Color::from_rgb(0x79, 0x81, 0xBC))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); + // bottom corners + set_draw_color(activated_color(Color::from_rgb(0x72, 0x79, 0x96))); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); +} + +fn aqua2_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xA3, 0xC1, 0xEF), + Color::from_rgb(0x67, 0xA1, 0xE9), + ); + // bottom gradient + vertical_gradient( + x + 2, + y + h / 2, + x + w - 3, + y + h - 2, + Color::from_rgb(0x46, 0x93, 0xE9), + Color::from_rgb(0xAA, 0xD4, 0xF0), + ); + aqua2_depressed_down_frame(x, y, w, h, c); +} + +fn aqua2_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x9B, 0x9B, 0x9B))); + draw_xyline(x, y, x + w - 1); + // side and bottom outer borders + set_draw_color(activated_color(Color::from_rgb(0xBA, 0xBA, 0xBA))); + draw_yxline3(x, y + 1, y + h - 1, x + w - 1, y + 1); + // top shadow + set_draw_color(activated_color(Color::from_rgb(0xE3, 0xE3, 0xE3))); + draw_xyline(x + 1, y + 1, x + w - 2); + // inner border + set_draw_color(activated_color(Color::from_rgb(0xF5, 0xF5, 0xF5))); + draw_yxline3(x + 1, y + h - 2, y + 2, x + w - 2, y + h - 2); +} + +fn aqua2_input_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); + draw_rectf(x + 2, y + 3, w - 4, h - 4); + aqua2_input_thin_down_frame(x, y, w, h, c); +} + +fn aqua2_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x4E, 0x59, 0xA6))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x4C, 0x52, 0x89))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x48, 0x4F, 0x69))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xD0, 0xEA, 0xF6))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side top inner borders + set_draw_color(activated_color(Color::from_rgb(0x7A, 0xBF, 0xEF))); + draw_yxline(x + 1, y + 3, y + h / 2 - 1); + draw_yxline(x + w - 2, y + 3, y + h / 2 - 1); + // side bottom inner borders + set_draw_color(activated_color(Color::from_rgb(0x53, 0xAF, 0xEF))); + draw_yxline(x + 1, y + h / 2, y + h - 4); + draw_yxline(x + w - 2, y + h / 2, y + h - 4); + // top corners + set_draw_color(activated_color(Color::from_rgb(0x76, 0x80, 0xB5))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); + // bottom corners + set_draw_color(activated_color(Color::from_rgb(0x6F, 0x75, 0x89))); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); +} + +fn aqua2_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xBF, 0xDC, 0xF7), + Color::from_rgb(0x84, 0xC4, 0xF1), + ); + // bottom gradient + vertical_gradient( + x + 2, + y + h / 2, + x + w - 3, + y + h - 2, + Color::from_rgb(0x59, 0xB5, 0xF1), + Color::from_rgb(0xBA, 0xE9, 0xF7), + ); + aqua2_default_button_up_frame(x, y, w, h, c); +} + +fn aqua2_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0xAE, 0xAE, 0xAE))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x9E, 0x9E, 0x9E))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x8E, 0x8E, 0x8E))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xFA, 0xFA, 0xFA))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side inner borders + set_draw_color(activated_color(Color::from_rgb(0xF6, 0xF6, 0xF6))); + draw_yxline(x + 1, y + 3, y + h - 4); + draw_yxline(x + w - 2, y + 3, y + h - 4); + // bottom inner border + set_draw_color(activated_color(Color::from_rgb(0xF2, 0xF2, 0xF2))); + draw_xyline(x + 3, y + h - 2, x + w - 4); + // top corners + set_draw_color(activated_color(Color::from_rgb(0xA4, 0xA4, 0xA4))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); + // bottom corners + set_draw_color(activated_color(Color::from_rgb(0x94, 0x94, 0x94))); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); +} + +fn aqua2_tabs_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 2, y + 2, w - 4, h - 4); + aqua2_tabs_frame(x, y, w, h, c); +} + +fn aqua2_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // outer border + set_draw_color(activated_color(Color::from_rgb(0xA3, 0xA3, 0xA3))); + draw_rect(x, y, w, h); + // inner border + set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); + draw_rect(x + 1, y + 1, w - 2, h - 2); +} + +fn aqua2_swatch_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 2, y + 2, w - 4, h - 4); + aqua2_swatch_frame(x, y, w, h, c); +} + +fn use_aqua2_scheme() { + app::set_scheme(app::Scheme::Gtk); + app::set_frame_type_cb(OS_BUTTON_UP_BOX, aqua2_button_up_box, 1, 1, 2, 2); + app::set_frame_type2(OS_CHECK_DOWN_BOX, OS_BUTTON_UP_BOX); + app::set_frame_type_cb(OS_BUTTON_UP_FRAME, aqua2_button_up_frame, 1, 1, 2, 2); + app::set_frame_type2(OS_CHECK_DOWN_FRAME, OS_BUTTON_UP_FRAME); + app::set_frame_type_cb(OS_PANEL_THIN_UP_BOX, aqua2_panel_thin_up_box, 1, 1, 2, 2); + app::set_frame_type_cb( + OS_SPACER_THIN_DOWN_BOX, + aqua2_spacer_thin_down_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb(OS_PANEL_THIN_UP_FRAME, aqua2_panel_thin_up_frame, 1, 1, 2, 2); + app::set_frame_type_cb( + OS_SPACER_THIN_DOWN_FRAME, + aqua2_spacer_thin_down_frame, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_RADIO_ROUND_DOWN_BOX, + aqua2_radio_round_down_box, + 2, + 2, + 4, + 4, + ); + app::set_frame_type2(OS_HOVERED_UP_BOX, OS_BUTTON_UP_BOX); + app::set_frame_type_cb(OS_DEPRESSED_DOWN_BOX, aqua2_depressed_down_box, 1, 1, 2, 2); + app::set_frame_type2(OS_HOVERED_UP_FRAME, OS_BUTTON_UP_FRAME); + app::set_frame_type_cb( + OS_DEPRESSED_DOWN_FRAME, + aqua2_depressed_down_frame, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb(OS_INPUT_THIN_DOWN_BOX, aqua2_input_thin_down_box, 2, 3, 4, 6); + app::set_frame_type_cb( + OS_INPUT_THIN_DOWN_FRAME, + aqua2_input_thin_down_frame, + 2, + 3, + 4, + 6, + ); + app::set_frame_type_cb( + OS_DEFAULT_BUTTON_UP_BOX, + aqua2_default_button_up_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type2(OS_DEFAULT_HOVERED_UP_BOX, OS_HOVERED_UP_BOX); + app::set_frame_type2(OS_DEFAULT_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); + app::set_frame_type2(OS_TOOLBAR_BUTTON_HOVER_BOX, FrameType::FlatBox); + app::set_frame_type_cb(OS_TABS_BOX, aqua2_tabs_box, 2, 1, 4, 2); + app::set_frame_type_cb(OS_SWATCH_BOX, aqua2_swatch_box, 2, 2, 4, 4); + app::set_frame_type2(OS_MINI_BUTTON_UP_BOX, OS_BUTTON_UP_BOX); + app::set_frame_type2(OS_MINI_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); + app::set_frame_type2(OS_MINI_BUTTON_UP_FRAME, OS_BUTTON_UP_FRAME); + app::set_frame_type2(OS_MINI_DEPRESSED_DOWN_FRAME, OS_DEPRESSED_DOWN_FRAME); + app::set_frame_type2(FrameType::UpBox, OS_BUTTON_UP_BOX); + app::set_frame_type2(FrameType::DownBox, OS_BUTTON_UP_BOX); + app::set_frame_type2(FrameType::RoundDownBox, OS_RADIO_ROUND_DOWN_BOX); + app::set_frame_type2(OS_BG_BOX, FrameType::FlatBox); + // app::set_frame_type_cb(OS_BG_DOWN_BOX, OS_BG_BOX); +} + +fn use_aqua2_colors() { + app::background(BG_COL.0, BG_COL.1, BG_COL.2); + app::foreground(FG_COL.0, FG_COL.1, FG_COL.2); + app::background2(BG2_COL.0, BG2_COL.1, BG2_COL.2); + app::set_color(Color::Inactive, 0x4D, 0x4D, 0x69); + app::set_color(Color::Selection, 0x30, 0x60, 0xF6); + app::set_color(Color::Free, 0xFB, 0xFB, 0xFB); + Tooltip::set_color(Color::from_rgb(0xFF, 0xFF, 0xC7)); + Tooltip::set_text_color(Color::ForeGround); +} + +pub(crate) fn use_aqua2_theme() { + use_aqua2_scheme(); + use_aqua2_colors(); + use_native_settings(); +} diff --git a/src/widget_themes/mod.rs b/src/widget_themes/mod.rs index 851c4a6..1355bf9 100644 --- a/src/widget_themes/mod.rs +++ b/src/widget_themes/mod.rs @@ -1,16 +1,18 @@ #![allow(unused_variables)] #![allow(clippy::many_single_char_names)] +use crate::activated_color; use fltk::{ app, draw::*, enums::{Color, FrameType}, misc::Tooltip, }; -use crate::activated_color; pub(crate) mod aero; pub(crate) mod aqua; +#[cfg(target_os = "macos")] +pub(crate) mod aqua2; pub(crate) mod blue; pub(crate) mod classic; pub(crate) mod dark;