diff --git a/.gitignore b/.gitignore index 96ef6c0..b2c471e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +temp.* \ No newline at end of file diff --git a/examples/aqua2.rs b/examples/aqua2.rs new file mode 100644 index 0000000..b0041fe --- /dev/null +++ b/examples/aqua2.rs @@ -0,0 +1,18 @@ +#[cfg(target_os = "macos")] +fn main() { + use fltk::{prelude::*, *}; + use fltk_theme::{widget_themes, WidgetTheme, ThemeType}; + + let a = app::App::default(); + let widget_theme = WidgetTheme::new(ThemeType::Aqua2); + widget_theme.apply(); + let mut win = window::Window::default().with_size(400, 300); + let mut btn = button::Button::new(160, 200, 80, 30, "Hello"); + btn.set_frame(widget_themes::OS_DEFAULT_BUTTON_UP_BOX); + win.end(); + win.show(); + a.run().unwrap(); +} + +#[cfg(not(target_os = "macos"))] +fn main() {} \ No newline at end of file diff --git a/src/cocoa_helper.h b/src/cocoa_helper.h index f22e2a2..70428ef 100644 --- a/src/cocoa_helper.h +++ b/src/cocoa_helper.h @@ -22,4 +22,69 @@ COLOR_GET(labelColor) COLOR_GET(controlBackgroundColor) +COLOR_GET(windowFrameColor) + +COLOR_GET(secondaryLabelColor) + +COLOR_GET(tertiaryLabelColor) + +COLOR_GET(quaternaryLabelColor) + +COLOR_GET(textColor) + +COLOR_GET(placeholderTextColor) + +COLOR_GET(selectedTextColor) + +COLOR_GET(textBackgroundColor) + +COLOR_GET(selectedTextBackgroundColor) + +COLOR_GET(keyboardFocusIndicatorColor) + +COLOR_GET(unemphasizedSelectedTextColor) + +COLOR_GET(unemphasizedSelectedTextBackgroundColor) + +COLOR_GET(linkColor) + +COLOR_GET(separatorColor) + +COLOR_GET(selectedContentBackgroundColor) + +COLOR_GET(unemphasizedSelectedContentBackgroundColor) + +COLOR_GET(selectedMenuItemTextColor) + +COLOR_GET(gridColor) + +COLOR_GET(headerTextColor) + +COLOR_GET(controlAccentColor) + +COLOR_GET(controlColor) + +COLOR_GET(controlTextColor) + +COLOR_GET(disabledControlTextColor) + +COLOR_GET(selectedControlColor) + +COLOR_GET(selectedControlTextColor) + +COLOR_GET(alternateSelectedControlTextColor) + +COLOR_GET(scrubberTexturedBackgroundColor) + +COLOR_GET(windowFrameTextColor) + +COLOR_GET(underPageBackgroundColor) + +COLOR_GET(findHighlightColor) + +COLOR_GET(highlightColor) + +COLOR_GET(shadowColor) + + diff --git a/src/cocoa_helper.rs b/src/cocoa_helper.rs index 78f57bf..7a7260f 100644 --- a/src/cocoa_helper.rs +++ b/src/cocoa_helper.rs @@ -9,3 +9,109 @@ extern "C" { extern "C" { pub fn my_controlBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); } +extern "C" { + pub fn my_windowFrameColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_secondaryLabelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_tertiaryLabelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_quaternaryLabelColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_textColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_placeholderTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_selectedTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_textBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_selectedTextBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_keyboardFocusIndicatorColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_unemphasizedSelectedTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_unemphasizedSelectedTextBackgroundColor( + r: *mut f64, + g: *mut f64, + b: *mut f64, + a: *mut f64, + ); +} +extern "C" { + pub fn my_linkColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_separatorColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_selectedContentBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_unemphasizedSelectedContentBackgroundColor( + r: *mut f64, + g: *mut f64, + b: *mut f64, + a: *mut f64, + ); +} +extern "C" { + pub fn my_selectedMenuItemTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_gridColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_headerTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_controlAccentColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_controlColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_controlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_disabledControlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_selectedControlColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_selectedControlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_alternateSelectedControlTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_scrubberTexturedBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_windowFrameTextColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_underPageBackgroundColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_findHighlightColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_highlightColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} +extern "C" { + pub fn my_shadowColor(r: *mut f64, g: *mut f64, b: *mut f64, a: *mut f64); +} diff --git a/src/widget_themes/aqua2.rs b/src/widget_themes/aqua2.rs index 12fb3f3..cee956f 100644 --- a/src/widget_themes/aqua2.rs +++ b/src/widget_themes/aqua2.rs @@ -24,12 +24,8 @@ macro_rules! get_colors { } 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 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) @@ -37,9 +33,39 @@ lazy_static::lazy_static! { (255, 255, 255, 255) } }; - static ref CONTROL_COL: (u8, u8, u8, u8) = { - get_colors!(my_controlBackgroundColor) - }; + static ref CONTROL_COL: (u8, u8, u8, u8) = get_colors!(my_controlBackgroundColor); + static ref FRAME_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameColor); + static ref LABEL2_COL: (u8, u8, u8, u8) = get_colors!(my_secondaryLabelColor); + static ref LABEL3_COL: (u8, u8, u8, u8) = get_colors!(my_tertiaryLabelColor); + static ref LABEL4_COL: (u8, u8, u8, u8) = get_colors!(my_quaternaryLabelColor); + static ref TXT_COL: (u8, u8, u8, u8) = get_colors!(my_textColor); + static ref PH_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_placeholderTextColor); + static ref SEL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedTextColor); + static ref TXT_BG_COL: (u8, u8, u8, u8) = get_colors!(my_textBackgroundColor); + static ref SEL_TXT_BG_COL: (u8, u8, u8, u8) = get_colors!(my_selectedTextBackgroundColor); + static ref KB_IND_COL: (u8, u8, u8, u8) = get_colors!(my_keyboardFocusIndicatorColor); + static ref SEL_TXT2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedTextColor); + static ref SEL_TXT_BG2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedTextBackgroundColor); + static ref LINK_COL: (u8, u8, u8, u8) = get_colors!(my_linkColor); + static ref SEP_COL: (u8, u8, u8, u8) = get_colors!(my_separatorColor); + static ref SEL_BG_COL: (u8, u8, u8, u8) = get_colors!(my_selectedContentBackgroundColor); + static ref SEL_BG2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedContentBackgroundColor); + static ref SEL_MEN_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedMenuItemTextColor); + static ref GRID_COL: (u8, u8, u8, u8) = get_colors!(my_gridColor); + static ref HDR_COL: (u8, u8, u8, u8) = get_colors!(my_headerTextColor); + static ref CTRL_ACC_COL: (u8, u8, u8, u8) = get_colors!(my_controlAccentColor); + static ref CTRL_COL: (u8, u8, u8, u8) = get_colors!(my_controlColor); + static ref CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_controlTextColor); + static ref DIS_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_disabledControlTextColor); + static ref SEL_CTRL_COL: (u8, u8, u8, u8) = get_colors!(my_selectedControlColor); + static ref SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedControlTextColor); + static ref ALT_SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_alternateSelectedControlTextColor); + static ref SCRUB_BG_COL: (u8, u8, u8, u8) = get_colors!(my_scrubberTexturedBackgroundColor); + static ref WIN_FRM_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameTextColor); + static ref PAGE_BG_COL: (u8, u8, u8, u8) = get_colors!(my_underPageBackgroundColor); + static ref FIND_HLT_COL: (u8, u8, u8, u8) = get_colors!(my_findHighlightColor); + static ref HLT_COL: (u8, u8, u8, u8) = get_colors!(my_highlightColor); + static ref SHDW_COL: (u8, u8, u8, u8) = get_colors!(my_shadowColor); } fn aqua2_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) {