mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
39 lines
727 B
Rust
39 lines
727 B
Rust
use gtk::{prelude::WidgetExt, Align, Label};
|
|
|
|
const MARGIN: i32 = 6;
|
|
|
|
pub struct Placeholder {
|
|
pub label: Label,
|
|
}
|
|
|
|
impl Default for Placeholder {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl Placeholder {
|
|
// Constructors
|
|
|
|
/// Create new `Self`
|
|
pub fn new() -> Self {
|
|
Self {
|
|
label: Label::builder()
|
|
.css_classes(["error"])
|
|
.halign(Align::Start)
|
|
.label("Search action requires activation!")
|
|
.margin_start(MARGIN)
|
|
.build(),
|
|
}
|
|
}
|
|
|
|
// Actions
|
|
|
|
pub fn show(&self) {
|
|
self.label.set_visible(true)
|
|
}
|
|
|
|
pub fn hide(&self) {
|
|
self.label.set_visible(false)
|
|
}
|
|
}
|