diff --git a/README.md b/README.md index 61ec187..0ad8d02 100644 --- a/README.md +++ b/README.md @@ -75,14 +75,13 @@ fn main() { - Greybird (Gnome xfce) ![alt_test](screenshots/greybird.jpg) - ## Color themes - Black theme ![alt_test](screenshots/black.jpg) - Dark theme -![alt_test](screenshots/dark_color.JPG) +![alt_test](screenshots/dark_color.jpg) - Plain gray theme ![alt_test](screenshots/plain-gray.jpg) @@ -92,3 +91,39 @@ fn main() { - Shake theme ![alt_test](screenshots/shake.jpg) + +## FrameTypes + +Choosing a WidgetTheme will also define a set of FrameTypes which can be used for your widgets. +``` +OS_BUTTON_UP_BOX +OS_CHECK_DOWN_BOX +OS_BUTTON_UP_FRAME +OS_CHECK_DOWN_FRAME +OS_PANEL_THIN_UP_BOX +OS_SPACER_THIN_DOWN_BOX +OS_PANEL_THIN_UP_FRAME +OS_SPACER_THIN_DOWN_FRAME +OS_RADIO_ROUND_DOWN_BOX +OS_HOVERED_UP_BOX +OS_DEPRESSED_DOWN_BOX +OS_HOVERED_UP_FRAME +OS_DEPRESSED_DOWN_FRAME +OS_INPUT_THIN_DOWN_BOX +OS_INPUT_THIN_DOWN_FRAME +OS_MINI_BUTTON_UP_BOX +OS_MINI_DEPRESSED_DOWN_BOX +OS_MINI_BUTTON_UP_FRAME +OS_MINI_DEPRESSED_DOWN_FRAME +OS_DEFAULT_BUTTON_UP_BOX +OS_DEFAULT_HOVERED_UP_BOX +OS_DEFAULT_DEPRESSED_DOWN_BOX +OS_TOOLBAR_BUTTON_HOVER_BOX +OS_TABS_BOX +OS_SWATCH_BOX +OS_SWATCH_FRAME +OS_BG_BOX +``` + +You can check the frames example to see all `FrameType`'s you can apply to you widgets. +![alt_test](screenshots/frames.jpg) diff --git a/examples/frames.rs b/examples/frames.rs new file mode 100644 index 0000000..0580381 --- /dev/null +++ b/examples/frames.rs @@ -0,0 +1,118 @@ +use fltk::{prelude::*, *}; +use fltk_theme::{widget_themes::*, ThemeType, WidgetTheme}; + +fn main() { + let a = app::App::default(); + let theme = WidgetTheme::new(ThemeType::Aqua); + theme.apply(); + let mut win = window::Window::default().with_size(800, 800); + let mut choice = menu::Choice::new(300, 10, 200, 30, None); + choice.add_choice("Classic|Aero|Metro|Aqua|Greybird|Blue|HighContrast|Dark"); + choice.set_value(3); + choice.set_frame(OS_PANEL_THIN_UP_BOX); + let mut vgrid = group::VGrid::new(50, 100, 700, 700, None); + vgrid.set_params(6, 6, 5); + let mut frame = frame::Frame::default().with_label(&"BUTTON_UP_BOX".to_lowercase()); + frame.set_frame(OS_BUTTON_UP_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"CHECK_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_CHECK_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"BUTTON_UP_FRAME".to_lowercase()); + frame.set_frame(OS_BUTTON_UP_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"CHECK_DOWN_FRAME".to_lowercase()); + frame.set_frame(OS_CHECK_DOWN_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"PANEL_THIN_UP_BOX".to_lowercase()); + frame.set_frame(OS_PANEL_THIN_UP_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"SPACER_THIN_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_SPACER_THIN_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"PANEL_THIN_UP_FRAME".to_lowercase()); + frame.set_frame(OS_PANEL_THIN_UP_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"SPACER_THIN_DOWN_FRAME".to_lowercase()); + frame.set_frame(OS_SPACER_THIN_DOWN_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"RADIO_ROUND_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_RADIO_ROUND_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"HOVERED_UP_BOX".to_lowercase()); + frame.set_frame(OS_HOVERED_UP_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"DEPRESSED_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_DEPRESSED_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"HOVERED_UP_FRAME".to_lowercase()); + frame.set_frame(OS_HOVERED_UP_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"DEPRESSED_DOWN_FRAME".to_lowercase()); + frame.set_frame(OS_DEPRESSED_DOWN_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"INPUT_THIN_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_INPUT_THIN_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"INPUT_THIN_DOWN_FRAME".to_lowercase()); + frame.set_frame(OS_INPUT_THIN_DOWN_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"MINI_BUTTON_UP_BOX".to_lowercase()); + frame.set_frame(OS_MINI_BUTTON_UP_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"MINI_DEPRESSED_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_MINI_DEPRESSED_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"MINI_BUTTON_UP_FRAME".to_lowercase()); + frame.set_frame(OS_MINI_BUTTON_UP_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"MINI_DEPRESSED_DOWN_FRAME".to_lowercase()); + frame.set_frame(OS_MINI_DEPRESSED_DOWN_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"DEFAULT_BUTTON_UP_BOX".to_lowercase()); + frame.set_frame(OS_DEFAULT_BUTTON_UP_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"DEFAULT_HOVERED_UP_BOX".to_lowercase()); + frame.set_frame(OS_DEFAULT_HOVERED_UP_BOX); + frame.set_label_size(10); + let mut frame = + frame::Frame::default().with_label(&"DEFAULT_DEPRESSED_DOWN_BOX".to_lowercase()); + frame.set_frame(OS_DEFAULT_DEPRESSED_DOWN_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"TOOLBAR_BUTTON_HOVER_BOX".to_lowercase()); + frame.set_frame(OS_TOOLBAR_BUTTON_HOVER_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"TABS_BOX".to_lowercase()); + frame.set_frame(OS_TABS_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"SWATCH_BOX".to_lowercase()); + frame.set_frame(OS_SWATCH_BOX); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"SWATCH_FRAME".to_lowercase()); + frame.set_frame(OS_SWATCH_FRAME); + frame.set_label_size(10); + let mut frame = frame::Frame::default().with_label(&"BG_BOX".to_lowercase()); + frame.set_frame(OS_BG_BOX); + frame.set_label_size(10); + frame::Frame::default(); + frame::Frame::default(); + frame::Frame::default(); + vgrid.end(); + win.end(); + win.show(); + choice.set_callback(|c| { + let theme = match c.value() { + 0 => WidgetTheme::new(ThemeType::Classic), + 1 => WidgetTheme::new(ThemeType::Aero), + 2 => WidgetTheme::new(ThemeType::Metro), + 3 => WidgetTheme::new(ThemeType::Aqua), + 4 => WidgetTheme::new(ThemeType::Greybird), + 5 => WidgetTheme::new(ThemeType::Blue), + 6 => WidgetTheme::new(ThemeType::HighContrast), + 7 => WidgetTheme::new(ThemeType::Dark), + _ => WidgetTheme::new(ThemeType::Classic), + }; + theme.apply(); + }); + a.run().unwrap(); +} diff --git a/examples/load.rs b/examples/load.rs index d1ac68d..49d95d9 100644 --- a/examples/load.rs +++ b/examples/load.rs @@ -30,4 +30,4 @@ fn main() { win.end(); win.show(); a.run().unwrap(); -} \ No newline at end of file +} diff --git a/examples/hello.rs b/examples/predef_color.rs similarity index 75% rename from examples/hello.rs rename to examples/predef_color.rs index 96a2f39..3cc4470 100644 --- a/examples/hello.rs +++ b/examples/predef_color.rs @@ -1,9 +1,9 @@ use fltk::{prelude::*, *}; -use fltk_theme::{ColorTheme, color_themes}; +use fltk_theme::{color_themes, ColorTheme}; fn main() { let a = app::App::default().with_scheme(app::Scheme::Gtk); - let theme = ColorTheme::from_colormap(color_themes::BLACK_THEME); + let theme = ColorTheme::from_colormap(color_themes::DARK_THEME); theme.apply(); let mut win = window::Window::default().with_size(400, 300); let mut btn = button::Button::new(160, 200, 80, 40, "Hello"); diff --git a/examples/widget_theme.rs b/examples/widget_theme.rs index 6feb33b..3d12dd9 100644 --- a/examples/widget_theme.rs +++ b/examples/widget_theme.rs @@ -1,14 +1,36 @@ use fltk::{prelude::*, *}; -use fltk_theme::{widget_themes, WidgetTheme, ThemeType}; +use fltk_theme::{widget_themes, ThemeType, WidgetTheme}; fn main() { let a = app::App::default(); - let widget_theme = WidgetTheme::new(ThemeType::Aqua); - widget_theme.apply(); + let theme = WidgetTheme::new(ThemeType::Aqua); + theme.apply(); let mut win = window::Window::default().with_size(400, 300); - let mut btn = button::Button::new(160, 200, 80, 30, "Hello"); + let mut choice = menu::Choice::new(100, 100, 200, 30, None); + choice.add_choice("Classic|Aero|Metro|Aqua|Greybird|Blue|HighContrast|Dark"); + choice.set_value(3); + choice.set_frame(widget_themes::OS_PANEL_THIN_UP_BOX); + let mut check = button::CheckButton::new(160, 150, 80, 30, "Check"); + check.set_value(true); + let mut round = button::RoundButton::new(160, 180, 80, 30, "Round"); + round.set_value(true); + let mut btn = button::Button::new(160, 220, 80, 30, "Hello"); btn.set_frame(widget_themes::OS_DEFAULT_BUTTON_UP_BOX); win.end(); win.show(); + choice.set_callback(|c| { + let theme = match c.value() { + 0 => WidgetTheme::new(ThemeType::Classic), + 1 => WidgetTheme::new(ThemeType::Aero), + 2 => WidgetTheme::new(ThemeType::Metro), + 3 => WidgetTheme::new(ThemeType::Aqua), + 4 => WidgetTheme::new(ThemeType::Greybird), + 5 => WidgetTheme::new(ThemeType::Blue), + 6 => WidgetTheme::new(ThemeType::HighContrast), + 7 => WidgetTheme::new(ThemeType::Dark), + _ => WidgetTheme::new(ThemeType::Classic), + }; + theme.apply(); + }); a.run().unwrap(); -} \ No newline at end of file +} diff --git a/screenshots/aero.jpg b/screenshots/aero.jpg index b343926..2ca48c7 100755 Binary files a/screenshots/aero.jpg and b/screenshots/aero.jpg differ diff --git a/screenshots/aqua.jpg b/screenshots/aqua.jpg index cfcde6d..a99a90a 100755 Binary files a/screenshots/aqua.jpg and b/screenshots/aqua.jpg differ diff --git a/screenshots/blue.jpg b/screenshots/blue.jpg index 7bc2418..83ae84d 100755 Binary files a/screenshots/blue.jpg and b/screenshots/blue.jpg differ diff --git a/screenshots/classic.jpg b/screenshots/classic.jpg index 1603ff5..e570805 100755 Binary files a/screenshots/classic.jpg and b/screenshots/classic.jpg differ diff --git a/screenshots/dark.jpg b/screenshots/dark.jpg index ace44a9..946e458 100644 Binary files a/screenshots/dark.jpg and b/screenshots/dark.jpg differ diff --git a/screenshots/dark_color.JPG b/screenshots/dark_color.JPG index 44e6da2..477a6c2 100644 Binary files a/screenshots/dark_color.JPG and b/screenshots/dark_color.JPG differ diff --git a/screenshots/frames.jpg b/screenshots/frames.jpg new file mode 100644 index 0000000..212c871 Binary files /dev/null and b/screenshots/frames.jpg differ diff --git a/screenshots/greybird.jpg b/screenshots/greybird.jpg index ffad86f..459bf65 100755 Binary files a/screenshots/greybird.jpg and b/screenshots/greybird.jpg differ diff --git a/screenshots/high_contrast.jpg b/screenshots/high_contrast.jpg index e53737f..61bbbbf 100755 Binary files a/screenshots/high_contrast.jpg and b/screenshots/high_contrast.jpg differ diff --git a/screenshots/metro.jpg b/screenshots/metro.jpg index a1e74d4..220e866 100755 Binary files a/screenshots/metro.jpg and b/screenshots/metro.jpg differ diff --git a/src/color_themes/mod.rs b/src/color_themes/mod.rs index 8dc6224..ff9ebaf 100644 --- a/src/color_themes/mod.rs +++ b/src/color_themes/mod.rs @@ -1,11 +1,11 @@ -mod tan; mod black; +mod dark; mod gray; mod shake; -mod dark; +mod tan; -pub use tan::*; pub use black::*; +pub use dark::*; pub use gray::*; pub use shake::*; -pub use dark::*; \ No newline at end of file +pub use tan::*;