export entire TextView widget reference to the Search component

This commit is contained in:
yggverse 2024-12-17 02:13:47 +02:00
parent e0cb5d7a0f
commit 8b65df99f4
8 changed files with 52 additions and 43 deletions

View file

@ -0,0 +1,32 @@
mod current;
mod found;
use gtk::{TextTag, TextTagTable};
pub struct Tag {
pub current: TextTag,
pub found: TextTag,
}
impl Tag {
// Constructors
/// Create new `Self`
pub fn new(table: TextTagTable) -> Self {
// Init components
let current = current::new();
let found = found::new();
// Init tag table
// keep order as `current` should overwrite `found` tag style
// https://docs.gtk.org/gtk4/method.TextTag.set_priority.html
for &tag in &[&current, &found] {
if !table.add(tag) {
todo!()
}
}
// Init `Self`
Self { current, found }
}
}

View file

@ -0,0 +1,8 @@
use gtk::{gdk::RGBA, TextTag};
pub fn new() -> TextTag {
TextTag::builder()
.background_rgba(&RGBA::new(0.0, 0.4, 0.9, 1.0)) // @TODO use accent colors after adw 1.6 update
.foreground_rgba(&RGBA::new(1.0, 1.0, 1.0, 1.0))
.build()
}

View file

@ -0,0 +1,7 @@
use gtk::{gdk::RGBA, TextTag};
pub fn new() -> TextTag {
TextTag::builder()
.background_rgba(&RGBA::new(0.5, 0.5, 0.5, 0.5)) // @TODO use accent colors after adw 1.6 update
.build()
}