From 6032788f612d1cced42beb275754335151668117 Mon Sep 17 00:00:00 2001 From: vitosotdihaet Date: Thu, 19 Oct 2023 16:36:38 +0300 Subject: [PATCH 1/2] Add an example showing gleam tab problem --- examples/tabs.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 examples/tabs.rs diff --git a/examples/tabs.rs b/examples/tabs.rs new file mode 100644 index 0000000..0eff507 --- /dev/null +++ b/examples/tabs.rs @@ -0,0 +1,46 @@ +use fltk::{prelude::*, *, group::*}; +use fltk_theme::{SchemeType, WidgetScheme}; + +fn main() { + let a = app::App::default(); + + let scheme = WidgetScheme::new(SchemeType::Gleam); + scheme.apply(); + + let mut win = window::Window::default().with_size(400, 300); + win.make_resizable(true); + + + let mut tabs = Tabs::default_fill(); + + let t1 = Flex::default().with_label("Hello this is a very long string"); + let mut choice = menu::Choice::new(100, 100, 200, 30, None); + choice.add_choice("Clean|Crystal|Gleam"); + choice.set_value(2); + t1.end(); + + let t2 = Flex::default().with_label("Another long string!!!"); + t2.end(); + + let t3 = Flex::default().with_label("Third tab to show you what's wrong"); + t3.end(); + + tabs.end(); + tabs.auto_layout(); + tabs.show(); + + win.end(); + win.show(); + + choice.set_callback(|c| { + let scheme = match c.value() { + 0 => WidgetScheme::new(SchemeType::Clean), + 1 => WidgetScheme::new(SchemeType::Crystal), + 2 => WidgetScheme::new(SchemeType::Gleam), + _ => unimplemented!(), + }; + scheme.apply(); + }); + + a.run().unwrap(); +} From 5177d0205b9b0bd982221011e79a850b170705cc Mon Sep 17 00:00:00 2001 From: vitosotdihaet Date: Thu, 19 Oct 2023 16:37:04 +0300 Subject: [PATCH 2/2] Fix gleam widget scheme --- src/widget_schemes/gleam.rs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/widget_schemes/gleam.rs b/src/widget_schemes/gleam.rs index c2a45a7..801ce89 100644 --- a/src/widget_schemes/gleam.rs +++ b/src/widget_schemes/gleam.rs @@ -10,29 +10,8 @@ fn frame_rect(x: i32, y: i32, w: i32, h: i32, bc: Color) { } fn shade_rect_up(x: i32, y: i32, w: i32, h: i32, bc: Color) { - // Draws the shiny - let third = h as f32 / 3.; set_draw_color(activated_color(bc)); - draw_rectf(x, y, w, third as i32 + 1); - - let step_size = 0.10 / (h as f32 - third); - let mut j = 0; - - let mut k = 1.0; - loop { - if k >= 0.90 { - break; - } - j += 1; - set_draw_color(activated_color(Color::color_average(bc, Color::White, k))); - draw_line( - x, - y + j + third as i32 - 1, - x + w - 1, - y + j + third as i32 - 1, - ); - k -= step_size; - } + draw_rectf(x, y, w, h); } fn frame_rect_up(x: i32, y: i32, w: i32, h: i32, bc: Color) { @@ -86,7 +65,7 @@ fn up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { } fn up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { - shade_rect_up(x + 1, y, w - 2, h - 1, c); + shade_rect_up(x + 1, y, w, h - 1, c); frame_rect_up(x, y, w - 1, h - 1, c.darker()); //draw the inner rect. frame_rect(